aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-02-09 18:08:47 -0800
commitf2f897a1762fab84d2905f32b1c15dd7b42abb56 (patch)
treea38f51d3f1fcbf44afddb4736d549c12eaf491be
parent72d2959272b4616f17a97667e6dfa9d06bf109a3 (diff)
downloadsyslinux-f2f897a1762fab84d2905f32b1c15dd7b42abb56.tar.gz
syslinux-f2f897a1762fab84d2905f32b1c15dd7b42abb56.tar.xz
syslinux-f2f897a1762fab84d2905f32b1c15dd7b42abb56.zip
gpxe: delete long since obsolete snapshot of gPXE
gPXE has been deprecated in favor of iPXE for many, many years now. It is much better than users get it directly from the iPXE project, since we should no longer need any special modifications for Syslinux use. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--Makefile21
-rw-r--r--gpxe/.gitignore1
-rw-r--r--gpxe/COPYING339
-rw-r--r--gpxe/COPYRIGHTS26
-rw-r--r--gpxe/LOG12
-rw-r--r--gpxe/Makefile54
-rw-r--r--gpxe/README53
-rw-r--r--gpxe/VERSION1
-rw-r--r--gpxe/gpxe.diff73
-rw-r--r--gpxe/pxelinux.gpxe5
-rw-r--r--gpxe/pxelinuxk.gpxe5
-rw-r--r--gpxe/src/.gitignore5
-rw-r--r--gpxe/src/Makefile150
-rw-r--r--gpxe/src/Makefile.housekeeping1004
-rw-r--r--gpxe/src/arch/i386/Makefile117
-rw-r--r--gpxe/src/arch/i386/Makefile.efi10
-rw-r--r--gpxe/src/arch/i386/Makefile.pcbios70
-rw-r--r--gpxe/src/arch/i386/README.i386197
-rw-r--r--gpxe/src/arch/i386/core/aout_loader.c144
-rw-r--r--gpxe/src/arch/i386/core/basemem_packet.c32
-rw-r--r--gpxe/src/arch/i386/core/cpu.c73
-rw-r--r--gpxe/src/arch/i386/core/dumpregs.c23
-rw-r--r--gpxe/src/arch/i386/core/freebsd_loader.c377
-rw-r--r--gpxe/src/arch/i386/core/gdbidt.S215
-rw-r--r--gpxe/src/arch/i386/core/gdbmach.c149
-rw-r--r--gpxe/src/arch/i386/core/nulltrap.c51
-rw-r--r--gpxe/src/arch/i386/core/pic8259.c66
-rw-r--r--gpxe/src/arch/i386/core/rdtsc_timer.c89
-rw-r--r--gpxe/src/arch/i386/core/relocate.c170
-rw-r--r--gpxe/src/arch/i386/core/setjmp.S42
-rw-r--r--gpxe/src/arch/i386/core/stack.S15
-rw-r--r--gpxe/src/arch/i386/core/stack16.S15
-rw-r--r--gpxe/src/arch/i386/core/timer2.c87
-rw-r--r--gpxe/src/arch/i386/core/video_subr.c104
-rw-r--r--gpxe/src/arch/i386/core/virtaddr.S103
-rw-r--r--gpxe/src/arch/i386/core/wince_loader.c273
-rw-r--r--gpxe/src/arch/i386/core/x86_io.c96
-rw-r--r--gpxe/src/arch/i386/drivers/net/undi.c148
-rw-r--r--gpxe/src/arch/i386/drivers/net/undiisr.S87
-rw-r--r--gpxe/src/arch/i386/drivers/net/undiload.c171
-rw-r--r--gpxe/src/arch/i386/drivers/net/undinet.c631
-rw-r--r--gpxe/src/arch/i386/drivers/net/undionly.c129
-rw-r--r--gpxe/src/arch/i386/drivers/net/undipreload.c37
-rw-r--r--gpxe/src/arch/i386/drivers/net/undirom.c234
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/basemem.c46
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/bios_console.c298
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/e820mangler.S596
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/fakee820.c93
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/gateA20.c176
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/hidemem.c220
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/memmap.c312
-rw-r--r--gpxe/src/arch/i386/firmware/pcbios/pnpbios.c109
-rw-r--r--gpxe/src/arch/i386/hci/commands/pxe_cmd.c33
-rw-r--r--gpxe/src/arch/i386/image/bootsector.c114
-rw-r--r--gpxe/src/arch/i386/image/bzimage.c561
-rw-r--r--gpxe/src/arch/i386/image/com32.c285
-rw-r--r--gpxe/src/arch/i386/image/comboot.c322
-rw-r--r--gpxe/src/arch/i386/image/elfboot.c113
-rw-r--r--gpxe/src/arch/i386/image/eltorito.c336
-rw-r--r--gpxe/src/arch/i386/image/multiboot.c466
-rw-r--r--gpxe/src/arch/i386/image/nbi.c442
-rw-r--r--gpxe/src/arch/i386/image/pxe_image.c117
-rw-r--r--gpxe/src/arch/i386/include/basemem.h35
-rw-r--r--gpxe/src/arch/i386/include/basemem_packet.h15
-rw-r--r--gpxe/src/arch/i386/include/bios.h10
-rw-r--r--gpxe/src/arch/i386/include/bios_disks.h69
-rw-r--r--gpxe/src/arch/i386/include/biosint.h33
-rw-r--r--gpxe/src/arch/i386/include/bits/byteswap.h43
-rw-r--r--gpxe/src/arch/i386/include/bits/compiler.h27
-rw-r--r--gpxe/src/arch/i386/include/bits/cpu.h86
-rw-r--r--gpxe/src/arch/i386/include/bits/eltorito.h3
-rw-r--r--gpxe/src/arch/i386/include/bits/endian.h8
-rw-r--r--gpxe/src/arch/i386/include/bits/errfile.h42
-rw-r--r--gpxe/src/arch/i386/include/bits/io.h14
-rw-r--r--gpxe/src/arch/i386/include/bits/nap.h15
-rw-r--r--gpxe/src/arch/i386/include/bits/smbios.h14
-rw-r--r--gpxe/src/arch/i386/include/bits/stdint.h23
-rw-r--r--gpxe/src/arch/i386/include/bits/timer.h15
-rw-r--r--gpxe/src/arch/i386/include/bits/uaccess.h14
-rw-r--r--gpxe/src/arch/i386/include/bits/umalloc.h14
-rw-r--r--gpxe/src/arch/i386/include/bochs.h34
-rw-r--r--gpxe/src/arch/i386/include/bootsector.h14
-rw-r--r--gpxe/src/arch/i386/include/bzimage.h142
-rw-r--r--gpxe/src/arch/i386/include/comboot.h135
-rw-r--r--gpxe/src/arch/i386/include/fakee820.h9
-rw-r--r--gpxe/src/arch/i386/include/gateA20.h7
-rw-r--r--gpxe/src/arch/i386/include/gdbmach.h64
-rw-r--r--gpxe/src/arch/i386/include/gpxe/abft.h37
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_nap.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_smbios.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/bios_timer.h44
-rw-r--r--gpxe/src/arch/i386/include/gpxe/ibft.h302
-rw-r--r--gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h18
-rw-r--r--gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h39
-rw-r--r--gpxe/src/arch/i386/include/gpxe/sbft.h125
-rw-r--r--gpxe/src/arch/i386/include/gpxe/timer2.h14
-rw-r--r--gpxe/src/arch/i386/include/gpxe/x86_io.h153
-rw-r--r--gpxe/src/arch/i386/include/int13.h292
-rw-r--r--gpxe/src/arch/i386/include/kir.h18
-rw-r--r--gpxe/src/arch/i386/include/libkir.h233
-rw-r--r--gpxe/src/arch/i386/include/librm.h206
-rw-r--r--gpxe/src/arch/i386/include/limits.h61
-rw-r--r--gpxe/src/arch/i386/include/memsizes.h19
-rw-r--r--gpxe/src/arch/i386/include/multiboot.h149
-rw-r--r--gpxe/src/arch/i386/include/pic8259.h71
-rw-r--r--gpxe/src/arch/i386/include/pnpbios.h17
-rw-r--r--gpxe/src/arch/i386/include/pxe.h154
-rw-r--r--gpxe/src/arch/i386/include/pxe_api.h1909
-rw-r--r--gpxe/src/arch/i386/include/pxe_call.h57
-rw-r--r--gpxe/src/arch/i386/include/pxe_types.h127
-rw-r--r--gpxe/src/arch/i386/include/pxeparent.h11
-rw-r--r--gpxe/src/arch/i386/include/realmode.h127
-rw-r--r--gpxe/src/arch/i386/include/registers.h198
-rw-r--r--gpxe/src/arch/i386/include/setjmp.h40
-rw-r--r--gpxe/src/arch/i386/include/undi.h106
-rw-r--r--gpxe/src/arch/i386/include/undiload.h35
-rw-r--r--gpxe/src/arch/i386/include/undinet.h17
-rw-r--r--gpxe/src/arch/i386/include/undipreload.h18
-rw-r--r--gpxe/src/arch/i386/include/undirom.h53
-rw-r--r--gpxe/src/arch/i386/include/vga.h228
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/abft.c62
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/aoeboot.c78
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/bios_nap.c16
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/bios_smbios.c86
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/bios_timer.c65
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/biosint.c92
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/ib_srpboot.c73
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/ibft.c451
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/int13.c715
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/iscsiboot.c75
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/keepsan.c26
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/memtop_umalloc.c202
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/pcibios.c115
-rw-r--r--gpxe/src/arch/i386/interface/pcbios/sbft.c105
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_call.c509
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_entry.S216
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_errors.c103
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_file.c306
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_loader.c50
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_preboot.c357
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_tftp.c586
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_udp.c405
-rw-r--r--gpxe/src/arch/i386/interface/pxe/pxe_undi.c791
-rw-r--r--gpxe/src/arch/i386/interface/pxeparent/pxeparent.c201
-rw-r--r--gpxe/src/arch/i386/interface/pxeparent/pxeparent_dhcp.c69
-rw-r--r--gpxe/src/arch/i386/interface/syslinux/com32_call.c190
-rw-r--r--gpxe/src/arch/i386/interface/syslinux/com32_wrapper.S94
-rw-r--r--gpxe/src/arch/i386/interface/syslinux/comboot_call.c716
-rw-r--r--gpxe/src/arch/i386/interface/syslinux/comboot_resolv.c60
-rw-r--r--gpxe/src/arch/i386/kir-Makefile26
-rw-r--r--gpxe/src/arch/i386/prefix/bootpart.S218
-rw-r--r--gpxe/src/arch/i386/prefix/dskprefix.S381
-rw-r--r--gpxe/src/arch/i386/prefix/hdprefix.S109
-rw-r--r--gpxe/src/arch/i386/prefix/hromprefix.S12
-rw-r--r--gpxe/src/arch/i386/prefix/kkpxeprefix.S13
-rw-r--r--gpxe/src/arch/i386/prefix/kpxeprefix.S9
-rw-r--r--gpxe/src/arch/i386/prefix/libprefix.S819
-rw-r--r--gpxe/src/arch/i386/prefix/lkrnprefix.S216
-rw-r--r--gpxe/src/arch/i386/prefix/mbr.S13
-rw-r--r--gpxe/src/arch/i386/prefix/nbiprefix.S77
-rw-r--r--gpxe/src/arch/i386/prefix/nullprefix.S13
-rw-r--r--gpxe/src/arch/i386/prefix/pxeprefix.S761
-rw-r--r--gpxe/src/arch/i386/prefix/romprefix.S1079
-rw-r--r--gpxe/src/arch/i386/prefix/undiloader.S49
-rw-r--r--gpxe/src/arch/i386/prefix/unnrv2b.S184
-rw-r--r--gpxe/src/arch/i386/prefix/unnrv2b16.S9
-rw-r--r--gpxe/src/arch/i386/prefix/usbdisk.S23
-rw-r--r--gpxe/src/arch/i386/prefix/xromprefix.S9
-rw-r--r--gpxe/src/arch/i386/scripts/i386-kir.lds197
-rw-r--r--gpxe/src/arch/i386/scripts/i386.lds202
-rw-r--r--gpxe/src/arch/i386/transitions/libkir.S256
-rw-r--r--gpxe/src/arch/i386/transitions/libpm.S0
-rw-r--r--gpxe/src/arch/i386/transitions/librm.S581
-rw-r--r--gpxe/src/arch/i386/transitions/librm_mgmt.c58
-rw-r--r--gpxe/src/arch/x86/Makefile9
-rw-r--r--gpxe/src/arch/x86/Makefile.efi28
-rw-r--r--gpxe/src/arch/x86/core/pcidirect.c47
-rw-r--r--gpxe/src/arch/x86/core/x86_string.c63
-rw-r--r--gpxe/src/arch/x86/include/bits/pci_io.h15
-rw-r--r--gpxe/src/arch/x86/include/bits/string.h252
-rw-r--r--gpxe/src/arch/x86/include/gpxe/efi/efix86_nap.h18
-rw-r--r--gpxe/src/arch/x86/include/gpxe/pcibios.h135
-rw-r--r--gpxe/src/arch/x86/include/gpxe/pcidirect.h141
-rw-r--r--gpxe/src/arch/x86/interface/efi/efix86_nap.c48
-rw-r--r--gpxe/src/arch/x86/prefix/efidrvprefix.c46
-rw-r--r--gpxe/src/arch/x86/prefix/efiprefix.c41
-rw-r--r--gpxe/src/arch/x86/scripts/efi.lds106
-rw-r--r--gpxe/src/arch/x86_64/Makefile41
-rw-r--r--gpxe/src/arch/x86_64/Makefile.efi14
-rw-r--r--gpxe/src/arch/x86_64/include/bits/byteswap.h22
-rw-r--r--gpxe/src/arch/x86_64/include/bits/compiler.h14
-rw-r--r--gpxe/src/arch/x86_64/include/bits/endian.h6
-rw-r--r--gpxe/src/arch/x86_64/include/bits/errfile.h11
-rw-r--r--gpxe/src/arch/x86_64/include/bits/io.h10
-rw-r--r--gpxe/src/arch/x86_64/include/bits/nap.h12
-rw-r--r--gpxe/src/arch/x86_64/include/bits/smbios.h10
-rw-r--r--gpxe/src/arch/x86_64/include/bits/stdint.h21
-rw-r--r--gpxe/src/arch/x86_64/include/bits/timer.h10
-rw-r--r--gpxe/src/arch/x86_64/include/bits/uaccess.h10
-rw-r--r--gpxe/src/arch/x86_64/include/bits/umalloc.h10
-rw-r--r--gpxe/src/arch/x86_64/include/gdbmach.h51
-rw-r--r--gpxe/src/arch/x86_64/include/limits.h59
-rw-r--r--gpxe/src/config/.gitignore1
-rw-r--r--gpxe/src/config/config.c262
-rw-r--r--gpxe/src/config/config_net80211.c50
-rw-r--r--gpxe/src/config/config_romprefix.c24
-rw-r--r--gpxe/src/config/console.h23
-rw-r--r--gpxe/src/config/defaults.h10
-rw-r--r--gpxe/src/config/defaults/efi.h21
-rw-r--r--gpxe/src/config/defaults/pcbios.h35
-rw-r--r--gpxe/src/config/general.h148
-rw-r--r--gpxe/src/config/ioapi.h17
-rw-r--r--gpxe/src/config/isa.h15
-rw-r--r--gpxe/src/config/nap.h17
-rw-r--r--gpxe/src/config/serial.h35
-rw-r--r--gpxe/src/config/timer.h17
-rw-r--r--gpxe/src/config/umalloc.h14
-rw-r--r--gpxe/src/core/acpi.c42
-rw-r--r--gpxe/src/core/ansiesc.c116
-rw-r--r--gpxe/src/core/asprintf.c49
-rw-r--r--gpxe/src/core/base64.c68
-rw-r--r--gpxe/src/core/basename.c64
-rw-r--r--gpxe/src/core/bitmap.c101
-rw-r--r--gpxe/src/core/bitops.c13
-rw-r--r--gpxe/src/core/btext.c5039
-rw-r--r--gpxe/src/core/console.c130
-rw-r--r--gpxe/src/core/cpio.c42
-rw-r--r--gpxe/src/core/ctype.c48
-rw-r--r--gpxe/src/core/cwuri.c46
-rw-r--r--gpxe/src/core/debug.c196
-rw-r--r--gpxe/src/core/device.c107
-rw-r--r--gpxe/src/core/downloader.c291
-rw-r--r--gpxe/src/core/errno.c18
-rw-r--r--gpxe/src/core/exec.c251
-rw-r--r--gpxe/src/core/filter.c74
-rw-r--r--gpxe/src/core/gdbserial.c46
-rw-r--r--gpxe/src/core/gdbstub.c397
-rw-r--r--gpxe/src/core/gdbudp.c257
-rw-r--r--gpxe/src/core/getkey.c83
-rw-r--r--gpxe/src/core/getopt.c273
-rw-r--r--gpxe/src/core/hw.c74
-rw-r--r--gpxe/src/core/i82365.c656
-rw-r--r--gpxe/src/core/image.c328
-rw-r--r--gpxe/src/core/init.c98
-rw-r--r--gpxe/src/core/interface.c62
-rw-r--r--gpxe/src/core/iobuf.c96
-rw-r--r--gpxe/src/core/job.c97
-rw-r--r--gpxe/src/core/linebuf.c111
-rw-r--r--gpxe/src/core/main.c91
-rw-r--r--gpxe/src/core/malloc.c386
-rw-r--r--gpxe/src/core/misc.c80
-rw-r--r--gpxe/src/core/monojob.c103
-rw-r--r--gpxe/src/core/null_nap.c3
-rw-r--r--gpxe/src/core/nvo.c263
-rw-r--r--gpxe/src/core/open.c197
-rw-r--r--gpxe/src/core/pc_kbd.c112
-rw-r--r--gpxe/src/core/pcmcia.c267
-rw-r--r--gpxe/src/core/posix_io.c355
-rw-r--r--gpxe/src/core/process.c106
-rw-r--r--gpxe/src/core/proto_eth_slow.c406
-rw-r--r--gpxe/src/core/random.c41
-rw-r--r--gpxe/src/core/refcnt.c78
-rw-r--r--gpxe/src/core/resolv.c415
-rw-r--r--gpxe/src/core/serial.c254
-rw-r--r--gpxe/src/core/serial_console.c31
-rw-r--r--gpxe/src/core/settings.c1456
-rw-r--r--gpxe/src/core/string.c355
-rw-r--r--gpxe/src/core/stringextra.c273
-rw-r--r--gpxe/src/core/timer.c42
-rw-r--r--gpxe/src/core/uri.c492
-rw-r--r--gpxe/src/core/uuid.c50
-rw-r--r--gpxe/src/core/vsprintf.c423
-rw-r--r--gpxe/src/core/xfer.c417
-rw-r--r--gpxe/src/crypto/aes_wrap.c123
-rw-r--r--gpxe/src/crypto/arc4.c131
-rw-r--r--gpxe/src/crypto/asn1.c166
-rw-r--r--gpxe/src/crypto/axtls/aes.c476
-rw-r--r--gpxe/src/crypto/axtls/bigint.c1496
-rw-r--r--gpxe/src/crypto/axtls/bigint.h91
-rw-r--r--gpxe/src/crypto/axtls/bigint_impl.h105
-rw-r--r--gpxe/src/crypto/axtls/crypto.h300
-rw-r--r--gpxe/src/crypto/axtls/os_port.h61
-rw-r--r--gpxe/src/crypto/axtls/rsa.c332
-rw-r--r--gpxe/src/crypto/axtls/sha1.c240
-rw-r--r--gpxe/src/crypto/axtls_aes.c158
-rw-r--r--gpxe/src/crypto/axtls_sha1.c25
-rw-r--r--gpxe/src/crypto/cbc.c101
-rw-r--r--gpxe/src/crypto/chap.c124
-rw-r--r--gpxe/src/crypto/crandom.c55
-rw-r--r--gpxe/src/crypto/crc32.c54
-rw-r--r--gpxe/src/crypto/crypto_null.c87
-rw-r--r--gpxe/src/crypto/hmac.c122
-rw-r--r--gpxe/src/crypto/md5.c234
-rw-r--r--gpxe/src/crypto/sha1extra.c165
-rw-r--r--gpxe/src/crypto/x509.c183
-rw-r--r--gpxe/src/doc/build_sys.dox419
-rw-r--r--gpxe/src/doc/pxe_extensions312
-rw-r--r--gpxe/src/doxygen.cfg1487
-rw-r--r--gpxe/src/drivers/bitbash/bitbash.c57
-rw-r--r--gpxe/src/drivers/bitbash/i2c_bit.c393
-rw-r--r--gpxe/src/drivers/bitbash/spi_bit.c225
-rw-r--r--gpxe/src/drivers/block/ata.c188
-rw-r--r--gpxe/src/drivers/block/ramdisk.c97
-rw-r--r--gpxe/src/drivers/block/scsi.c366
-rw-r--r--gpxe/src/drivers/block/srp.c523
-rw-r--r--gpxe/src/drivers/bus/eisa.c182
-rw-r--r--gpxe/src/drivers/bus/isa.c172
-rw-r--r--gpxe/src/drivers/bus/isa_ids.c26
-rw-r--r--gpxe/src/drivers/bus/isapnp.c755
-rw-r--r--gpxe/src/drivers/bus/mca.c177
-rw-r--r--gpxe/src/drivers/bus/pci.c341
-rw-r--r--gpxe/src/drivers/bus/pcibackup.c90
-rw-r--r--gpxe/src/drivers/bus/pciextra.c86
-rw-r--r--gpxe/src/drivers/bus/virtio-pci.c64
-rw-r--r--gpxe/src/drivers/bus/virtio-ring.c134
-rw-r--r--gpxe/src/drivers/infiniband/MT25218_PRM.h3462
-rw-r--r--gpxe/src/drivers/infiniband/MT25408_PRM.h3319
-rw-r--r--gpxe/src/drivers/infiniband/arbel.c2247
-rw-r--r--gpxe/src/drivers/infiniband/arbel.h544
-rw-r--r--gpxe/src/drivers/infiniband/hermon.c2752
-rw-r--r--gpxe/src/drivers/infiniband/hermon.h610
-rw-r--r--gpxe/src/drivers/infiniband/linda.c2432
-rw-r--r--gpxe/src/drivers/infiniband/linda.h276
-rw-r--r--gpxe/src/drivers/infiniband/linda_fw.c1069
-rw-r--r--gpxe/src/drivers/infiniband/mlx_bitops.h223
-rw-r--r--gpxe/src/drivers/infiniband/qib_7220_regs.h1762
-rwxr-xr-xgpxe/src/drivers/infiniband/qib_genbits.pl116
-rw-r--r--gpxe/src/drivers/net/3c503.c5
-rw-r--r--gpxe/src/drivers/net/3c509-eisa.c49
-rw-r--r--gpxe/src/drivers/net/3c509.c432
-rw-r--r--gpxe/src/drivers/net/3c509.h394
-rw-r--r--gpxe/src/drivers/net/3c515.c763
-rw-r--r--gpxe/src/drivers/net/3c515.txt31
-rw-r--r--gpxe/src/drivers/net/3c529.c62
-rw-r--r--gpxe/src/drivers/net/3c595.c553
-rw-r--r--gpxe/src/drivers/net/3c595.h437
-rw-r--r--gpxe/src/drivers/net/3c5x9.c416
-rw-r--r--gpxe/src/drivers/net/3c90x.c994
-rw-r--r--gpxe/src/drivers/net/3c90x.h302
-rw-r--r--gpxe/src/drivers/net/amd8111e.c693
-rw-r--r--gpxe/src/drivers/net/amd8111e.h631
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k.c1700
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k.h1279
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_attach.c340
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_caps.c154
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_desc.c544
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_dma.c631
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_eeprom.c1760
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_gpio.c122
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_initvals.c1560
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_pcu.c534
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_phy.c2586
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_qcu.c394
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_reset.c1176
-rw-r--r--gpxe/src/drivers/net/ath5k/ath5k_rfkill.c107
-rw-r--r--gpxe/src/drivers/net/ath5k/base.h145
-rw-r--r--gpxe/src/drivers/net/ath5k/desc.h332
-rw-r--r--gpxe/src/drivers/net/ath5k/eeprom.h451
-rw-r--r--gpxe/src/drivers/net/ath5k/reg.h2589
-rw-r--r--gpxe/src/drivers/net/ath5k/rfbuffer.h1181
-rw-r--r--gpxe/src/drivers/net/ath5k/rfgain.h516
-rw-r--r--gpxe/src/drivers/net/atl1e.c1758
-rw-r--r--gpxe/src/drivers/net/atl1e.h1031
-rw-r--r--gpxe/src/drivers/net/b44.c951
-rw-r--r--gpxe/src/drivers/net/b44.h470
-rw-r--r--gpxe/src/drivers/net/bnx2.c2697
-rw-r--r--gpxe/src/drivers/net/bnx2.h4598
-rw-r--r--gpxe/src/drivers/net/bnx2_fw.h3494
-rw-r--r--gpxe/src/drivers/net/cs89x0.c739
-rw-r--r--gpxe/src/drivers/net/cs89x0.h481
-rw-r--r--gpxe/src/drivers/net/cs89x0.txt45
-rw-r--r--gpxe/src/drivers/net/davicom.c727
-rw-r--r--gpxe/src/drivers/net/depca.c805
-rw-r--r--gpxe/src/drivers/net/dmfe.c1226
-rw-r--r--gpxe/src/drivers/net/e1000/e1000.c1189
-rw-r--r--gpxe/src/drivers/net/e1000/e1000.h306
-rw-r--r--gpxe/src/drivers/net/e1000/e1000_hw.c9174
-rw-r--r--gpxe/src/drivers/net/e1000/e1000_hw.h3431
-rw-r--r--gpxe/src/drivers/net/e1000/e1000_osdep.h143
-rw-r--r--gpxe/src/drivers/net/eepro.c637
-rw-r--r--gpxe/src/drivers/net/eepro100.c1207
-rw-r--r--gpxe/src/drivers/net/eepro100.h206
-rw-r--r--gpxe/src/drivers/net/epic100.c539
-rw-r--r--gpxe/src/drivers/net/epic100.h190
-rw-r--r--gpxe/src/drivers/net/etherfabric.c4236
-rw-r--r--gpxe/src/drivers/net/etherfabric.h553
-rw-r--r--gpxe/src/drivers/net/etherfabric_nic.h204
-rw-r--r--gpxe/src/drivers/net/forcedeth.c1444
-rw-r--r--gpxe/src/drivers/net/hfa384x.h3069
-rw-r--r--gpxe/src/drivers/net/ipoib.c782
-rw-r--r--gpxe/src/drivers/net/legacy.c157
-rw-r--r--gpxe/src/drivers/net/mtd80x.c1022
-rw-r--r--gpxe/src/drivers/net/mtnic.c1853
-rw-r--r--gpxe/src/drivers/net/mtnic.h722
-rw-r--r--gpxe/src/drivers/net/myri10ge.c1041
-rw-r--r--gpxe/src/drivers/net/myri10ge_mcp.h514
-rw-r--r--gpxe/src/drivers/net/natsemi.c609
-rw-r--r--gpxe/src/drivers/net/natsemi.h232
-rw-r--r--gpxe/src/drivers/net/ne.c6
-rw-r--r--gpxe/src/drivers/net/ne2k_isa.c375
-rw-r--r--gpxe/src/drivers/net/ns83820.c1014
-rw-r--r--gpxe/src/drivers/net/ns8390.c1037
-rw-r--r--gpxe/src/drivers/net/ns8390.h240
-rw-r--r--gpxe/src/drivers/net/p80211hdr.h301
-rw-r--r--gpxe/src/drivers/net/pcnet32.c1021
-rw-r--r--gpxe/src/drivers/net/phantom/nx_bitops.h194
-rw-r--r--gpxe/src/drivers/net/phantom/nxhal_nic_interface.h501
-rw-r--r--gpxe/src/drivers/net/phantom/phantom.c2112
-rw-r--r--gpxe/src/drivers/net/phantom/phantom.h194
-rw-r--r--gpxe/src/drivers/net/phantom/phantom_hw.h184
-rw-r--r--gpxe/src/drivers/net/pnic.c281
-rw-r--r--gpxe/src/drivers/net/pnic_api.h61
-rw-r--r--gpxe/src/drivers/net/prism2.c857
-rw-r--r--gpxe/src/drivers/net/prism2_pci.c58
-rw-r--r--gpxe/src/drivers/net/prism2_plx.c122
-rw-r--r--gpxe/src/drivers/net/r8169.c2285
-rw-r--r--gpxe/src/drivers/net/r8169.h487
-rw-r--r--gpxe/src/drivers/net/rtl8139.c594
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8180.c17
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8180_grf5101.c186
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8180_max2820.c158
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8180_sa2400.c217
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8185.c14
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl8185_rtl8225.c804
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl818x.c855
-rw-r--r--gpxe/src/drivers/net/rtl818x/rtl818x.h359
-rw-r--r--gpxe/src/drivers/net/sis190.c1179
-rw-r--r--gpxe/src/drivers/net/sis190.h311
-rw-r--r--gpxe/src/drivers/net/sis900.c1304
-rw-r--r--gpxe/src/drivers/net/sis900.h375
-rwxr-xr-xgpxe/src/drivers/net/skge.c2472
-rwxr-xr-xgpxe/src/drivers/net/skge.h2623
-rw-r--r--gpxe/src/drivers/net/sky2.c2399
-rw-r--r--gpxe/src/drivers/net/sky2.h2176
-rw-r--r--gpxe/src/drivers/net/smc9000.c955
-rw-r--r--gpxe/src/drivers/net/smc9000.h428
-rw-r--r--gpxe/src/drivers/net/sundance.c897
-rw-r--r--gpxe/src/drivers/net/tg3.c3435
-rw-r--r--gpxe/src/drivers/net/tg3.h2121
-rw-r--r--gpxe/src/drivers/net/tlan.c1723
-rw-r--r--gpxe/src/drivers/net/tlan.h491
-rw-r--r--gpxe/src/drivers/net/tulip.c2099
-rw-r--r--gpxe/src/drivers/net/tulip.txt54
-rw-r--r--gpxe/src/drivers/net/via-rhine.c1447
-rw-r--r--gpxe/src/drivers/net/via-velocity.c1939
-rw-r--r--gpxe/src/drivers/net/via-velocity.h1930
-rw-r--r--gpxe/src/drivers/net/virtio-net.c307
-rw-r--r--gpxe/src/drivers/net/virtio-net.h44
-rw-r--r--gpxe/src/drivers/net/w89c840.c964
-rw-r--r--gpxe/src/drivers/net/wd.c6
-rw-r--r--gpxe/src/drivers/net/wlan_compat.h577
-rw-r--r--gpxe/src/drivers/nvs/nvs.c149
-rw-r--r--gpxe/src/drivers/nvs/spi.c140
-rw-r--r--gpxe/src/drivers/nvs/threewire.c131
-rw-r--r--gpxe/src/hci/commands/autoboot_cmd.c27
-rw-r--r--gpxe/src/hci/commands/config_cmd.c39
-rw-r--r--gpxe/src/hci/commands/dhcp_cmd.c190
-rw-r--r--gpxe/src/hci/commands/digest_cmd.c120
-rw-r--r--gpxe/src/hci/commands/gdbstub_cmd.c105
-rw-r--r--gpxe/src/hci/commands/ifmgmt_cmd.c180
-rw-r--r--gpxe/src/hci/commands/image_cmd.c608
-rw-r--r--gpxe/src/hci/commands/iwmgmt_cmd.c69
-rw-r--r--gpxe/src/hci/commands/login_cmd.c29
-rw-r--r--gpxe/src/hci/commands/nvo_cmd.c79
-rw-r--r--gpxe/src/hci/commands/route_cmd.c87
-rw-r--r--gpxe/src/hci/commands/sanboot_cmd.c70
-rw-r--r--gpxe/src/hci/commands/time_cmd.c84
-rw-r--r--gpxe/src/hci/editstring.c192
-rw-r--r--gpxe/src/hci/mucurses/alert.c18
-rw-r--r--gpxe/src/hci/mucurses/ansi_screen.c74
-rw-r--r--gpxe/src/hci/mucurses/clear.c90
-rw-r--r--gpxe/src/hci/mucurses/colour.c66
-rw-r--r--gpxe/src/hci/mucurses/cursor.h37
-rw-r--r--gpxe/src/hci/mucurses/edging.c111
-rw-r--r--gpxe/src/hci/mucurses/kb.c143
-rw-r--r--gpxe/src/hci/mucurses/mucurses.c147
-rw-r--r--gpxe/src/hci/mucurses/mucurses.h23
-rw-r--r--gpxe/src/hci/mucurses/print.c86
-rw-r--r--gpxe/src/hci/mucurses/print_nadv.c26
-rw-r--r--gpxe/src/hci/mucurses/slk.c363
-rw-r--r--gpxe/src/hci/mucurses/widgets/editbox.c103
-rw-r--r--gpxe/src/hci/mucurses/winattrs.c133
-rw-r--r--gpxe/src/hci/mucurses/windows.c158
-rw-r--r--gpxe/src/hci/mucurses/wininit.c37
-rw-r--r--gpxe/src/hci/readline.c119
-rw-r--r--gpxe/src/hci/shell.c102
-rw-r--r--gpxe/src/hci/shell_banner.c64
-rw-r--r--gpxe/src/hci/strerror.c122
-rw-r--r--gpxe/src/hci/tui/login_ui.c137
-rw-r--r--gpxe/src/hci/tui/settings_ui.c427
-rw-r--r--gpxe/src/hci/wireless_errors.c118
-rw-r--r--gpxe/src/image/efi_image.c108
-rw-r--r--gpxe/src/image/elf.c162
-rw-r--r--gpxe/src/image/embedded.c101
-rw-r--r--gpxe/src/image/script.c126
-rw-r--r--gpxe/src/image/segment.c87
-rw-r--r--gpxe/src/include/.gitignore1
-rw-r--r--gpxe/src/include/alloca.h25
-rw-r--r--gpxe/src/include/assert.h67
-rw-r--r--gpxe/src/include/big_bswap.h33
-rw-r--r--gpxe/src/include/bootp.h230
-rw-r--r--gpxe/src/include/btext.h62
-rw-r--r--gpxe/src/include/byteswap.h59
-rw-r--r--gpxe/src/include/cmdline.h8
-rw-r--r--gpxe/src/include/cmdlinelib.h99
-rw-r--r--gpxe/src/include/cmdlist.h18
-rw-r--r--gpxe/src/include/coff.h73
-rw-r--r--gpxe/src/include/compiler.h650
-rw-r--r--gpxe/src/include/console.h119
-rw-r--r--gpxe/src/include/cpu.h6
-rw-r--r--gpxe/src/include/ctype.h31
-rw-r--r--gpxe/src/include/curses.h755
-rw-r--r--gpxe/src/include/elf.h234
-rw-r--r--gpxe/src/include/endian.h21
-rw-r--r--gpxe/src/include/errno.h510
-rw-r--r--gpxe/src/include/etherboot.h44
-rw-r--r--gpxe/src/include/fs.h41
-rw-r--r--gpxe/src/include/getopt.h94
-rw-r--r--gpxe/src/include/gpxe/acpi.h43
-rw-r--r--gpxe/src/include/gpxe/aes.h30
-rw-r--r--gpxe/src/include/gpxe/ansiesc.h120
-rw-r--r--gpxe/src/include/gpxe/aoe.h150
-rw-r--r--gpxe/src/include/gpxe/api.h84
-rw-r--r--gpxe/src/include/gpxe/arc4.h22
-rw-r--r--gpxe/src/include/gpxe/arp.h46
-rw-r--r--gpxe/src/include/gpxe/asn1.h34
-rw-r--r--gpxe/src/include/gpxe/ata.h209
-rw-r--r--gpxe/src/include/gpxe/base64.h26
-rw-r--r--gpxe/src/include/gpxe/bitbash.h52
-rw-r--r--gpxe/src/include/gpxe/bitmap.h85
-rw-r--r--gpxe/src/include/gpxe/bitops.h230
-rw-r--r--gpxe/src/include/gpxe/blockdev.h53
-rw-r--r--gpxe/src/include/gpxe/cbc.h100
-rw-r--r--gpxe/src/include/gpxe/chap.h53
-rw-r--r--gpxe/src/include/gpxe/command.h26
-rw-r--r--gpxe/src/include/gpxe/cpio.h53
-rw-r--r--gpxe/src/include/gpxe/crc32.h10
-rw-r--r--gpxe/src/include/gpxe/crypto.h156
-rw-r--r--gpxe/src/include/gpxe/device.h113
-rw-r--r--gpxe/src/include/gpxe/dhcp.h637
-rw-r--r--gpxe/src/include/gpxe/dhcpopts.h34
-rw-r--r--gpxe/src/include/gpxe/dhcppkt.h64
-rw-r--r--gpxe/src/include/gpxe/dns.h92
-rw-r--r--gpxe/src/include/gpxe/downloader.h19
-rw-r--r--gpxe/src/include/gpxe/eapol.h112
-rw-r--r--gpxe/src/include/gpxe/editbox.h61
-rw-r--r--gpxe/src/include/gpxe/editstring.h33
-rw-r--r--gpxe/src/include/gpxe/efi/Base.h329
-rw-r--r--gpxe/src/include/gpxe/efi/Guid/PcAnsi.h58
-rw-r--r--gpxe/src/include/gpxe/efi/Guid/SmBios.h34
-rw-r--r--gpxe/src/include/gpxe/efi/Ia32/ProcessorBind.h215
-rw-r--r--gpxe/src/include/gpxe/efi/IndustryStandard/Pci22.h601
-rw-r--r--gpxe/src/include/gpxe/efi/IndustryStandard/PeImage.h752
-rw-r--r--gpxe/src/include/gpxe/efi/LICENCE40
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiBootMode.h43
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiDependency.h47
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiDxeCis.h642
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiFirmwareFile.h242
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiFirmwareVolume.h154
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiHob.h295
-rw-r--r--gpxe/src/include/gpxe/efi/Pi/PiMultiPhase.h104
-rw-r--r--gpxe/src/include/gpxe/efi/PiDxe.h25
-rw-r--r--gpxe/src/include/gpxe/efi/ProcessorBind.h14
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/ComponentName2.h174
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/Cpu.h291
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/CpuIo.h128
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/DebugSupport.h634
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/DevicePath.h535
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/DriverBinding.h153
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/NetworkInterfaceIdentifier.h74
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/PciIo.h519
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/PciRootBridgeIo.h393
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/SimpleNetwork.h593
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/SimpleTextIn.h136
-rw-r--r--gpxe/src/include/gpxe/efi/Protocol/SimpleTextOut.h404
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi.h27
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiBaseType.h200
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiGpt.h62
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiInternalFormRepresentation.h1590
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiMultiPhase.h210
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiPxe.h1756
-rw-r--r--gpxe/src/include/gpxe/efi/Uefi/UefiSpec.h1916
-rw-r--r--gpxe/src/include/gpxe/efi/X64/ProcessorBind.h247
-rw-r--r--gpxe/src/include/gpxe/efi/efi.h142
-rw-r--r--gpxe/src/include/gpxe/efi/efi_io.h180
-rw-r--r--gpxe/src/include/gpxe/efi/efi_pci.h148
-rw-r--r--gpxe/src/include/gpxe/efi/efi_smbios.h18
-rw-r--r--gpxe/src/include/gpxe/efi/efi_timer.h18
-rw-r--r--gpxe/src/include/gpxe/efi/efi_uaccess.h90
-rw-r--r--gpxe/src/include/gpxe/efi/efi_umalloc.h18
-rwxr-xr-xgpxe/src/include/gpxe/efi/import.pl75
-rw-r--r--gpxe/src/include/gpxe/eisa.h130
-rw-r--r--gpxe/src/include/gpxe/elf.h17
-rw-r--r--gpxe/src/include/gpxe/errfile.h207
-rw-r--r--gpxe/src/include/gpxe/errortab.h23
-rw-r--r--gpxe/src/include/gpxe/ethernet.h21
-rw-r--r--gpxe/src/include/gpxe/fakedhcp.h23
-rw-r--r--gpxe/src/include/gpxe/features.h103
-rw-r--r--gpxe/src/include/gpxe/filter.h75
-rw-r--r--gpxe/src/include/gpxe/ftp.h15
-rw-r--r--gpxe/src/include/gpxe/gdbserial.h21
-rw-r--r--gpxe/src/include/gpxe/gdbstub.h77
-rw-r--r--gpxe/src/include/gpxe/gdbudp.h24
-rw-r--r--gpxe/src/include/gpxe/hidemem.h17
-rw-r--r--gpxe/src/include/gpxe/hmac.h32
-rw-r--r--gpxe/src/include/gpxe/http.h23
-rw-r--r--gpxe/src/include/gpxe/i2c.h171
-rw-r--r--gpxe/src/include/gpxe/ib_cm.h72
-rw-r--r--gpxe/src/include/gpxe/ib_cmrc.h20
-rw-r--r--gpxe/src/include/gpxe/ib_mad.h561
-rw-r--r--gpxe/src/include/gpxe/ib_mcast.h48
-rw-r--r--gpxe/src/include/gpxe/ib_mi.h135
-rw-r--r--gpxe/src/include/gpxe/ib_packet.h147
-rw-r--r--gpxe/src/include/gpxe/ib_pathrec.h76
-rw-r--r--gpxe/src/include/gpxe/ib_sma.h20
-rw-r--r--gpxe/src/include/gpxe/ib_smc.h20
-rw-r--r--gpxe/src/include/gpxe/ib_srp.h79
-rw-r--r--gpxe/src/include/gpxe/icmp.h25
-rw-r--r--gpxe/src/include/gpxe/icmp6.h59
-rw-r--r--gpxe/src/include/gpxe/ieee80211.h1160
-rw-r--r--gpxe/src/include/gpxe/if_arp.h102
-rw-r--r--gpxe/src/include/gpxe/if_ether.h36
-rw-r--r--gpxe/src/include/gpxe/image.h194
-rw-r--r--gpxe/src/include/gpxe/in.h104
-rw-r--r--gpxe/src/include/gpxe/infiniband.h659
-rw-r--r--gpxe/src/include/gpxe/init.h81
-rw-r--r--gpxe/src/include/gpxe/interface.h58
-rw-r--r--gpxe/src/include/gpxe/io.h506
-rw-r--r--gpxe/src/include/gpxe/iobuf.h229
-rw-r--r--gpxe/src/include/gpxe/ip.h97
-rw-r--r--gpxe/src/include/gpxe/ip6.h80
-rw-r--r--gpxe/src/include/gpxe/ipoib.h61
-rw-r--r--gpxe/src/include/gpxe/isa.h97
-rw-r--r--gpxe/src/include/gpxe/isa_ids.h51
-rw-r--r--gpxe/src/include/gpxe/isapnp.h278
-rw-r--r--gpxe/src/include/gpxe/iscsi.h678
-rw-r--r--gpxe/src/include/gpxe/job.h169
-rw-r--r--gpxe/src/include/gpxe/keys.h81
-rw-r--r--gpxe/src/include/gpxe/linebuf.h30
-rw-r--r--gpxe/src/include/gpxe/linux_compat.h27
-rw-r--r--gpxe/src/include/gpxe/list.h180
-rw-r--r--gpxe/src/include/gpxe/login_ui.h14
-rw-r--r--gpxe/src/include/gpxe/malloc.h59
-rw-r--r--gpxe/src/include/gpxe/mca.h108
-rw-r--r--gpxe/src/include/gpxe/md5.h24
-rw-r--r--gpxe/src/include/gpxe/memmap.h36
-rw-r--r--gpxe/src/include/gpxe/monojob.h17
-rw-r--r--gpxe/src/include/gpxe/nap.h56
-rw-r--r--gpxe/src/include/gpxe/ndp.h21
-rw-r--r--gpxe/src/include/gpxe/net80211.h1186
-rw-r--r--gpxe/src/include/gpxe/netdevice.h532
-rw-r--r--gpxe/src/include/gpxe/null_nap.h23
-rw-r--r--gpxe/src/include/gpxe/nvo.h55
-rw-r--r--gpxe/src/include/gpxe/nvs.h68
-rw-r--r--gpxe/src/include/gpxe/open.h105
-rw-r--r--gpxe/src/include/gpxe/pci.h402
-rw-r--r--gpxe/src/include/gpxe/pci_ids.h351
-rw-r--r--gpxe/src/include/gpxe/pci_io.h124
-rw-r--r--gpxe/src/include/gpxe/pcibackup.h33
-rw-r--r--gpxe/src/include/gpxe/posix_io.h87
-rw-r--r--gpxe/src/include/gpxe/process.h80
-rw-r--r--gpxe/src/include/gpxe/profile.h80
-rw-r--r--gpxe/src/include/gpxe/ramdisk.h24
-rw-r--r--gpxe/src/include/gpxe/rarp.h16
-rw-r--r--gpxe/src/include/gpxe/rc80211.h19
-rw-r--r--gpxe/src/include/gpxe/refcnt.h46
-rw-r--r--gpxe/src/include/gpxe/resolv.h170
-rw-r--r--gpxe/src/include/gpxe/retry.h81
-rw-r--r--gpxe/src/include/gpxe/rotate.h29
-rw-r--r--gpxe/src/include/gpxe/rsa.h12
-rw-r--r--gpxe/src/include/gpxe/sanboot.h20
-rw-r--r--gpxe/src/include/gpxe/scsi.h281
-rw-r--r--gpxe/src/include/gpxe/sec80211.h83
-rw-r--r--gpxe/src/include/gpxe/segment.h17
-rw-r--r--gpxe/src/include/gpxe/serial.h16
-rw-r--r--gpxe/src/include/gpxe/settings.h335
-rw-r--r--gpxe/src/include/gpxe/settings_ui.h16
-rw-r--r--gpxe/src/include/gpxe/sha1.h24
-rw-r--r--gpxe/src/include/gpxe/shell.h14
-rw-r--r--gpxe/src/include/gpxe/shell_banner.h14
-rw-r--r--gpxe/src/include/gpxe/smbios.h161
-rw-r--r--gpxe/src/include/gpxe/socket.h101
-rw-r--r--gpxe/src/include/gpxe/spi.h258
-rw-r--r--gpxe/src/include/gpxe/spi_bit.h63
-rw-r--r--gpxe/src/include/gpxe/srp.h868
-rw-r--r--gpxe/src/include/gpxe/tables.h434
-rw-r--r--gpxe/src/include/gpxe/tcp.h318
-rw-r--r--gpxe/src/include/gpxe/tcpip.h128
-rw-r--r--gpxe/src/include/gpxe/tftp.h85
-rw-r--r--gpxe/src/include/gpxe/threewire.h105
-rw-r--r--gpxe/src/include/gpxe/timer.h76
-rw-r--r--gpxe/src/include/gpxe/tls.h187
-rw-r--r--gpxe/src/include/gpxe/uaccess.h344
-rw-r--r--gpxe/src/include/gpxe/udp.h48
-rw-r--r--gpxe/src/include/gpxe/umalloc.h68
-rw-r--r--gpxe/src/include/gpxe/uri.h182
-rw-r--r--gpxe/src/include/gpxe/uuid.h33
-rw-r--r--gpxe/src/include/gpxe/virtio-pci.h97
-rw-r--r--gpxe/src/include/gpxe/virtio-ring.h142
-rw-r--r--gpxe/src/include/gpxe/vsprintf.h74
-rw-r--r--gpxe/src/include/gpxe/wpa.h503
-rw-r--r--gpxe/src/include/gpxe/x509.h41
-rw-r--r--gpxe/src/include/gpxe/xfer.h277
-rw-r--r--gpxe/src/include/hci/ifmgmt_cmd.h30
-rw-r--r--gpxe/src/include/i82365.h450
-rw-r--r--gpxe/src/include/libgen.h9
-rw-r--r--gpxe/src/include/little_bswap.h35
-rw-r--r--gpxe/src/include/mii.h219
-rw-r--r--gpxe/src/include/nic.h273
-rw-r--r--gpxe/src/include/old_tcp.h37
-rw-r--r--gpxe/src/include/pc_kbd.h7
-rw-r--r--gpxe/src/include/pcmcia-opts.h23
-rw-r--r--gpxe/src/include/pcmcia.h156
-rw-r--r--gpxe/src/include/readline/readline.h14
-rw-r--r--gpxe/src/include/stdarg.h12
-rw-r--r--gpxe/src/include/stddef.h26
-rw-r--r--gpxe/src/include/stdint.h36
-rw-r--r--gpxe/src/include/stdio.h47
-rw-r--r--gpxe/src/include/stdlib.h75
-rw-r--r--gpxe/src/include/string.h51
-rw-r--r--gpxe/src/include/strings.h65
-rw-r--r--gpxe/src/include/sys/time.h20
-rw-r--r--gpxe/src/include/sys_info.h33
-rw-r--r--gpxe/src/include/time.h22
-rw-r--r--gpxe/src/include/unistd.h43
-rw-r--r--gpxe/src/include/usr/autoboot.h25
-rw-r--r--gpxe/src/include/usr/dhcpmgmt.h17
-rw-r--r--gpxe/src/include/usr/ifmgmt.h19
-rw-r--r--gpxe/src/include/usr/imgmgmt.h22
-rw-r--r--gpxe/src/include/usr/iwmgmt.h17
-rw-r--r--gpxe/src/include/usr/route.h14
-rw-r--r--gpxe/src/interface/efi/efi_console.c276
-rw-r--r--gpxe/src/interface/efi/efi_init.c112
-rw-r--r--gpxe/src/interface/efi/efi_io.c205
-rw-r--r--gpxe/src/interface/efi/efi_pci.c83
-rw-r--r--gpxe/src/interface/efi/efi_smbios.c64
-rw-r--r--gpxe/src/interface/efi/efi_snp.c1148
-rw-r--r--gpxe/src/interface/efi/efi_strerror.c45
-rw-r--r--gpxe/src/interface/efi/efi_timer.c118
-rw-r--r--gpxe/src/interface/efi/efi_uaccess.c39
-rw-r--r--gpxe/src/interface/efi/efi_umalloc.c98
-rw-r--r--gpxe/src/interface/smbios/smbios.c180
-rw-r--r--gpxe/src/interface/smbios/smbios_settings.c194
-rw-r--r--gpxe/src/libgcc/__divdi3.c26
-rw-r--r--gpxe/src/libgcc/__moddi3.c26
-rw-r--r--gpxe/src/libgcc/__udivdi3.c10
-rw-r--r--gpxe/src/libgcc/__udivmoddi4.c32
-rw-r--r--gpxe/src/libgcc/__umoddi3.c13
-rw-r--r--gpxe/src/libgcc/icc.c8
-rw-r--r--gpxe/src/libgcc/libgcc.h14
-rw-r--r--gpxe/src/libgcc/memcpy.c18
-rw-r--r--gpxe/src/net/80211/net80211.c2829
-rw-r--r--gpxe/src/net/80211/rc80211.c371
-rw-r--r--gpxe/src/net/80211/sec80211.c503
-rw-r--r--gpxe/src/net/80211/wep.c303
-rw-r--r--gpxe/src/net/80211/wpa.c973
-rw-r--r--gpxe/src/net/80211/wpa_ccmp.c528
-rw-r--r--gpxe/src/net/80211/wpa_psk.c125
-rw-r--r--gpxe/src/net/80211/wpa_tkip.c586
-rw-r--r--gpxe/src/net/aoe.c471
-rw-r--r--gpxe/src/net/arp.c289
-rw-r--r--gpxe/src/net/cachedhcp.c76
-rw-r--r--gpxe/src/net/dhcpopts.c447
-rw-r--r--gpxe/src/net/dhcppkt.c283
-rw-r--r--gpxe/src/net/eapol.c85
-rw-r--r--gpxe/src/net/ethernet.c193
-rw-r--r--gpxe/src/net/fakedhcp.c217
-rw-r--r--gpxe/src/net/icmp.c103
-rw-r--r--gpxe/src/net/icmpv6.c128
-rw-r--r--gpxe/src/net/infiniband.c951
-rw-r--r--gpxe/src/net/infiniband/ib_cm.c413
-rw-r--r--gpxe/src/net/infiniband/ib_cmrc.c436
-rw-r--r--gpxe/src/net/infiniband/ib_mcast.c218
-rw-r--r--gpxe/src/net/infiniband/ib_mi.c406
-rw-r--r--gpxe/src/net/infiniband/ib_packet.c244
-rw-r--r--gpxe/src/net/infiniband/ib_pathrec.c296
-rw-r--r--gpxe/src/net/infiniband/ib_sma.c369
-rw-r--r--gpxe/src/net/infiniband/ib_smc.c179
-rw-r--r--gpxe/src/net/infiniband/ib_srp.c406
-rw-r--r--gpxe/src/net/iobpad.c68
-rw-r--r--gpxe/src/net/ipv4.c635
-rw-r--r--gpxe/src/net/ipv6.c381
-rw-r--r--gpxe/src/net/mii.c147
-rw-r--r--gpxe/src/net/ndp.c180
-rw-r--r--gpxe/src/net/netdev_settings.c120
-rw-r--r--gpxe/src/net/netdevice.c633
-rw-r--r--gpxe/src/net/nullnet.c60
-rw-r--r--gpxe/src/net/rarp.c70
-rw-r--r--gpxe/src/net/retry.c192
-rw-r--r--gpxe/src/net/tcp.c1156
-rw-r--r--gpxe/src/net/tcp/ftp.c529
-rw-r--r--gpxe/src/net/tcp/http.c597
-rw-r--r--gpxe/src/net/tcp/https.c51
-rw-r--r--gpxe/src/net/tcp/iscsi.c1934
-rw-r--r--gpxe/src/net/tcpip.c135
-rw-r--r--gpxe/src/net/tls.c1759
-rw-r--r--gpxe/src/net/udp.c463
-rw-r--r--gpxe/src/net/udp/dhcp.c1587
-rw-r--r--gpxe/src/net/udp/dns.c603
-rw-r--r--gpxe/src/net/udp/slam.c812
-rw-r--r--gpxe/src/net/udp/tftp.c1288
-rw-r--r--gpxe/src/tests/comboot/shuffle-simple.asm40
-rw-r--r--gpxe/src/tests/comboot/version.asm136
-rw-r--r--gpxe/src/tests/gdbstub_test.S54
-rwxr-xr-xgpxe/src/tests/gdbstub_test.gdb116
-rw-r--r--gpxe/src/tests/linebuf_test.c35
-rw-r--r--gpxe/src/tests/memcpy_test.c39
-rw-r--r--gpxe/src/tests/umalloc_test.c26
-rw-r--r--gpxe/src/tests/uri_test.c148
-rw-r--r--gpxe/src/usr/autoboot.c233
-rw-r--r--gpxe/src/usr/dhcpmgmt.c78
-rw-r--r--gpxe/src/usr/ifmgmt.c147
-rw-r--r--gpxe/src/usr/imgmgmt.c144
-rw-r--r--gpxe/src/usr/iwmgmt.c244
-rw-r--r--gpxe/src/usr/pxemenu.c383
-rw-r--r--gpxe/src/usr/route.c45
-rw-r--r--gpxe/src/util/.gitignore8
-rw-r--r--gpxe/src/util/Makefile22
-rw-r--r--gpxe/src/util/Option/ROM.pm501
-rwxr-xr-xgpxe/src/util/catrom.pl48
-rwxr-xr-xgpxe/src/util/diffsize.pl101
-rwxr-xr-xgpxe/src/util/disrom.pl81
-rw-r--r--gpxe/src/util/efirom.c280
-rw-r--r--gpxe/src/util/elf2efi.c808
-rwxr-xr-xgpxe/src/util/geniso55
-rwxr-xr-xgpxe/src/util/genliso74
-rwxr-xr-xgpxe/src/util/gensdsk65
-rwxr-xr-xgpxe/src/util/get-pci-ids135
-rw-r--r--gpxe/src/util/hijack.c628
-rw-r--r--gpxe/src/util/iccfix.c156
-rwxr-xr-xgpxe/src/util/licence.pl149
-rwxr-xr-xgpxe/src/util/makerom.pl232
-rwxr-xr-xgpxe/src/util/mergerom.pl98
-rwxr-xr-xgpxe/src/util/modrom.pl226
-rw-r--r--gpxe/src/util/mucurses_test.c63
-rw-r--r--gpxe/src/util/nrv2b.c1501
-rwxr-xr-xgpxe/src/util/padimg.pl44
-rw-r--r--gpxe/src/util/parserom.pl65
-rwxr-xr-xgpxe/src/util/sortobjdump.pl40
-rwxr-xr-xgpxe/src/util/swapdevids.pl49
-rwxr-xr-xgpxe/src/util/symcheck.pl191
-rw-r--r--gpxe/src/util/zbin.c383
842 files changed, 5 insertions, 279558 deletions
diff --git a/Makefile b/Makefile
index 79cfd63d..4710b60f 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,6 @@ ifeq ($(real-target),)
endif
ifeq ($(real-firmware),)
- do-spotless-gpxe = no-fw
real-firmware = $(firmware)
endif
@@ -164,7 +163,7 @@ BOBJECTS = $(BTARGET) \
mbr/*.bin \
core/pxelinux.0 core/lpxelinux.0 \
core/isolinux.bin core/isolinux-debug.bin \
- gpxe/gpxelinux.0 dos/syslinux.com \
+ dos/syslinux.com \
win32/syslinux.exe win64/syslinux64.exe \
dosutil/*.com dosutil/*.sys \
$(MODULES)
@@ -187,7 +186,7 @@ NETINSTALLABLE = efi/syslinux.efi $(INSTALLABLE_MODULES)
else
-BSUBDIRS = codepage com32 lzo core memdisk mbr gpxe sample \
+BSUBDIRS = codepage com32 lzo core memdisk mbr sample \
diag libinstaller dos win32 win64 dosutil txt
ITARGET =
@@ -201,7 +200,7 @@ INSTALL_BIN = mtools/syslinux
# Things to install in /sbin
INSTALL_SBIN = extlinux/extlinux
# Things to install in /usr/lib/syslinux
-INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 gpxe/gpxelinuxk.0 \
+INSTALL_AUX = core/pxelinux.0 \
core/isolinux.bin core/isolinux-debug.bin \
dos/syslinux.com core/lpxelinux.0 \
mbr/*.bin $(INSTALLABLE_MODULES)
@@ -216,7 +215,7 @@ INSTALLSUBDIRS = com32 utils dosutil
EXTBOOTINSTALL = $(INSTALLABLE_MODULES)
# Things to install in /tftpboot
-NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 core/lpxelinux.0 \
+NETINSTALLABLE = core/pxelinux.0 core/lpxelinux.0 \
$(INSTALLABLE_MODULES)
endif # ifdef EFI_BUILD
@@ -305,7 +304,6 @@ libinstaller: core
utils: mbr
core: com32
efi: core
-gpxe: core
installer: installer-local
set -e; for i in $(ISUBDIRS); \
@@ -348,8 +346,6 @@ install: local-install
set -e ; for i in $(INSTALLSUBDIRS) ; \
do $(MAKE) -C $$i SRC="$(SRC)/$$i" OBJ="$(OBJ)/$$i" \
-f $(SRC)/$$i/Makefile $@; done
-
-do-spotless-gpxe = bios
else
install:
mkdir -m 755 -p $(INSTALLROOT)$(AUXDIR)/efi$(BITS)
@@ -410,14 +406,7 @@ local-spotless:
-type f -print0 \
| xargs -0rt rm -f
-ifeq ($(do-spotless-gpxe),)
-spotless-gpxe:
-else
-spotless-gpxe:
- $(MAKE) -C "$(topdir)/gpxe" SRC="$(topdir)/gpxe" spotless
-endif
-
-spotless: local-spotless spotless-gpxe
+spotless: local-spotless
rm -rf $(all_firmware)
#
diff --git a/gpxe/.gitignore b/gpxe/.gitignore
deleted file mode 100644
index 0517ab74..00000000
--- a/gpxe/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/contrib
diff --git a/gpxe/COPYING b/gpxe/COPYING
deleted file mode 100644
index a43ea212..00000000
--- a/gpxe/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, 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
-
- Appendix: 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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the 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.
-
-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.
-
- <signature of Ty Coon>, 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/gpxe/COPYRIGHTS b/gpxe/COPYRIGHTS
deleted file mode 100644
index d686b435..00000000
--- a/gpxe/COPYRIGHTS
+++ /dev/null
@@ -1,26 +0,0 @@
-
-In general gPXE files are licensed under the GPL. GPLed files are in
-general either from Linux or have been explicitly put under GPL by the
-authors. The license for a file is usually documented at the top of
-the file.
-
-A few files are inherited from FreeBSD netboot and therefore can be
-used under BSD or GPL. Documented in this file are some of the
-non-GPL'ed files. If the internal documentation for a file disagrees
-with what is documented in this file, the internal documentation for
-the file shall be override this file.
-
-File Copyright status
-
-src/core/misc.c BSD
-src/drivers/net/3c509.c BSD
-src/drivers/net/3c509.h BSD
-src/drivers/net/3c595.c BSD
-src/drivers/net/3c595.h BSD
-src/drivers/net/3c90x.c Open Source
-src/drivers/net/epic100.c None
-src/drivers/net/epic100.h None
-src/drivers/net/ns8390.c BSD
-src/drivers/net/ns8390.h BSD
-src/arch/i386/include/bits/string.h None
-
diff --git a/gpxe/LOG b/gpxe/LOG
deleted file mode 100644
index d29c8eba..00000000
--- a/gpxe/LOG
+++ /dev/null
@@ -1,12 +0,0 @@
-gPXE LOG file
-
-+ Development for gPXE was moved from SourceForge CVS to a git
- repository on git.etherboot.org in the first half of the year 2007.
-
-+ The gitweb interface for gPXE is available at:
-
- http://git.etherboot.org/?p=gpxe.git
-
-+ The gitweb interface largely obsoletes the LOG file that used to be
- distributed with Etherboot.
-
diff --git a/gpxe/Makefile b/gpxe/Makefile
deleted file mode 100644
index 73ee261f..00000000
--- a/gpxe/Makefile
+++ /dev/null
@@ -1,54 +0,0 @@
-## -----------------------------------------------------------------------
-##
-## Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
-## Copyright 2009-2011 Intel Corporation; author: H. Peter Anvin
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-## Boston MA 02110-1301, USA; either version 2 of the License, or
-## (at your option) any later version; incorporated herein by reference.
-##
-## -----------------------------------------------------------------------
-
-#
-# Makefile for gpxe/gpxelinux.0
-#
-# Very simple, really...
-#
-
-VPATH = $(SRC)
-TARGETS = gpxelinux.0 gpxelinuxk.0
-
-PXEMAKE = $(MAKE) -C $(SRC)/src NO_WERROR=1
-
-all: $(TARGETS)
-
-tidy:
-
-clean: tidy
-
-dist:
- $(MAKE) -C $(SRC)/src veryclean > /dev/null 2>&1
-
-spotless: clean dist
- rm -f $(TARGETS)
-
-installer:
-
-.NOTPARALLEL:
-
-src/bin/blib.a:
- $(PXEMAKE) bin/blib.a
-
-src/bin/undionly.kkpxe: src/bin/blib.a pxelinux.gpxe $(objdir)/core/pxelinux.0
- $(PXEMAKE) bin/undionly.kkpxe EMBEDDED_IMAGE=$(SRC)/pxelinux.gpxe,$(objdir)/core/pxelinux.0
-
-gpxelinux.0: src/bin/undionly.kkpxe
- cp -f $(SRC)/$< $@
-
-src/bin/undionly.kpxe: src/bin/blib.a pxelinuxk.gpxe $(objdir)/core/pxelinux.0
- $(PXEMAKE) bin/undionly.kpxe EMBEDDED_IMAGE=$(SRC)/pxelinuxk.gpxe,$(objdir)/core/pxelinux.0
-
-gpxelinuxk.0: src/bin/undionly.kpxe
- cp -f $(SRC)/$< $@
diff --git a/gpxe/README b/gpxe/README
deleted file mode 100644
index b3ae2154..00000000
--- a/gpxe/README
+++ /dev/null
@@ -1,53 +0,0 @@
-gPXE README File
-
-gPXE is an implementation of the PXE specification for network
-booting, with extensions to allow additional features such as booting
-via HTTP, iSCSI, and AoE.
-
-In generally, gPXE is compatible with the industry-standard PXE
-specification, and also supports Etherboot .nbi file loading and some
-additional protocols and features.
-
-For more detailed information about gPXE, please visit our project
-website at: http://etherboot.org/
-
-BUILDING gPXE IMAGE FROM SOURCE
-
-If you don't want to install development tools, and have access to the
-Web, you can get gPXE and Etherboot ROM images made on demand from
-http://rom-o-matic.net/
-
-If you would like to compile gPXE images from source, here are some tips.
-
-We normally compile gPXE images on x86, 32-bit Linux machines. It is
-possible to also use x86-64 machines. We use gcc compiler options to
-create 32-bit output.
-
-It is important to have the necessary software packages installed. A gcc-based
-toolchain is required.
-
-The following packages (at least) are required:
-
- - a gcc tool chain (gcc 3.x or gcc 4.x)
- - binutils
- - perl
- - syslinux
- - mtools
-
-To test your environment, cd to the "src" directory and type:
-
- make
-
-You should see a lot of output, and when it stops, the "bin" directory
-should be populated with gPXE images and object files.
-
-To learn more about what to build and how to use gPXE, please visit our
-project website at http://etherboot.org/ , particularly the "howto" section.
-
-CONTACTING US
-
-Pointers to our project mailing lists are on http://etherboot.org/
-
-Real-time help is often available on IRC on the #etherboot channel of
-irc.freenode.net.
-
diff --git a/gpxe/VERSION b/gpxe/VERSION
deleted file mode 100644
index 69b51101..00000000
--- a/gpxe/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.9.6+ 2008-11-23
diff --git a/gpxe/gpxe.diff b/gpxe/gpxe.diff
deleted file mode 100644
index 57e5f416..00000000
--- a/gpxe/gpxe.diff
+++ /dev/null
@@ -1,73 +0,0 @@
-diff --git a/gpxe/src/config/general.h b/gpxe/src/config/general.h
-index 0a9e625..de51f9f 100644
---- a/gpxe/src/config/general.h
-+++ b/gpxe/src/config/general.h
-@@ -55,8 +55,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
-
- #define DOWNLOAD_PROTO_TFTP /* Trivial File Transfer Protocol */
- #define DOWNLOAD_PROTO_HTTP /* Hypertext Transfer Protocol */
--#undef DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */
--#undef DOWNLOAD_PROTO_FTP /* File Transfer Protocol */
-+#define DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */
-+#define DOWNLOAD_PROTO_FTP /* File Transfer Protocol */
- #undef DOWNLOAD_PROTO_TFTM /* Multicast Trivial File Transfer Protocol */
- #undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */
-
-diff --git a/gpxe/src/config/general.h b/gpxe/src/config/general.h
-index de51f9f..2f5a938 100644
---- a/gpxe/src/config/general.h
-+++ b/gpxe/src/config/general.h
-@@ -31,7 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
- * Timer configuration
- *
- */
--#define BANNER_TIMEOUT 20 /* Tenths of a second for which the shell
-+#define BANNER_TIMEOUT 0 /* Tenths of a second for which the shell
- banner should appear */
-
- /*
-diff --git a/gpxe/src/hci/shell_banner.c b/gpxe/src/hci/shell_banner.c
-index 8afefe3..b92e08e 100644
---- a/gpxe/src/hci/shell_banner.c
-+++ b/gpxe/src/hci/shell_banner.c
-@@ -41,6 +41,9 @@ int shell_banner ( void ) {
- int wait_count;
- int key;
-
-+ if ( BANNER_TIMEOUT <= 0 )
-+ return enter_shell;
-+
- printf ( "\nPress Ctrl-B for the gPXE command line..." );
-
- /* Wait for key */
-diff --git a/gpxe/src/include/gpxe/tcp.h b/gpxe/src/include/gpxe/tcp.h
-index 7ae7eab..9dc39fc 100644
---- a/gpxe/src/include/gpxe/tcp.h
-+++ b/gpxe/src/include/gpxe/tcp.h
-@@ -286,8 +286,8 @@ struct tcp_options {
- * actually use 65536, we use a window size of (65536-4) to ensure
- * that payloads remain dword-aligned.
- */
--//#define TCP_MAX_WINDOW_SIZE ( 65536 - 4 )
--#define TCP_MAX_WINDOW_SIZE 4096
-+#define TCP_MAX_WINDOW_SIZE ( 65536 - 4 )
-+//#define TCP_MAX_WINDOW_SIZE 4096
-
- /**
- * Path MTU
-diff --git a/gpxe/src/core/malloc.c b/gpxe/src/core/malloc.c
-index 8b0bc24..0153748 100644
---- a/gpxe/src/core/malloc.c
-+++ b/gpxe/src/core/malloc.c
-@@ -78,9 +78,9 @@ size_t freemem;
- /**
- * Heap size
- *
-- * Currently fixed at 128kB.
-+ * Currently fixed at 512kB.
- */
--#define HEAP_SIZE ( 128 * 1024 )
-+#define HEAP_SIZE ( 512 * 1024 )
-
- /** The heap itself */
- static char heap[HEAP_SIZE] __attribute__ (( aligned ( __alignof__(void *) )));
diff --git a/gpxe/pxelinux.gpxe b/gpxe/pxelinux.gpxe
deleted file mode 100644
index c267d136..00000000
--- a/gpxe/pxelinux.gpxe
+++ /dev/null
@@ -1,5 +0,0 @@
-#!gpxe
-set use-cached 1
-dhcp net0
-imgload pxelinux.0
-boot pxelinux.0
diff --git a/gpxe/pxelinuxk.gpxe b/gpxe/pxelinuxk.gpxe
deleted file mode 100644
index 2f1e59a0..00000000
--- a/gpxe/pxelinuxk.gpxe
+++ /dev/null
@@ -1,5 +0,0 @@
-#!gpxe
-set use-cached 0
-dhcp net0
-imgload pxelinux.0
-boot pxelinux.0
diff --git a/gpxe/src/.gitignore b/gpxe/src/.gitignore
deleted file mode 100644
index 413f8141..00000000
--- a/gpxe/src/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.toolcheck
-.echocheck
-TAGS*
-bin*
-config-local.h
diff --git a/gpxe/src/Makefile b/gpxe/src/Makefile
deleted file mode 100644
index cc91d78f..00000000
--- a/gpxe/src/Makefile
+++ /dev/null
@@ -1,150 +0,0 @@
-###############################################################################
-#
-# Initialise various variables
-#
-
-CLEANUP :=
-CFLAGS :=
-ASFLAGS :=
-LDFLAGS :=
-MAKEDEPS := Makefile
-
-###############################################################################
-#
-# Locations of tools
-#
-HOST_CC := gcc
-RM := rm -f
-TOUCH := touch
-MKDIR := mkdir
-CP := cp
-ECHO := echo
-PRINTF := printf
-PERL := /usr/bin/perl
-CC := $(CROSS_COMPILE)gcc
-CPP := $(CC) -E
-AS := $(CROSS_COMPILE)as
-LD := $(CROSS_COMPILE)ld
-SIZE := $(CROSS_COMPILE)size
-AR := $(CROSS_COMPILE)ar
-RANLIB := $(CROSS_COMPILE)ranlib
-OBJCOPY := $(CROSS_COMPILE)objcopy
-NM := $(CROSS_COMPILE)nm
-OBJDUMP := $(CROSS_COMPILE)objdump
-PARSEROM := $(PERL) ./util/parserom.pl
-MAKEROM := $(PERL) ./util/makerom.pl
-SYMCHECK := $(PERL) ./util/symcheck.pl
-SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl
-PADIMG := $(PERL) ./util/padimg.pl
-LICENCE := $(PERL) ./util/licence.pl
-NRV2B := ./util/nrv2b
-ZBIN := ./util/zbin
-ELF2EFI32 := ./util/elf2efi32
-ELF2EFI64 := ./util/elf2efi64
-EFIROM := ./util/efirom
-ICCFIX := ./util/iccfix
-DOXYGEN := doxygen
-BINUTILS_DIR := /usr
-BFD_DIR := $(BINUTILS_DIR)
-
-###############################################################################
-#
-# SRCDIRS lists all directories containing source files.
-#
-SRCDIRS :=
-SRCDIRS += libgcc
-SRCDIRS += core
-SRCDIRS += net net/tcp net/udp net/infiniband net/80211
-SRCDIRS += image
-SRCDIRS += drivers/bus
-SRCDIRS += drivers/net
-SRCDIRS += drivers/net/e1000
-SRCDIRS += drivers/net/phantom
-SRCDIRS += drivers/net/rtl818x
-SRCDIRS += drivers/net/ath5k
-SRCDIRS += drivers/block
-SRCDIRS += drivers/nvs
-SRCDIRS += drivers/bitbash
-SRCDIRS += drivers/infiniband
-SRCDIRS += interface/pxe interface/efi interface/smbios
-SRCDIRS += tests
-SRCDIRS += crypto crypto/axtls crypto/matrixssl
-SRCDIRS += hci hci/commands hci/tui
-SRCDIRS += hci/mucurses hci/mucurses/widgets
-SRCDIRS += usr
-SRCDIRS += config
-
-# NON_AUTO_SRCS lists files that are excluded from the normal
-# automatic build system.
-#
-NON_AUTO_SRCS :=
-NON_AUTO_SRCS += drivers/net/prism2.c
-
-# INCDIRS lists the include path
-#
-INCDIRS :=
-INCDIRS += include .
-
-###############################################################################
-#
-# Default build target: build the most common targets and print out a
-# helpfully suggestive message
-#
-all : bin/blib.a bin/gpxe.dsk bin/gpxe.iso bin/gpxe.usb bin/undionly.kpxe
- @$(ECHO) '==========================================================='
- @$(ECHO)
- @$(ECHO) 'To create a bootable floppy, type'
- @$(ECHO) ' cat bin/gpxe.dsk > /dev/fd0'
- @$(ECHO) 'where /dev/fd0 is your floppy drive. This will erase any'
- @$(ECHO) 'data already on the disk.'
- @$(ECHO)
- @$(ECHO) 'To create a bootable USB key, type'
- @$(ECHO) ' cat bin/gpxe.usb > /dev/sdX'
- @$(ECHO) 'where /dev/sdX is your USB key, and is *not* a real hard'
- @$(ECHO) 'disk on your system. This will erase any data already on'
- @$(ECHO) 'the USB key.'
- @$(ECHO)
- @$(ECHO) 'To create a bootable CD-ROM, burn the ISO image '
- @$(ECHO) 'bin/gpxe.iso to a blank CD-ROM.'
- @$(ECHO)
- @$(ECHO) 'These images contain drivers for all supported cards. You'
- @$(ECHO) 'can build more customised images, and ROM images, using'
- @$(ECHO) ' make bin/<rom-name>.<output-format>'
- @$(ECHO)
- @$(ECHO) '==========================================================='
-
-###############################################################################
-#
-# Build targets that do nothing but might be tried by users
-#
-configure :
- @$(ECHO) "No configuration needed."
-
-install :
- @$(ECHO) "No installation required."
-
-###############################################################################
-#
-# Version number calculations
-#
-VERSION_MAJOR = 1
-VERSION_MINOR = 0
-VERSION_PATCH = 0
-EXTRAVERSION =
-MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
-VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
-CFLAGS += -DVERSION_MAJOR=$(VERSION_MAJOR) \
- -DVERSION_MINOR=$(VERSION_MINOR) \
- -DVERSION_PATCH=$(VERSION_PATCH) \
- -DVERSION=\"$(VERSION)\"
-IDENT = '$(@F) $(VERSION) (GPL) etherboot.org'
-version :
- @$(ECHO) $(VERSION)
-
-###############################################################################
-#
-# Drag in the bulk of the build system
-#
-
-MAKEDEPS += Makefile.housekeeping
-include Makefile.housekeeping
diff --git a/gpxe/src/Makefile.housekeeping b/gpxe/src/Makefile.housekeeping
deleted file mode 100644
index 903ac53f..00000000
--- a/gpxe/src/Makefile.housekeeping
+++ /dev/null
@@ -1,1004 +0,0 @@
-# -*- makefile -*- : Force emacs to use Makefile mode
-#
-# This file contains various boring housekeeping functions that would
-# otherwise seriously clutter up the main Makefile.
-
-###############################################################################
-#
-# Find a usable "echo -e" substitute.
-#
-TAB := $(shell $(PRINTF) '\t')
-ECHO_E_ECHO := $(ECHO)
-ECHO_E_ECHO_E := $(ECHO) -e
-ECHO_E_BIN_ECHO := /bin/echo
-ECHO_E_BIN_ECHO_E := /bin/echo -e
-ECHO_E_ECHO_TAB := $(shell $(ECHO_E_ECHO) '\t' | cat)
-ECHO_E_ECHO_E_TAB := $(shell $(ECHO_E_ECHO_E) '\t' | cat)
-ECHO_E_BIN_ECHO_TAB := $(shell $(ECHO_E_BIN_ECHO) '\t')
-ECHO_E_BIN_ECHO_E_TAB := $(shell $(ECHO_E_BIN_ECHO_E) '\t')
-
-ifeq ($(ECHO_E_ECHO_TAB),$(TAB))
-ECHO_E := $(ECHO_E_ECHO)
-endif
-ifeq ($(ECHO_E_ECHO_E_TAB),$(TAB))
-ECHO_E := $(ECHO_E_ECHO_E)
-endif
-ifeq ($(ECHO_E_BIN_ECHO_TAB),$(TAB))
-ECHO_E := $(ECHO_E_BIN_ECHO)
-endif
-ifeq ($(ECHO_E_BIN_ECHO_E_TAB),$(TAB))
-ECHO_E := $(ECHO_E_BIN_ECHO_E)
-endif
-
-.echocheck :
-ifdef ECHO_E
- @$(TOUCH) $@
-else
- @$(PRINTF) '%24s : x%sx\n' 'tab' '$(TAB)'
- @$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO) \t"' \
- '$(ECHO_E_ECHO_TAB)'
- @$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_ECHO_E) \t"' \
- '$(ECHO_E_ECHO_E_TAB)'
- @$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO) \t"' \
- '$(ECHO_E_BIN_ECHO_TAB)'
- @$(PRINTF) '%24s : x%sx\n' '"$(ECHO_E_BIN_ECHO_E) \t"' \
- '$(ECHO_E_BIN_ECHO_E_TAB)'
- @$(ECHO) "No usable \"echo -e\" substitute found"
- @exit 1
-endif
-MAKEDEPS += .echocheck
-VERYCLEANUP += .echocheck
-
-echo :
- @$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
-
-###############################################################################
-#
-# Generate a usable "seq" substitute
-#
-define seq
- $(shell awk 'BEGIN { for ( i = $(1) ; i <= $(2) ; i++ ) print i }')
-endef
-
-###############################################################################
-#
-# Determine host OS
-#
-HOST_OS := $(shell uname -s)
-hostos :
- @$(ECHO) $(HOST_OS)
-
-###############################################################################
-#
-# Determine compiler
-
-CCDEFS := $(shell $(CC) -E -x c -c /dev/null -dM | cut -d" " -f2)
-ccdefs:
- @$(ECHO) $(CCDEFS)
-
-ifeq ($(filter __ICC,$(CCDEFS)),__ICC)
-CCTYPE := icc
-else
-CCTYPE := gcc
-endif
-cctype:
- @$(ECHO) $(CCTYPE)
-
-###############################################################################
-#
-# Check for tools that can cause failed builds
-#
-.toolcheck :
- @if $(CC) -v 2>&1 | grep -is 'gcc version 2\.96' > /dev/null; then \
- $(ECHO) 'gcc 2.96 is unsuitable for compiling Etherboot'; \
- $(ECHO) 'Use gcc 2.95 or gcc 3.x instead'; \
- exit 1; \
- fi
- @if [ `perl -e 'use bytes; print chr(255)' | wc -c` = 2 ]; then \
- $(ECHO) 'Your Perl version has a Unicode handling bug'; \
- $(ECHO) 'Execute this command before compiling Etherboot:'; \
- $(ECHO) 'export LANG=$${LANG%.UTF-8}'; \
- exit 1; \
- fi
- @$(TOUCH) $@
-MAKEDEPS += .toolcheck
-VERYCLEANUP += .toolcheck
-
-###############################################################################
-#
-# Check for various tool workarounds
-#
-
-# Make syntax does not allow use of comma or space in certain places.
-# This ugly workaround is suggested in the manual.
-#
-COMMA := ,
-EMPTY :=
-SPACE := $(EMPTY) $(EMPTY)
-
-# Check for an old version of gas (binutils 2.9.1)
-#
-OLDGAS := $(shell $(AS) --version | grep -q '2\.9\.1' && $(ECHO) -DGAS291)
-CFLAGS += $(OLDGAS)
-oldgas :
- @$(ECHO) $(oldgas)
-
-# Some widespread patched versions of gcc include -fstack-protector by
-# default, even when -ffreestanding is specified. We therefore need
-# to disable -fstack-protector if the compiler supports it.
-#
-ifeq ($(CCTYPE),gcc)
-SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
- -o /dev/null >/dev/null 2>&1
-SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
-CFLAGS += $(SP_FLAGS)
-endif
-
-# gcc 4.4 generates .eh_frame sections by default, which distort the
-# output of "size". Inhibit this.
-#
-ifeq ($(CCTYPE),gcc)
-CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
- -o /dev/null >/dev/null 2>&1
-CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
-CFLAGS += $(CFI_FLAGS)
-endif
-
-# Some versions of gas choke on division operators, treating them as
-# comment markers. Specifying --divide will work around this problem,
-# but isn't available on older gas versions.
-#
-DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null
-DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide')
-ASFLAGS += $(DIVIDE_FLAGS)
-
-###############################################################################
-#
-# Build verbosity
-#
-ifeq ($(V),1)
-Q :=
-QM := @\#
-else
-Q := @
-QM := @
-endif
-
-###############################################################################
-#
-# Set BIN according to whatever was specified on the command line as
-# the build target.
-#
-
-# Determine how many different BIN directories are mentioned in the
-# make goals.
-#
-BIN_GOALS := $(filter bin/% bin-%,$(MAKECMDGOALS))
-BIN_GOAL_BINS := $(foreach BG,$(BIN_GOALS),$(firstword $(subst /, ,$(BG))))
-NUM_BINS := $(words $(sort $(BIN_GOAL_BINS)))
-
-ifeq ($(NUM_BINS),0)
-
-# No BIN directory was specified. Set BIN to "bin" as a sensible
-# default.
-
-BIN := bin
-
-else # NUM_BINS == 0
-
-ifeq ($(NUM_BINS),1)
-
-# If exactly one BIN directory was specified, set BIN to match this
-# directory.
-#
-BIN := $(firstword $(BIN_GOAL_BINS))
-
-else # NUM_BINS == 1
-
-# More than one BIN directory was specified. We cannot handle the
-# latter case within a single make invocation, so set up recursive
-# targets for each BIN directory.
-#
-# Leave $(BIN) undefined. This has implications for any target that
-# depends on $(BIN); such targets should be made conditional upon the
-# existence of $(BIN).
-#
-$(BIN_GOALS) : % : BIN_RECURSE
- $(Q)$(MAKE) --no-print-directory BIN=$(firstword $(subst /, ,$@)) $@
-.PHONY : BIN_RECURSE
-
-endif # NUM_BINS == 1
-endif # NUM_BINS == 0
-
-ifdef BIN
-
-# Create $(BIN) directory if it doesn't exist yet
-#
-ifeq ($(wildcard $(BIN)),)
-$(shell $(MKDIR) -p $(BIN))
-endif
-
-# Target to allow e.g. "make bin-efi arch"
-#
-$(BIN) :
- @# Do nothing, silently
-.PHONY : $(BIN)
-
-# Remove everything in $(BIN) for a "make clean"
-#
-CLEANUP += $(BIN)/*.* # Avoid picking up directories
-
-endif # defined(BIN)
-
-# Determine whether or not we need to include the dependency files
-#
-NO_DEP_TARGETS := $(BIN) clean veryclean
-ifeq ($(MAKECMDGOALS),)
-NEED_DEPS := 1
-endif
-ifneq ($(strip $(filter-out $(NO_DEP_TARGETS),$(MAKECMDGOALS))),)
-NEED_DEPS := 1
-endif
-
-###############################################################################
-#
-# Select build architecture and platform based on $(BIN)
-#
-# BIN has the form bin[-[arch-]platform]
-
-ARCHS := $(patsubst arch/%,%,$(sort $(wildcard arch/*)))
-PLATFORMS := $(patsubst config/defaults/%.h,%,\
- $(sort $(wildcard config/defaults/*.h)))
-archs :
- @$(ECHO) $(ARCHS)
-
-platforms :
- @$(ECHO) $(PLATFORMS)
-
-ifdef BIN
-
-# Determine architecture portion of $(BIN), if present
-BIN_ARCH := $(strip $(foreach A,$(ARCHS),\
- $(patsubst bin-$(A)-%,$(A),\
- $(filter bin-$(A)-%,$(BIN)))))
-
-# Determine platform portion of $(BIN), if present
-ifeq ($(BIN_ARCH),)
-BIN_PLATFORM := $(patsubst bin-%,%,$(filter bin-%,$(BIN)))
-else
-BIN_PLATFORM := $(patsubst bin-$(BIN_ARCH)-%,%,$(BIN))
-endif
-
-# Determine build architecture
-DEFAULT_ARCH := i386
-ARCH := $(firstword $(BIN_ARCH) $(DEFAULT_ARCH))
-CFLAGS += -DARCH=$(ARCH)
-arch :
- @$(ECHO) $(ARCH)
-.PHONY : arch
-
-# Determine build platform
-DEFAULT_PLATFORM := pcbios
-PLATFORM := $(firstword $(BIN_PLATFORM) $(DEFAULT_PLATFORM))
-CFLAGS += -DPLATFORM=$(PLATFORM)
-platform :
- @$(ECHO) $(PLATFORM)
-
-endif # defined(BIN)
-
-# Include architecture-specific Makefile
-ifdef ARCH
-MAKEDEPS += arch/$(ARCH)/Makefile
-include arch/$(ARCH)/Makefile
-endif
-
-# Include architecture-specific include path
-ifdef ARCH
-INCDIRS += arch/$(ARCH)/include
-endif
-
-###############################################################################
-#
-# Source file handling
-
-# SRCDIRS lists all directories containing source files.
-srcdirs :
- @$(ECHO) $(SRCDIRS)
-
-# SRCS lists all .c or .S files found in any SRCDIR
-#
-SRCS += $(sort $(wildcard $(patsubst %,%/*.c,$(SRCDIRS))))
-SRCS += $(sort $(wildcard $(patsubst %,%/*.S,$(SRCDIRS))))
-srcs :
- @$(ECHO) $(SRCS)
-
-# AUTO_SRCS lists all files in SRCS that are not mentioned in
-# NON_AUTO_SRCS. Files should be added to NON_AUTO_SRCS if they
-# cannot be built using the standard build template.
-#
-AUTO_SRCS = $(filter-out $(NON_AUTO_SRCS),$(SRCS))
-autosrcs :
- @$(ECHO) $(AUTO_SRCS)
-
-# Just about everything else in this section depends upon having
-# $(BIN) set
-
-ifdef BIN
-
-# INCDIRS lists the include path
-incdirs :
- @$(ECHO) $(INCDIRS)
-
-# Common flags
-#
-CFLAGS += $(foreach INC,$(INCDIRS),-I$(INC))
-CFLAGS += -Os
-CFLAGS += -g
-ifeq ($(CCTYPE),gcc)
-CFLAGS += -ffreestanding
-CFLAGS += -Wall -W -Wformat-nonliteral
-endif
-ifeq ($(CCTYPE),icc)
-CFLAGS += -fno-builtin
-CFLAGS += -no-ip
-CFLAGS += -no-gcc
-CFLAGS += -diag-disable 111 # Unreachable code
-CFLAGS += -diag-disable 128 # Unreachable loop
-CFLAGS += -diag-disable 170 # Array boundary checks
-CFLAGS += -diag-disable 177 # Unused functions
-CFLAGS += -diag-disable 181 # printf() format checks
-CFLAGS += -diag-disable 188 # enum strictness
-CFLAGS += -diag-disable 193 # Undefined preprocessor identifiers
-CFLAGS += -diag-disable 280 # switch ( constant )
-CFLAGS += -diag-disable 310 # K&R parameter lists
-CFLAGS += -diag-disable 424 # Extra semicolon
-CFLAGS += -diag-disable 589 # Declarations mid-code
-CFLAGS += -diag-disable 593 # Unused variables
-CFLAGS += -diag-disable 810 # Casting ints to smaller ints
-CFLAGS += -diag-disable 981 # Sequence point violations
-CFLAGS += -diag-disable 1292 # Ignored attributes
-CFLAGS += -diag-disable 1338 # void pointer arithmetic
-CFLAGS += -diag-disable 1361 # Variable-length arrays
-CFLAGS += -diag-disable 1418 # Missing prototypes
-CFLAGS += -diag-disable 1419 # Missing prototypes
-CFLAGS += -diag-disable 1599 # Hidden variables
-CFLAGS += -Wall -Wmissing-declarations
-endif
-CFLAGS += $(EXTRA_CFLAGS)
-ASFLAGS += $(EXTRA_ASFLAGS)
-LDFLAGS += $(EXTRA_LDFLAGS)
-
-# Inhibit -Werror if NO_WERROR is specified on make command line
-#
-ifneq ($(NO_WERROR),1)
-CFLAGS += -Werror
-ASFLAGS += --fatal-warnings
-endif
-
-# compiler.h is needed for our linking and debugging system
-#
-CFLAGS += -include compiler.h
-
-# CFLAGS for specific object types
-#
-CFLAGS_c +=
-CFLAGS_S += -DASSEMBLY
-
-# Base object name of the current target
-#
-OBJECT = $(firstword $(subst ., ,$(@F)))
-
-# CFLAGS for specific object files. You can define
-# e.g. CFLAGS_rtl8139, and have those flags automatically used when
-# compiling bin/rtl8139.o.
-#
-OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
-$(BIN)/%.flags :
- @$(ECHO) $(OBJ_CFLAGS)
-
-# ICC requires postprocessing objects to fix up table alignments
-#
-ifeq ($(CCTYPE),icc)
-POST_O = && $(ICCFIX) $@
-POST_O_DEPS := $(ICCFIX)
-else
-POST_O :=
-POST_O_DEPS :=
-endif
-
-# Rules for specific object types.
-#
-COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
-RULE_c = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
-RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(subst -,_,$(OBJECT))=$* -c $< -o $@ $(POST_O)
-RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
-RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
-
-PREPROCESS_S = $(CPP) $(CFLAGS) $(CFLAGS_S) $(OBJ_CFLAGS)
-ASSEMBLE_S = $(AS) $(ASFLAGS)
-RULE_S = $(Q)$(PREPROCESS_S) $< | $(ASSEMBLE_S) -o $@
-RULE_S_to_s = $(Q)$(PREPROCESS_S) $< > $@
-
-DEBUG_TARGETS += dbg%.o c s
-
-# We automatically generate rules for any file mentioned in AUTO_SRCS
-# using the following set of templates. It would be cleaner to use
-# $(eval ...), but this function exists only in GNU make >= 3.80.
-
-# src_template : generate Makefile rules for a given source file
-#
-# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c")
-# $(2) is the full path to the .d file (e.g. "bin/deps/drivers/net/rtl8139.d")
-# $(3) is the source type (e.g. "c")
-# $(4) is the source base name (e.g. "rtl8139")
-#
-define src_template
-
- @$(ECHO) " [DEPS] $(1)"
- @$(MKDIR) -p $(dir $(2))
- @$(RM) $(2)
- @$(TOUCH) $(2)
- @$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
- -Wno-error -MM $(1) -MG -MP | \
- sed 's/\.o\s*:/_DEPS =/' >> $(2)
- @$(ECHO_E) '\n$$(BIN)/$(4).o :' \
- '$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(4)_DEPS)' \
- '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
- '\n\t$$(RULE_$(3))\n' \
- '\nBOBJS += $$(BIN)/$(4).o\n' \
- $(foreach TGT,$(DEBUG_TARGETS), \
- $(if $(RULE_$(3)_to_$(TGT)), \
- '\n$$(BIN)/$(4).$(TGT) :' \
- '$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(4)_DEPS)' \
- '\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
- '\n\t$$(RULE_$(3)_to_$(TGT))\n' \
- '\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
- '\n$(2) : $$($(4)_DEPS)\n' \
- '\nTAGS : $$($(4)_DEPS)\n' \
- >> $(2)
- @$(PARSEROM) $(1) >> $(2)
-
-endef
-
-# Rule to generate the Makefile rules files to be included
-#
-$(BIN)/deps/%.d : % $(MAKEDEPS) $(PARSEROM)
- $(if $(filter $(AUTO_SRCS),$<),$(call src_template,$<,$@,$(subst .,,$(suffix $<)),$(basename $(notdir $<))),@$(ECHO) 'ERROR: $< is not an AUTO_SRC' ; exit 1)
-
-# Calculate and include the list of Makefile rules files
-#
-AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
-ifdef NEED_DEPS
-ifneq ($(AUTO_DEPS),)
--include $(AUTO_DEPS)
-endif
-endif
-autodeps :
- @$(ECHO) $(AUTO_DEPS)
-VERYCLEANUP += $(BIN)/deps
-
-# The following variables are created by the Makefile rules files
-#
-bobjs :
- @$(ECHO) $(BOBJS)
-drivers :
- @$(ECHO) $(DRIVERS)
-.PHONY : drivers
-roms :
- @$(ECHO) $(ROMS)
-
-# List of embedded images included in the last build of embedded.o.
-# This is needed in order to correctly rebuild embedded.o whenever the
-# list of objects changes.
-#
-EMBEDDED_LIST := $(BIN)/.embedded.list
-ifeq ($(wildcard $(EMBEDDED_LIST)),)
-EMBEDDED_LIST_IMAGE := <invalid>
-else
-EMBEDDED_LIST_IMAGE := $(shell cat $(EMBEDDED_LIST))
-endif
-ifneq ($(EMBEDDED_LIST_IMAGE),$(EMBEDDED_IMAGE))
-$(shell $(ECHO) "$(EMBEDDED_IMAGE)" > $(EMBEDDED_LIST))
-endif
-
-$(EMBEDDED_LIST) :
-
-VERYCLEANUP += $(EMBEDDED_LIST)
-
-EMBEDDED_FILES := $(subst $(COMMA), ,$(EMBEDDED_IMAGE))
-EMBED_ALL := $(foreach i,$(call seq,1,$(words $(EMBEDDED_FILES))),\
- EMBED ( $(i), \"$(word $(i), $(EMBEDDED_FILES))\",\
- \"$(notdir $(word $(i),$(EMBEDDED_FILES)))\" ))
-
-$(BIN)/embedded.o : $(EMBEDDED_FILES) $(EMBEDDED_LIST)
-CFLAGS_embedded = -DEMBED_ALL="$(EMBED_ALL)"
-
-# Generate the NIC file from the parsed source files. The NIC file is
-# only for rom-o-matic.
-#
-$(BIN)/NIC : $(AUTO_DEPS)
- @$(ECHO) '# This is an automatically generated file, do not edit' > $@
- @$(ECHO) '# It does not affect anything in the build, ' \
- 'it is only for rom-o-matic' >> $@
- @$(ECHO) >> $@
- @perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@
-CLEANUP += $(BIN)/NIC # Doesn't match the $(BIN)/*.* pattern
-
-# Analyse a target name (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and
-# derive the variables:
-#
-# TGT_ELEMENTS : the elements of the target (e.g. "dfe538 prism2_pci")
-# TGT_PREFIX : the prefix type (e.g. "zrom")
-# TGT_DRIVERS : the driver for each element (e.g. "rtl8139 prism2_pci")
-# TGT_ROM_NAME : the ROM name (e.g. "dfe538")
-# TGT_MEDIA : the media type (e.g. "rom")
-#
-DRIVERS_gpxe = $(DRIVERS)
-CARD_DRIVER = $(firstword $(DRIVER_$(1)) $(1))
-TGT_ELEMENTS = $(subst --, ,$(firstword $(subst ., ,$(notdir $@))))
-TGT_PREFIX = $(word 2,$(subst ., ,$(notdir $@)))
-TGT_ROM_NAME = $(firstword $(TGT_ELEMENTS))
-TGT_DRIVERS = $(strip $(if $(DRIVERS_$(TGT_ROM_NAME)), \
- $(DRIVERS_$(TGT_ROM_NAME)), \
- $(foreach TGT_ELEMENT,$(TGT_ELEMENTS), \
- $(call CARD_DRIVER,$(TGT_ELEMENT))) ))
-TGT_MEDIA = $(subst z,,$(TGT_PREFIX))
-
-# Look up ROM IDs for the current target
-# (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
-#
-# TGT_PCI_VENDOR : the PCI vendor ID (e.g. "0x1186")
-# TGT_PCI_DEVICE : the PCI device ID (e.g. "0x1300")
-#
-TGT_PCI_VENDOR = $(PCI_VENDOR_$(TGT_ROM_NAME))
-TGT_PCI_DEVICE = $(PCI_DEVICE_$(TGT_ROM_NAME))
-
-# Calculate link-time options for the current target
-# (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
-#
-# TGT_LD_DRIVERS : symbols to require in order to drag in the relevant drivers
-# (e.g. "obj_rtl8139 obj_prism2_pci")
-# TGT_LD_IDS : symbols to define in order to fill in ID structures in the
-# ROM header (e.g."pci_vendor_id=0x1186 pci_device_id=0x1300")
-#
-TGT_LD_DRIVERS = $(subst -,_,$(patsubst %,obj_%,$(TGT_DRIVERS)))
-TGT_LD_PREFIX = obj_$(TGT_PREFIX)prefix
-TGT_LD_IDS = pci_vendor_id=$(firstword $(TGT_PCI_VENDOR) 0) \
- pci_device_id=$(firstword $(TGT_PCI_DEVICE) 0)
-
-# Calculate linker flags based on link-time options for the current
-# target type (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the
-# variables:
-#
-# TGT_LD_FLAGS : target-specific flags to pass to linker (e.g.
-# "-u obj_zpciprefix -u obj_rtl8139 -u obj_prism2_pci
-# --defsym pci_vendor=0x1186 --defsym pci_device=0x1300")
-#
-TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_PREFIX) $(TGT_LD_DRIVERS) obj_config,\
- -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
- $(patsubst %,--defsym %,$(TGT_LD_IDS))
-
-# Calculate makerom flags for the specific target
-# (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and derive the variables:
-#
-# TGT_MAKEROM_FLAGS : target-specific flags for makerom (e.g.
-# "-p 0x1186,0x1300")
-#
-TGT_MAKEROM_FLAGS = $(strip $(MAKEROM_FLAGS_$(TGT_ROM_NAME)) \
- $(if $(TGT_PCI_VENDOR),$(strip -p $(TGT_PCI_VENDOR),$(TGT_PCI_DEVICE))))
-
-# Calculate list of debugging versions of objects to be included in
-# the target.
-#
-DEBUG_LIST = $(subst $(COMMA), ,$(DEBUG))
-DEBUG_OBJ_LEVEL = $(firstword $(word 2,$(subst :, ,$(1))) 1)
-DEBUG_OBJ_BASE = $(word 1,$(subst :, ,$(1))).dbg$(call DEBUG_OBJ_LEVEL,$(1))
-DEBUG_OBJ = $(BIN)/$(call DEBUG_OBJ_BASE,$(1)).o
-DEBUG_ORIG_OBJ = $(BIN)/$(word 1,$(subst :, ,$(1))).o
-DEBUG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_OBJ,$(D)))
-DEBUG_ORIG_OBJS = $(foreach D,$(DEBUG_LIST),$(call DEBUG_ORIG_OBJ,$(D)))
-BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS))
-
-# Print out all derived information for a given target.
-#
-$(BIN)/%.info :
- @$(ECHO) 'Elements : $(TGT_ELEMENTS)'
- @$(ECHO) 'Prefix : $(TGT_PREFIX)'
- @$(ECHO) 'Drivers : $(TGT_DRIVERS)'
- @$(ECHO) 'ROM name : $(TGT_ROM_NAME)'
- @$(ECHO) 'Media : $(TGT_MEDIA)'
- @$(ECHO)
- @$(ECHO) 'PCI vendor : $(TGT_PCI_VENDOR)'
- @$(ECHO) 'PCI device : $(TGT_PCI_DEVICE)'
- @$(ECHO)
- @$(ECHO) 'LD driver symbols : $(TGT_LD_DRIVERS)'
- @$(ECHO) 'LD prefix symbols : $(TGT_LD_PREFIX)'
- @$(ECHO) 'LD ID symbols : $(TGT_LD_IDS)'
- @$(ECHO)
- @$(ECHO) 'LD target flags : $(TGT_LD_FLAGS)'
- @$(ECHO)
- @$(ECHO) 'makerom target flags : $(TGT_MAKEROM_FLAGS)'
- @$(ECHO)
- @$(ECHO) 'Debugging objects : $(DEBUG_OBJS)'
- @$(ECHO) 'Replaced objects : $(DEBUG_ORIG_OBJS)'
-
-# List of objects included in the last build of blib. This is needed
-# in order to correctly rebuild blib whenever the list of objects
-# changes.
-#
-BLIB_LIST := $(BIN)/.blib.list
-ifeq ($(wildcard $(BLIB_LIST)),)
-BLIB_LIST_OBJS := <invalid>
-else
-BLIB_LIST_OBJS := $(shell cat $(BLIB_LIST))
-endif
-ifneq ($(BLIB_LIST_OBJS),$(BLIB_OBJS))
-$(shell $(ECHO) "$(BLIB_OBJS)" > $(BLIB_LIST))
-endif
-
-$(BLIB_LIST) :
-
-VERYCLEANUP += $(BLIB_LIST)
-
-# Library of all objects
-#
-BLIB = $(BIN)/blib.a
-$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
- $(Q)$(RM) $(BLIB)
- $(QM)$(ECHO) " [AR] $@"
- $(Q)$(AR) r $@ $(BLIB_OBJS)
- $(Q)$(RANLIB) $@
-blib : $(BLIB)
-
-# Build an intermediate object file from the objects required for the
-# specified target.
-#
-$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
- $(QM)$(ECHO) " [LD] $@"
- $(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \
- -Map $(BIN)/$*.tmp.map
- $(Q)$(OBJDUMP) -ht $@ | $(SORTOBJDUMP) >> $(BIN)/$*.tmp.map
-
-# Keep intermediate object file (useful for debugging)
-.PRECIOUS : $(BIN)/%.tmp
-
-# Show a linker map for the specified target
-#
-$(BIN)/%.map : $(BIN)/%.tmp
- @less $(BIN)/$*.tmp.map
-
-# Get objects list for the specified target
-#
-define objs_list
- $(sort $(foreach OBJ_SYMBOL,\
- $(filter obj_%,$(shell $(NM) $(1) | cut -d" " -f3)),\
- $(patsubst obj_%,%,$(OBJ_SYMBOL))))
-endef
-$(BIN)/%.objs : $(BIN)/%.tmp
- $(Q)$(ECHO) $(call objs_list,$<)
-$(BIN)/%.sizes : $(BIN)/%.tmp
- $(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(sort $(wildcard $(BIN)/$(subst _,?,$(OBJ)).o))) | \
- sort -g
-
-# Get dependency list for the specified target
-#
-define deps_list
- $(sort $(foreach OBJ,$(call objs_list,$(1)),$($(OBJ)_DEPS)))
-endef
-$(BIN)/%.deps : $(BIN)/%.tmp
- $(Q)$(ECHO) $(call deps_list,$<)
-
-# Get unneeded source files for the specified target
-#
-define nodeps_list
- $(sort $(filter-out $(call deps_list,$(1)),\
- $(foreach BOBJ,$(BOBJS),\
- $($(basename $(notdir $(BOBJ)))_DEPS))))
-endef
-$(BIN)/%.nodeps : $(BIN)/%.tmp
- $(Q)$(ECHO) $(call nodeps_list,$<)
-
-# Get licensing verdict for the specified target
-#
-define unlicensed_deps_list
- $(shell grep -L FILE_LICENCE $(call deps_list,$(1)))
-endef
-define licence_list
- $(patsubst __licence_%,%,\
- $(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
-endef
-$(BIN)/%.licence : $(BIN)/%.tmp
- $(QM)$(ECHO) " [LICENCE] $@"
- $(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\
- echo -n "Unable to determine licence because the following " ;\
- echo "files are missing a licence declaration:" ;\
- echo $(call unlicensed_deps_list,$<);\
- exit 1,\
- $(LICENCE) $(call licence_list,$<))
-
-# Extract compression information from intermediate object file
-#
-$(BIN)/%.zinfo : $(BIN)/%.tmp
- $(QM)$(ECHO) " [ZINFO] $@"
- $(Q)$(OBJCOPY) -O binary -j .zinfo $< $@
-
-# Build raw binary file from intermediate object file
-#
-$(BIN)/%.bin : $(BIN)/%.tmp
- $(QM)$(ECHO) " [BIN] $@"
- $(Q)$(OBJCOPY) -O binary -R .zinfo $< $@
-
-# Compress raw binary file
-#
-$(BIN)/%.zbin : $(BIN)/%.bin $(BIN)/%.zinfo $(ZBIN)
- $(QM)$(ECHO) " [ZBIN] $@"
- $(Q)$(ZBIN) $(BIN)/$*.bin $(BIN)/$*.zinfo > $@
-
-# Rules for each media format. These are generated and placed in an
-# external Makefile fragment. We could do this via $(eval ...), but
-# that would require make >= 3.80.
-#
-# Note that there's an alternative way to generate most .rom images:
-# they can be copied from their 'master' ROM image using cp and
-# reprocessed with makerom to add the PCI IDs and ident string. The
-# relevant rule would look something like:
-#
-# $(BIN)/dfe538%rom : $(BIN)/rtl8139%rom
-# cat $< $@
-# $(FINALISE_rom)
-#
-# You can derive the ROM/driver relationships using the variables
-# DRIVER_<rom> and/or ROMS_<driver>.
-#
-# We don't currently do this, because (a) it would require generating
-# yet more Makefile fragments (since you need a rule for each ROM in
-# ROMS), and (b) the linker is so fast that it probably wouldn't make
-# much difference to the overall build time.
-
-media :
- @$(ECHO) $(MEDIA)
-
-AUTO_MEDIA = $(filter-out $(NON_AUTO_MEDIA),$(MEDIA))
-automedia :
- @$(ECHO) $(AUTO_MEDIA)
-
-# media_template : create Makefile rules for specified media
-#
-# $(1) is the media name (e.g. "rom")
-# $(2) is the full path to the .d file (e.g. "bin/deps/rom.media.d")
-#
-define media_template
-
- @$(ECHO) " [MEDIADEPS] $(1)"
- @$(MKDIR) -p $(dir $(2))
- @$(RM) $(2)
- @$(TOUCH) $(2)
- @$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
- '\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \
- '\n\t$$(Q)$$(CP) $$< $$@' \
- '\n\t$$(Q)$$(PAD_$(1))' \
- '\n\t$$(Q)$$(FINALISE_$(1))' \
- > $(2)
-
-endef
-
-# Rule to generate the Makefile rules to be included
-#
-$(BIN)/deps/%.media.d : $(MAKEDEPS)
- $(if $(filter $(AUTO_MEDIA),$*), \
- $(call media_template,$*,$@), \
- @$(ECHO) 'ERROR: $* is not an AUTO_MEDIA' ; exit 1)
-
-# Calculate and include the list of Makefile rules files
-#
-MEDIA_DEPS = $(patsubst %,$(BIN)/deps/%.media.d,$(AUTO_MEDIA))
-mediadeps :
- @$(ECHO) $(MEDIA_DEPS)
-ifdef NEED_DEPS
-ifneq ($(MEDIA_DEPS),)
--include $(MEDIA_DEPS)
-endif
-endif
-
-# Wrap up binary blobs (for embedded images)
-#
-$(BIN)/%.o : payload/%.img
- $(QM)echo " [WRAP] $@"
- $(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
- --defsym obj_$*=0
-
-BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(sort $(wildcard payload/*.img)))
-
-# The "allXXXs" targets for each suffix
-#
-allall: allroms allzroms allpxes allisos alldsks
-allroms allzroms : all%s : $(foreach ROM,$(ROMS),$(BIN)/$(ROM).%)
-allpxes allisos alldsks : all%s : $(foreach DRIVER,$(DRIVERS),$(BIN)/$(DRIVER).%)
-
-# Alias for gpxe.%
-#
-$(BIN)/etherboot.% : $(BIN)/gpxe.%
- ln -sf $(notdir $<) $@
-
-endif # defined(BIN)
-
-###############################################################################
-#
-# Rules for finalising files. TGT_MAKEROM_FLAGS is defined as part of
-# the automatic build system and varies by target; it includes the
-# "-p 0x1234,0x5678" string to set the PCI IDs.
-#
-FINALISE_rom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
- -i$(IDENT) -s 0 $@
-FINALISE_hrom = $(FINALISE_rom)
-FINALISE_xrom = $(MAKEROM) $(MAKEROM_FLAGS) $(TGT_MAKEROM_FLAGS) \
- -i$(IDENT) -n -s 0 $@
-
-# Some ROMs require specific flags to be passed to makerom.pl
-#
-MAKEROM_FLAGS_3c503 = -3
-
-###############################################################################
-#
-# The compression utilities
-#
-$(NRV2B) : util/nrv2b.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) -O2 -DENCODE -DDECODE -DMAIN -DVERBOSE -DNDEBUG \
- -DBITSIZE=32 -DENDIAN=0 -o $@ $<
-CLEANUP += $(NRV2B)
-
-$(ZBIN) : util/zbin.c util/nrv2b.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) -O2 -o $@ $<
-CLEANUP += $(ZBIN)
-
-###############################################################################
-#
-# The EFI image converter
-#
-ELF2EFI_CFLAGS := -I$(BINUTILS_DIR)/include -I$(BFD_DIR)/include \
- -idirafter include -L$(BINUTILS_DIR)/lib -L$(BFD_DIR)/lib \
- -lbfd -liberty -lz
-
-$(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_IA32 -O2 -o $@ $<
-CLEANUP += $(ELF2EFI32)
-
-$(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_X64 -O2 -o $@ $<
-CLEANUP += $(ELF2EFI64)
-
-$(EFIROM) : util/efirom.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) -idirafter include -O2 -o $@ $<
-CLEANUP += $(EFIROM)
-
-###############################################################################
-#
-# The ICC fixup utility
-#
-$(ICCFIX) : util/iccfix.c $(MAKEDEPS)
- $(QM)$(ECHO) " [HOSTCC] $@"
- $(Q)$(HOST_CC) -idirafter include -O2 -o $@ $<
-CLEANUP += $(ICCFIX)
-
-###############################################################################
-#
-# Auto-incrementing build serial number. Append "bs" to your list of
-# build targets to get a serial number printed at the end of the
-# build. Enable -DBUILD_SERIAL in order to see it when the code runs.
-#
-BUILDSERIAL_H = config/.buildserial.h
-BUILDSERIAL_NOW = config/.buildserial.now
-BUILDSERIAL_NEXT = config/.buildserial.next
-
-$(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) :
- $(ECHO) 1 > $@
-
-$(BUILDSERIAL_H) : $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT)
- $(ECHO) '#define BUILD_SERIAL_NUM $(shell cat $<)' > $@
-
-ifeq ($(filter bs,$(MAKECMDGOALS)),bs)
-$(shell diff -q $(BUILDSERIAL_NOW) $(BUILDSERIAL_NEXT) > /dev/null || \
- cp -f $(BUILDSERIAL_NEXT) $(BUILDSERIAL_NOW))
-endif
-
-bs : $(BUILDSERIAL_NOW)
- @$(ECHO) $$(( $(shell cat $<) + 1 )) > $(BUILDSERIAL_NEXT)
- @$(ECHO) "Build serial number is $(shell cat $<)"
-
-###############################################################################
-#
-# Build the TAGS file(s) for emacs
-#
-TAGS :
- ctags -e -R -f $@ --exclude=bin
-
-CLEANUP += TAGS
-
-###############################################################################
-#
-# Force rebuild for any given target
-#
-%.rebuild :
- rm -f $*
- $(Q)$(MAKE) $*
-
-###############################################################################
-#
-# Symbol table checks
-#
-
-ifdef BIN
-
-SYMTAB = $(BIN)/symtab
-$(SYMTAB) : $(BLIB)
- $(OBJDUMP) -w -t $< > $@
-
-CLEANUP += $(BIN)/symtab
-
-symcheck : $(SYMTAB)
- $(SYMCHECK) $<
-
-endif # defined(BIN)
-
-###############################################################################
-#
-# Build bochs symbol table
-#
-
-ifdef BIN
-
-$(BIN)/%.bxs : $(BIN)/%.tmp
- $(NM) $< | cut -d" " -f1,3 > $@
-
-endif # defined(BIN)
-
-###############################################################################
-#
-# Documentation
-#
-
-ifdef BIN
-
-$(BIN)/doxygen.cfg : doxygen.cfg $(MAKEDEPS)
- $(Q)$(PERL) -pe 's{\@SRCDIRS\@}{$(SRCDIRS)}; ' \
- -e 's{\@INCDIRS\@}{$(filter-out .,$(INCDIRS))}; ' \
- -e 's{\@BIN\@}{$(BIN)}; ' \
- -e 's{\@ARCH\@}{$(ARCH)}; ' \
- $< > $@
-
-$(BIN)/doc : $(BIN)/doxygen.cfg
- $(Q)$(DOXYGEN) $<
-
-.PHONY : $(BIN)/doc
-
-doc : $(BIN)/doc
-
-doc-clean :
- $(Q)$(RM) -r $(BIN)/doc
-
-VERYCLEANUP += $(BIN)/doc
-
-docview :
- @[ -f $(BIN)/doc/html/index.html ] || $(MAKE) $(BIN)/doc
- @if [ -n "$$BROWSER" ] ; then \
- ( $$BROWSER $(BIN)/doc/html/index.html & ) ; \
- else \
- $(ECHO) "Documentation index in $(BIN)/doc/html/index.html" ; \
- fi
-
-endif # defined(BIN)
-
-###############################################################################
-#
-# Clean-up
-#
-clean :
- $(RM) $(CLEANUP)
-
-veryclean : clean
- $(RM) -r $(VERYCLEANUP)
diff --git a/gpxe/src/arch/i386/Makefile b/gpxe/src/arch/i386/Makefile
deleted file mode 100644
index dd8da802..00000000
--- a/gpxe/src/arch/i386/Makefile
+++ /dev/null
@@ -1,117 +0,0 @@
-# Force i386-only instructions
-#
-CFLAGS += -march=i386
-
-# Code size reduction.
-#
-CFLAGS += -fomit-frame-pointer
-
-# Code size reduction.
-#
-ifeq ($(CCTYPE),gcc)
-CFLAGS += -fstrength-reduce
-endif
-
-# Code size reduction. gcc3 needs a different syntax to gcc2 if you
-# want to avoid spurious warnings.
-#
-ifeq ($(CCTYPE),gcc)
-GCC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
-GCC_MAJOR := $(firstword $(GCC_VERSION))
-ifeq ($(GCC_MAJOR),2)
-CFLAGS += -malign-jumps=1 -malign-loops=1 -malign-functions=1
-else
-CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
-endif # gcc2
-endif # gcc
-
-# Code size reduction. This is almost always a win. The kernel uses
-# it, too.
-#
-ifeq ($(CCTYPE),gcc)
-CFLAGS += -mpreferred-stack-boundary=2
-endif
-
-# Code size reduction. Use regparm for all functions - C functions
-# called from assembly (or vice versa) need __asmcall now
-#
-CFLAGS += -mregparm=3
-
-# Code size reduction. Use -mrtd (same __asmcall requirements as above)
-ifeq ($(CCTYPE),gcc)
-CFLAGS += -mrtd
-endif
-
-# Code size reduction. This is the logical complement to -mregparm=3.
-# It doesn't currently buy us anything, but if anything ever tries to
-# return small structures, let's be prepared
-#
-CFLAGS += -freg-struct-return
-
-# Force 32-bit code even on an x86-64 machine
-#
-CFLAGS += -m32
-ASFLAGS += --32
-ifeq ($(HOST_OS),FreeBSD)
-LDFLAGS += -m elf_i386_fbsd
-else
-LDFLAGS += -m elf_i386
-endif
-
-# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
-#
-CFLAGS += -fshort-wchar
-
-# We need to undefine the default macro "i386" when compiling .S
-# files, otherwise ".arch i386" translates to ".arch 1"...
-#
-CFLAGS += -Ui386
-
-# Locations of utilities
-#
-ISOLINUX_BIN = /usr/lib/syslinux/isolinux.bin
-
-# i386-specific directories containing source files
-#
-SRCDIRS += arch/i386/core arch/i386/transitions arch/i386/prefix
-SRCDIRS += arch/i386/firmware/pcbios
-SRCDIRS += arch/i386/image
-SRCDIRS += arch/i386/drivers
-SRCDIRS += arch/i386/drivers/net
-SRCDIRS += arch/i386/interface/pcbios
-SRCDIRS += arch/i386/interface/pxe
-SRCDIRS += arch/i386/interface/pxeparent
-SRCDIRS += arch/i386/interface/syslinux
-SRCDIRS += arch/i386/hci/commands
-
-# The various xxx_loader.c files are #included into core/loader.c and
-# should not be compiled directly.
-#
-NON_AUTO_SRCS += arch/i386/core/aout_loader.c
-NON_AUTO_SRCS += arch/i386/core/freebsd_loader.c
-NON_AUTO_SRCS += arch/i386/core/wince_loader.c
-
-# Include common x86 Makefile
-#
-MAKEDEPS += arch/x86/Makefile
-include arch/x86/Makefile
-
-# Include platform-specific Makefile
-#
-MAKEDEPS += arch/i386/Makefile.$(PLATFORM)
-include arch/i386/Makefile.$(PLATFORM)
-
-# Some suffixes (e.g. %.fd0) are generated directly from other
-# finished files (e.g. %.dsk), rather than having their own prefix.
-
-# rule to write disk images to /dev/fd0
-NON_AUTO_MEDIA += fd0
-%fd0 : %dsk
- $(QM)$(ECHO) " [DD] $@"
- $(Q)dd if=$< bs=512 conv=sync of=/dev/fd0
- $(Q)sync
-
-# Add NON_AUTO_MEDIA to the media list, so that they show up in the
-# output of "make"
-#
-MEDIA += $(NON_AUTO_MEDIA)
diff --git a/gpxe/src/arch/i386/Makefile.efi b/gpxe/src/arch/i386/Makefile.efi
deleted file mode 100644
index 8d651b04..00000000
--- a/gpxe/src/arch/i386/Makefile.efi
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- makefile -*- : Force emacs to use Makefile mode
-
-# Specify EFI image builder
-#
-ELF2EFI = $(ELF2EFI32)
-
-# Include generic EFI Makefile
-#
-MAKEDEPS += arch/x86/Makefile.efi
-include arch/x86/Makefile.efi
diff --git a/gpxe/src/arch/i386/Makefile.pcbios b/gpxe/src/arch/i386/Makefile.pcbios
deleted file mode 100644
index e38fbca0..00000000
--- a/gpxe/src/arch/i386/Makefile.pcbios
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- makefile -*- : Force emacs to use Makefile mode
-
-# The i386 linker script
-#
-LDSCRIPT = arch/i386/scripts/i386.lds
-
-# Stop ld from complaining about our customised linker script
-#
-LDFLAGS += -N --no-check-sections
-
-# Media types.
-#
-MEDIA += rom
-MEDIA += hrom
-MEDIA += xrom
-MEDIA += pxe
-MEDIA += kpxe
-MEDIA += kkpxe
-MEDIA += lkrn
-MEDIA += dsk
-MEDIA += nbi
-MEDIA += hd
-MEDIA += raw
-
-# Padding rules
-#
-PAD_rom = $(PADIMG) --blksize=512 --byte=0xff $@
-PAD_hrom = $(PAD_rom)
-PAD_xrom = $(PAD_rom)
-PAD_dsk = $(PADIMG) --blksize=512 $@
-PAD_hd = $(PADIMG) --blksize=32768 $@
-
-# rule to make a non-emulation ISO boot image
-NON_AUTO_MEDIA += iso
-%iso: %lkrn util/geniso
- $(QM)$(ECHO) " [GENISO] $@"
- $(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) bash util/geniso $@ $<
-
-# rule to make a floppy emulation ISO boot image
-NON_AUTO_MEDIA += liso
-%liso: %lkrn util/genliso
- $(QM)$(ECHO) " [GENLISO] $@"
- $(Q)bash util/genliso $@ $<
-
-# rule to make a syslinux floppy image (mountable, bootable)
-NON_AUTO_MEDIA += sdsk
-%sdsk: %lkrn util/gensdsk
- $(QM)$(ECHO) " [GENSDSK] $@"
- $(Q)bash util/gensdsk $@ $<
-
-# Special target for building Master Boot Record binary
-$(BIN)/mbr.bin : $(BIN)/mbr.o
- $(QM)$(ECHO) " [OBJCOPY] $@"
- $(Q)$(OBJCOPY) -O binary $< $@
-
-# rule to make a USB disk image
-$(BIN)/usbdisk.bin : $(BIN)/usbdisk.o
- $(QM)$(ECHO) " [OBJCOPY] $@"
- $(Q)$(OBJCOPY) -O binary $< $@
-
-NON_AUTO_MEDIA += usb
-%usb: $(BIN)/usbdisk.bin %hd
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)cat $^ > $@
-
-# Padded floppy image (e.g. for iLO)
-NON_AUTO_MEDIA += pdsk
-%pdsk : %dsk
- $(Q)cp $< $@
- $(Q)$(PADIMG) --blksize=1474560 $@
diff --git a/gpxe/src/arch/i386/README.i386 b/gpxe/src/arch/i386/README.i386
deleted file mode 100644
index b9b79cc4..00000000
--- a/gpxe/src/arch/i386/README.i386
+++ /dev/null
@@ -1,197 +0,0 @@
-Etherboot/NILO i386 initialisation path and external call interface
-===================================================================
-
-1. Background
-
-GCC compiles 32-bit code. It is capable of producing
-position-independent code, but the resulting binary is about 25%
-bigger than the corresponding fixed-position code. Since one main use
-of Etherboot is as firmware to be burned into an EPROM, code size must
-be kept as small as possible.
-
-This means that we want to compile fixed-position code with GCC, and
-link it to have a predetermined start address. The problem then is
-that we must know the address that the code will be loaded to when it
-runs. There are several ways to solve this:
-
-1. Pick an address, link the code with this start address, then make
- sure that the code gets loaded at that location. This is
- problematic, because we may pick an address that we later end up
- wanting to use to load the operating system that we're booting.
-
-2. Pick an address, link the code with this start address, then set up
- virtual addressing so that the virtual addresses match the
- link-time addresses regardless of the real physical address that
- the code is loaded to. This enables us to relocate Etherboot to
- the top of high memory, where it will be out of the way of any
- loading operating system.
-
-3. Link the code with a text start address of zero and a data start
- address also of zero. Use 16-bit real mode and the
- quasi-position-independence it gives you via segment addressing.
- Doing this requires that we generate 16-bit code, rather than
- 32-bit code, and restricts us to a maximum of 64kB in each segment.
-
-There are other possible approaches (e.g. including a relocation table
-and code that performs standard dynamic relocation), but the three
-options listed above are probably the best available.
-
-Etherboot can be invoked in a variety of ways (ROM, floppy, as a PXE
-NBP, etc). Several of these ways involve control being passed to
-Etherboot with the CPU in 16-bit real mode. Some will involve the CPU
-being in 32-bit protected mode, and there's an outside chance that
-some may involve the CPU being in 16-bit protected mode. We will
-almost certainly have to effect a CPU mode change in order to reach
-the mode we want to be in to execute the C code.
-
-Additionally, Etherboot may wish to call external routines, such as
-BIOS interrupts, which must be called in 16-bit real mode. When
-providing a PXE API, Etherboot must provide a mechanism for external
-code to call it from 16-bit real mode.
-
-Not all i386 builds of Etherboot will want to make real-mode calls.
-For example, when built for LinuxBIOS rather than the standard PCBIOS,
-no real-mode calls are necessary.
-
-For the ultimate in PXE compatibility, we may want to build Etherboot
-to run permanently in real mode.
-
-There is a wide variety of potential combinations of mode switches
-that we may wish to implement. There are additional complications,
-such as the inability to access a high-memory stack when running in
-real mode.
-
-2. Transition libraries
-
-To handle all these various combinations of mode switches, we have
-several "transition" libraries in Etherboot. We also have the concept
-of an "internal" and an "external" environment. The internal
-environment is the environment within which we can execute C code.
-The external environment is the environment of whatever external code
-we're trying to interface to, such as the system BIOS or a PXE NBP.
-
-As well as having a separate addressing scheme, the internal
-environment also has a separate stack.
-
-The transition libraries are:
-
-a) librm
-
-librm handles transitions between an external 16-bit real-mode
-environment and an internal 32-bit protected-mode environment with
-virtual addresses.
-
-b) libkir
-
-libkir handles transitions between an external 16-bit real-mode (or
-16:16 or 16:32 protected-mode) environment and an internal 16-bit
-real-mode (or 16:16 protected-mode) environment.
-
-c) libpm
-
-libpm handles transitions between an external 32-bit protected-mode
-environment with flat physical addresses and an internal 32-bit
-protected-mode environment with virtual addresses.
-
-The transition libraries handle the transitions required when
-Etherboot is started up for the first time, the transitions required
-to execute any external code, and the transitions required when
-Etherboot exits (if it exits). When Etherboot provides a PXE API,
-they also handle the transitions required when a PXE client makes a
-PXE API call to Etherboot.
-
-Etherboot may use multiple transition libraries. For example, an
-Etherboot ELF image does not require librm for its initial transitions
-from prefix to runtime, but may require librm for calling external
-real-mode functions.
-
-3. Setup and initialisation
-
-Etherboot is conceptually divided into the prefix, the decompressor,
-and the runtime image. (For non-compressed images, the decompressor
-is a no-op.) The complete image comprises all three parts and is
-distinct from the runtime image, which exclude the prefix and the
-decompressor.
-
-The prefix does several tasks:
-
- Load the complete image into memory. (For example, the floppy
- prefix issues BIOS calls to load the remainder of the complete image
- from the floppy disk into RAM, and the ISA ROM prefix copies the ROM
- contents into RAM for faster access.)
-
- Call the decompressor, if the runtime image is compressed. This
- decompresses the runtime image.
-
- Call the runtime image's setup() routine. This is a routine
- implemented in assembly code which sets up the internal environment
- so that C code can execute.
-
- Call the runtime image's arch_initialise() routine. This is a
- routine implemented in C which does some basic startup tasks, such
- as initialising the console device, obtaining a memory map and
- relocating the runtime image to high memory.
-
- Call the runtime image's arch_main() routine. This records the exit
- mechanism requested by the prefix and calls main(). (The prefix
- needs to register an exit mechanism because by the time main()
- returns, the memory occupied by the prefix has most likely been
- overwritten.)
-
-When acting as a PXE ROM, the ROM prefix contains an UNDI loader
-routine in addition to its usual code. The UNDI loader performs a
-similar sequence of steps:
-
- Load the complete image into memory.
-
- Call the decompressor.
-
- Call the runtime image's setup() routine.
-
- Call the runtime image's arch_initialise() routine.
-
- Call the runtime image's install_pxe_stack() routine.
-
- Return to caller.
-
-The runtime image's setup() routine will perform the following steps:
-
- Switch to the internal environment using an appropriate transition
- library. This will record the parameters of the external
- environment.
-
- Set up the internal environment: load a stack, and set up a GDT for
- virtual addressing if virtual addressing is to be used.
-
- Switch back to the external environment using the transition
- library. This will record the parameters of the internal
- environment.
-
-Once the setup() routine has returned, the internal environment has been
-set up ready for C code to run. The prefix can call C routines using
-a function from the transition library.
-
-The runtime image's arch_initialise() routine will perform the
-following steps:
-
- Zero the bss
-
- Initialise the console device(s) and print a welcome message.
-
- Obtain a memory map via the INT 15,E820 BIOS call or suitable
- fallback mechanism. [not done if libkir is being used]
-
- Relocate the runtime image to the top of high memory. [not done if
- libkir is being used]
-
- Install librm to base memory. [done only if librm is being used]
-
- Call initialise().
-
- Return to the prefix, setting registers to indicate to the prefix
- the new location of the transition library, if applicable. Which
- registers these are is specific to the transition library being
- used.
-
-Once the arch_initialise() routine has returned, the prefix will
-probably call arch_main().
diff --git a/gpxe/src/arch/i386/core/aout_loader.c b/gpxe/src/arch/i386/core/aout_loader.c
deleted file mode 100644
index f85620e9..00000000
--- a/gpxe/src/arch/i386/core/aout_loader.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* a.out */
-struct exec {
- unsigned long a_midmag; /* 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 */
-};
-
-struct aout_state {
- struct exec head;
- unsigned long curaddr;
- int segment; /* current segment number, -1 for none */
- unsigned long loc; /* start offset of current block */
- unsigned long skip; /* padding to be skipped to current segment */
- unsigned long toread; /* remaining data to be read in the segment */
-};
-
-static struct aout_state astate;
-
-static sector_t aout_download(unsigned char *data, unsigned int len, int eof);
-static inline os_download_t aout_probe(unsigned char *data, unsigned int len)
-{
- unsigned long start, mid, end, istart, iend;
- if (len < sizeof(astate.head)) {
- return 0;
- }
- memcpy(&astate.head, data, sizeof(astate.head));
- if ((astate.head.a_midmag & 0xffff) != 0x010BL) {
- return 0;
- }
-
- printf("(a.out");
- aout_freebsd_probe();
- printf(")... ");
- /* Check the aout image */
- start = astate.head.a_entry;
- mid = (((start + astate.head.a_text) + 4095) & ~4095) + astate.head.a_data;
- end = ((mid + 4095) & ~4095) + astate.head.a_bss;
- istart = 4096;
- iend = istart + (mid - start);
- if (!prep_segment(start, mid, end, istart, iend))
- return dead_download;
- astate.segment = -1;
- astate.loc = 0;
- astate.skip = 0;
- astate.toread = 0;
- return aout_download;
-}
-
-static sector_t aout_download(unsigned char *data, unsigned int len, int eof)
-{
- unsigned int offset; /* working offset in the current data block */
-
- offset = 0;
-
-#ifdef AOUT_LYNX_KDI
- astate.segment++;
- if (astate.segment == 0) {
- astate.curaddr = 0x100000;
- astate.head.a_entry = astate.curaddr + 0x20;
- }
- memcpy(phys_to_virt(astate.curaddr), data, len);
- astate.curaddr += len;
- return 0;
-#endif
-
- do {
- if (astate.segment != -1) {
- if (astate.skip) {
- if (astate.skip >= len - offset) {
- astate.skip -= len - offset;
- break;
- }
- offset += astate.skip;
- astate.skip = 0;
- }
-
- if (astate.toread) {
- if (astate.toread >= len - offset) {
- memcpy(phys_to_virt(astate.curaddr), data+offset,
- len - offset);
- astate.curaddr += len - offset;
- astate.toread -= len - offset;
- break;
- }
- memcpy(phys_to_virt(astate.curaddr), data+offset, astate.toread);
- offset += astate.toread;
- astate.toread = 0;
- }
- }
-
- /* Data left, but current segment finished - look for the next
- * segment. This is quite simple for a.out files. */
- astate.segment++;
- switch (astate.segment) {
- case 0:
- /* read text */
- astate.curaddr = astate.head.a_entry;
- astate.skip = 4096;
- astate.toread = astate.head.a_text;
- break;
- case 1:
- /* read data */
- /* skip and curaddr may be wrong, but I couldn't find
- * examples where this failed. There is no reasonable
- * documentation for a.out available. */
- astate.skip = ((astate.curaddr + 4095) & ~4095) - astate.curaddr;
- astate.curaddr = (astate.curaddr + 4095) & ~4095;
- astate.toread = astate.head.a_data;
- break;
- case 2:
- /* initialize bss and start kernel */
- astate.curaddr = (astate.curaddr + 4095) & ~4095;
- astate.skip = 0;
- astate.toread = 0;
- memset(phys_to_virt(astate.curaddr), '\0', astate.head.a_bss);
- goto aout_startkernel;
- default:
- break;
- }
- } while (offset < len);
-
- astate.loc += len;
-
- if (eof) {
- unsigned long entry;
-
-aout_startkernel:
- entry = astate.head.a_entry;
- done(1);
-
- aout_freebsd_boot();
-#ifdef AOUT_LYNX_KDI
- xstart32(entry);
-#endif
- printf("unexpected a.out variant\n");
- longjmp(restart_etherboot, -2);
- }
- return 0;
-}
diff --git a/gpxe/src/arch/i386/core/basemem_packet.c b/gpxe/src/arch/i386/core/basemem_packet.c
deleted file mode 100644
index d487cce3..00000000
--- a/gpxe/src/arch/i386/core/basemem_packet.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * Packet buffer in base memory. Used by various components which
- * need to pass packets to and from external real-mode code.
- *
- */
-
-#include <basemem_packet.h>
-
-#undef basemem_packet
-char __bss16_array ( basemem_packet, [BASEMEM_PACKET_LEN] );
diff --git a/gpxe/src/arch/i386/core/cpu.c b/gpxe/src/arch/i386/core/cpu.c
deleted file mode 100644
index c24fa4e6..00000000
--- a/gpxe/src/arch/i386/core/cpu.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <stdint.h>
-#include <string.h>
-#include <cpu.h>
-
-/** @file
- *
- * CPU identification
- *
- */
-
-/**
- * Test to see if CPU flag is changeable
- *
- * @v flag Flag to test
- * @ret can_change Flag is changeable
- */
-static inline int flag_is_changeable ( unsigned int flag ) {
- uint32_t f1, f2;
-
- __asm__ ( "pushfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "movl %0,%1\n\t"
- "xorl %2,%0\n\t"
- "pushl %0\n\t"
- "popfl\n\t"
- "pushfl\n\t"
- "popl %0\n\t"
- "popfl\n\t"
- : "=&r" ( f1 ), "=&r" ( f2 )
- : "ir" ( flag ) );
-
- return ( ( ( f1 ^ f2 ) & flag ) != 0 );
-}
-
-/**
- * Get CPU information
- *
- * @v cpu CPU information structure to fill in
- */
-void get_cpuinfo ( struct cpuinfo_x86 *cpu ) {
- unsigned int cpuid_level;
- unsigned int cpuid_extlevel;
- unsigned int discard_1, discard_2, discard_3;
-
- memset ( cpu, 0, sizeof ( *cpu ) );
-
- /* Check for CPUID instruction */
- if ( ! flag_is_changeable ( X86_EFLAGS_ID ) ) {
- DBG ( "CPUID not supported\n" );
- return;
- }
-
- /* Get features, if present */
- cpuid ( 0x00000000, &cpuid_level, &discard_1,
- &discard_2, &discard_3 );
- if ( cpuid_level >= 0x00000001 ) {
- cpuid ( 0x00000001, &discard_1, &discard_2,
- &discard_3, &cpu->features );
- } else {
- DBG ( "CPUID cannot return capabilities\n" );
- }
-
- /* Get 64-bit features, if present */
- cpuid ( 0x80000000, &cpuid_extlevel, &discard_1,
- &discard_2, &discard_3 );
- if ( ( cpuid_extlevel & 0xffff0000 ) == 0x80000000 ) {
- if ( cpuid_extlevel >= 0x80000001 ) {
- cpuid ( 0x80000001, &discard_1, &discard_2,
- &discard_3, &cpu->amd_features );
- }
- }
-}
diff --git a/gpxe/src/arch/i386/core/dumpregs.c b/gpxe/src/arch/i386/core/dumpregs.c
deleted file mode 100644
index 82dc2184..00000000
--- a/gpxe/src/arch/i386/core/dumpregs.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdio.h>
-#include <realmode.h>
-
-void __asmcall _dump_regs ( struct i386_all_regs *ix86 ) {
-
- __asm__ __volatile__ (
- TEXT16_CODE ( ".globl dump_regs\n\t"
- "\ndump_regs:\n\t"
- "pushl $_dump_regs\n\t"
- "pushw %%cs\n\t"
- "call prot_call\n\t"
- "addr32 leal 4(%%esp), %%esp\n\t"
- "ret\n\t" ) : : );
-
- printf ( "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
- "ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
- "CS=%04x SS=%04x DS=%04x ES=%04x FS=%04x GS=%04x\n",
- ix86->regs.eax, ix86->regs.ebx, ix86->regs.ecx,
- ix86->regs.edx, ix86->regs.esi, ix86->regs.edi,
- ix86->regs.ebp, ix86->regs.esp,
- ix86->segs.cs, ix86->segs.ss, ix86->segs.ds,
- ix86->segs.es, ix86->segs.fs, ix86->segs.gs );
-}
diff --git a/gpxe/src/arch/i386/core/freebsd_loader.c b/gpxe/src/arch/i386/core/freebsd_loader.c
deleted file mode 100644
index 464f6d93..00000000
--- a/gpxe/src/arch/i386/core/freebsd_loader.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/* bootinfo */
-#define BOOTINFO_VERSION 1
-#define NODEV (-1) /* non-existent device */
-#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
-#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
-#define PAGE_MASK (PAGE_SIZE-1)
-#define N_BIOS_GEOM 8
-
-struct bootinfo {
- unsigned int bi_version;
- const 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_pad[3];
- unsigned long bi_basemem;
- unsigned long bi_extmem;
- unsigned long bi_symtab;
- unsigned long bi_esymtab;
- /* Note that these are in the FreeBSD headers but were not here... */
- unsigned long bi_kernend; /* end of kernel space */
- unsigned long bi_envp; /* environment */
- unsigned long bi_modulep; /* preloaded modules */
-};
-
-static struct bootinfo bsdinfo;
-
-#ifdef ELF_IMAGE
-static Elf32_Shdr *shdr; /* To support the FreeBSD kludge! */
-static Address symtab_load;
-static Address symstr_load;
-static int symtabindex;
-static int symstrindex;
-#endif
-
-static enum {
- Unknown, Tagged, Aout, Elf, Aout_FreeBSD, Elf_FreeBSD,
-} image_type = Unknown;
-
-static unsigned int off;
-
-
-#ifdef ELF_IMAGE
-static void elf_freebsd_probe(void)
-{
- image_type = Elf;
- if ( (estate.e.elf32.e_entry & 0xf0000000) &&
- (estate.e.elf32.e_type == ET_EXEC))
- {
- image_type = Elf_FreeBSD;
- printf("/FreeBSD");
- off = -(estate.e.elf32.e_entry & 0xff000000);
- estate.e.elf32.e_entry += off;
- }
- /* Make sure we have a null to start with... */
- shdr = 0;
-
- /* Clear the symbol index values... */
- symtabindex = -1;
- symstrindex = -1;
-
- /* ...and the load addresses of the symbols */
- symtab_load = 0;
- symstr_load = 0;
-}
-
-static void elf_freebsd_fixup_segment(void)
-{
- if (image_type == Elf_FreeBSD) {
- estate.p.phdr32[estate.segment].p_paddr += off;
- }
-}
-
-static void elf_freebsd_find_segment_end(void)
-{
- /* Count the bytes read even for the last block
- * as we will need to know where the last block
- * ends in order to load the symbols correctly.
- * (plus it could be useful elsewhere...)
- * Note that we need to count the actual size,
- * not just the end of the disk image size.
- */
- estate.curaddr +=
- (estate.p.phdr32[estate.segment].p_memsz -
- estate.p.phdr32[estate.segment].p_filesz);
-}
-
-static int elf_freebsd_debug_loader(unsigned int offset)
-{
- /* No more segments to be loaded - time to start the
- * nasty state machine to support the loading of
- * FreeBSD debug symbols due to the fact that FreeBSD
- * uses/exports the kernel's debug symbols in order
- * to make much of the system work! Amazing (arg!)
- *
- * We depend on the fact that for the FreeBSD kernel,
- * there is only one section of debug symbols and that
- * the section is after all of the loaded sections in
- * the file. This assumes a lot but is somewhat required
- * to make this code not be too annoying. (Where do you
- * load symbols when the code has not loaded yet?)
- * Since this function is actually just a callback from
- * the network data transfer code, we need to be able to
- * work with the data as it comes in. There is no chance
- * for doing a seek other than forwards.
- *
- * The process we use is to first load the section
- * headers. Once they are loaded (shdr != 0) we then
- * look for where the symbol table and symbol table
- * strings are and setup some state that we found
- * them and fall into processing the first one (which
- * is the symbol table) and after that has been loaded,
- * we try the symbol strings. Note that the order is
- * actually required as the memory image depends on
- * the symbol strings being loaded starting at the
- * end of the symbol table. The kernel assumes this
- * layout of the image.
- *
- * At any point, if we get to the end of the load file
- * or the section requested is earlier in the file than
- * the current file pointer, we just end up falling
- * out of this and booting the kernel without this
- * information.
- */
-
- /* Make sure that the next address is long aligned... */
- /* Assumes size of long is a power of 2... */
- estate.curaddr = (estate.curaddr + sizeof(long) - 1) & ~(sizeof(long) - 1);
-
- /* If we have not yet gotten the shdr loaded, try that */
- if (shdr == 0)
- {
- estate.toread = estate.e.elf32.e_shnum * estate.e.elf32.e_shentsize;
- estate.skip = estate.e.elf32.e_shoff - (estate.loc + offset);
- if (estate.toread)
- {
-#if ELF_DEBUG
- printf("shdr *, size %lX, curaddr %lX\n",
- estate.toread, estate.curaddr);
-#endif
-
- /* Start reading at the curaddr and make that the shdr */
- shdr = (Elf32_Shdr *)phys_to_virt(estate.curaddr);
-
- /* Start to read... */
- return 1;
- }
- }
- else
- {
- /* We have the shdr loaded, check if we have found
- * the indexs where the symbols are supposed to be */
- if ((symtabindex == -1) && (symstrindex == -1))
- {
- int i;
- /* Make sure that the address is page aligned... */
- /* Symbols need to start in their own page(s)... */
- estate.curaddr = (estate.curaddr + 4095) & ~4095;
-
- /* Need to make new indexes... */
- for (i=0; i < estate.e.elf32.e_shnum; i++)
- {
- if (shdr[i].sh_type == SHT_SYMTAB)
- {
- int j;
- for (j=0; j < estate.e.elf32.e_phnum; j++)
- {
- /* Check only for loaded sections */
- if ((estate.p.phdr32[j].p_type | 0x80) == (PT_LOAD | 0x80))
- {
- /* Only the extra symbols */
- if ((shdr[i].sh_offset >= estate.p.phdr32[j].p_offset) &&
- ((shdr[i].sh_offset + shdr[i].sh_size) <=
- (estate.p.phdr32[j].p_offset + estate.p.phdr32[j].p_filesz)))
- {
- shdr[i].sh_offset=0;
- shdr[i].sh_size=0;
- break;
- }
- }
- }
- if ((shdr[i].sh_offset != 0) && (shdr[i].sh_size != 0))
- {
- symtabindex = i;
- symstrindex = shdr[i].sh_link;
- }
- }
- }
- }
-
- /* Check if we have a symbol table index and have not loaded it */
- if ((symtab_load == 0) && (symtabindex >= 0))
- {
- /* No symbol table yet? Load it first... */
-
- /* This happens to work out in a strange way.
- * If we are past the point in the file already,
- * we will skip a *large* number of bytes which
- * ends up bringing us to the end of the file and
- * an old (default) boot. Less code and lets
- * the state machine work in a cleaner way but this
- * is a nasty side-effect trick... */
- estate.skip = shdr[symtabindex].sh_offset - (estate.loc + offset);
-
- /* And we need to read this many bytes... */
- estate.toread = shdr[symtabindex].sh_size;
-
- if (estate.toread)
- {
-#if ELF_DEBUG
- printf("db sym, size %lX, curaddr %lX\n",
- estate.toread, estate.curaddr);
-#endif
- /* Save where we are loading this... */
- symtab_load = estate.curaddr;
-
- *((long *)phys_to_virt(estate.curaddr)) = estate.toread;
- estate.curaddr += sizeof(long);
-
- /* Start to read... */
- return 1;
- }
- }
- else if ((symstr_load == 0) && (symstrindex >= 0))
- {
- /* We have already loaded the symbol table, so
- * now on to the symbol strings... */
-
-
- /* Same nasty trick as above... */
- estate.skip = shdr[symstrindex].sh_offset - (estate.loc + offset);
-
- /* And we need to read this many bytes... */
- estate.toread = shdr[symstrindex].sh_size;
-
- if (estate.toread)
- {
-#if ELF_DEBUG
- printf("db str, size %lX, curaddr %lX\n",
- estate.toread, estate.curaddr);
-#endif
- /* Save where we are loading this... */
- symstr_load = estate.curaddr;
-
- *((long *)phys_to_virt(estate.curaddr)) = estate.toread;
- estate.curaddr += sizeof(long);
-
- /* Start to read... */
- return 1;
- }
- }
- }
- /* all done */
- return 0;
-}
-
-static void elf_freebsd_boot(unsigned long entry)
-{
- if (image_type != Elf_FreeBSD)
- return;
-
- memset(&bsdinfo, 0, sizeof(bsdinfo));
- bsdinfo.bi_basemem = meminfo.basememsize;
- bsdinfo.bi_extmem = meminfo.memsize;
- bsdinfo.bi_memsizes_valid = 1;
- bsdinfo.bi_version = BOOTINFO_VERSION;
- bsdinfo.bi_kernelname = virt_to_phys(KERNEL_BUF);
- bsdinfo.bi_nfs_diskless = NULL;
- bsdinfo.bi_size = sizeof(bsdinfo);
-#define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
- if(freebsd_kernel_env[0] != '\0'){
- freebsd_howto |= RB_BOOTINFO;
- bsdinfo.bi_envp = (unsigned long)freebsd_kernel_env;
- }
-
- /* Check if we have symbols loaded, and if so,
- * made the meta_data needed to pass those to
- * the kernel. */
- if ((symtab_load !=0) && (symstr_load != 0))
- {
- unsigned long *t;
-
- bsdinfo.bi_symtab = symtab_load;
-
- /* End of symbols (long aligned...) */
- /* Assumes size of long is a power of 2... */
- bsdinfo.bi_esymtab = (symstr_load +
- sizeof(long) +
- *((long *)phys_to_virt(symstr_load)) +
- sizeof(long) - 1) & ~(sizeof(long) - 1);
-
- /* Where we will build the meta data... */
- t = phys_to_virt(bsdinfo.bi_esymtab);
-
-#if ELF_DEBUG
- printf("Metadata at %lX\n",t);
-#endif
-
- /* Set up the pointer to the memory... */
- bsdinfo.bi_modulep = virt_to_phys(t);
-
- /* The metadata structure is an array of 32-bit
- * words where we store some information about the
- * system. This is critical, as FreeBSD now looks
- * only for the metadata for the extended symbol
- * information rather than in the bootinfo.
- */
- /* First, do the kernel name and the kernel type */
- /* Note that this assumed x86 byte order... */
-
- /* 'kernel\0\0' */
- *t++=MODINFO_NAME; *t++= 7; *t++=0x6E72656B; *t++=0x00006C65;
-
- /* 'elf kernel\0\0' */
- *t++=MODINFO_TYPE; *t++=11; *t++=0x20666C65; *t++=0x6E72656B; *t++ = 0x00006C65;
-
- /* Now the symbol start/end - note that they are
- * here in local/physical address - the Kernel
- * boot process will relocate the addresses. */
- *t++=MODINFOMD_SSYM | MODINFO_METADATA; *t++=sizeof(*t); *t++=bsdinfo.bi_symtab;
- *t++=MODINFOMD_ESYM | MODINFO_METADATA; *t++=sizeof(*t); *t++=bsdinfo.bi_esymtab;
-
- *t++=MODINFO_END; *t++=0; /* end of metadata */
-
- /* Since we have symbols we need to make
- * sure that the kernel knows its own end
- * of memory... It is not _end but after
- * the symbols and the metadata... */
- bsdinfo.bi_kernend = virt_to_phys(t);
-
- /* Signal locore.s that we have a valid bootinfo
- * structure that was completely filled in. */
- freebsd_howto |= 0x80000000;
- }
-
- xstart32(entry, freebsd_howto, NODEV, 0, 0, 0,
- virt_to_phys(&bsdinfo), 0, 0, 0);
- longjmp(restart_etherboot, -2);
-}
-#endif
-
-#ifdef AOUT_IMAGE
-static void aout_freebsd_probe(void)
-{
- image_type = Aout;
- if (((astate.head.a_midmag >> 16) & 0xffff) == 0) {
- /* Some other a.out variants have a different
- * value, and use other alignments (e.g. 1K),
- * not the 4K used by FreeBSD. */
- image_type = Aout_FreeBSD;
- printf("/FreeBSD");
- off = -(astate.head.a_entry & 0xff000000);
- astate.head.a_entry += off;
- }
-}
-
-static void aout_freebsd_boot(void)
-{
- if (image_type == Aout_FreeBSD) {
- memset(&bsdinfo, 0, sizeof(bsdinfo));
- bsdinfo.bi_basemem = meminfo.basememsize;
- bsdinfo.bi_extmem = meminfo.memsize;
- bsdinfo.bi_memsizes_valid = 1;
- bsdinfo.bi_version = BOOTINFO_VERSION;
- bsdinfo.bi_kernelname = virt_to_phys(KERNEL_BUF);
- bsdinfo.bi_nfs_diskless = NULL;
- bsdinfo.bi_size = sizeof(bsdinfo);
- xstart32(astate.head.a_entry, freebsd_howto, NODEV, 0, 0, 0,
- virt_to_phys(&bsdinfo), 0, 0, 0);
- longjmp(restart_etherboot, -2);
- }
-}
-#endif
diff --git a/gpxe/src/arch/i386/core/gdbidt.S b/gpxe/src/arch/i386/core/gdbidt.S
deleted file mode 100644
index cd8b38a9..00000000
--- a/gpxe/src/arch/i386/core/gdbidt.S
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Interrupt Descriptor Table (IDT) setup and interrupt handlers for GDB stub.
- */
-
-#include <librm.h>
-
-#define SIZEOF_I386_REGS 32
-#define SIZEOF_I386_FLAGS 4
-
-/****************************************************************************
- * Interrupt Descriptor Table
- ****************************************************************************
- */
- .section ".data16", "aw", @progbits
- .globl idtr
-idtr:
-idt_limit:
- .word idt_length - 1
-idt_base:
- .long 0
-
-/* IDT entries have the following format:
- * offset_lo, segment selector, flags, offset_hi
- *
- * Since it is not possible to specify relocations in arbitrary
- * expressions like (int_overflow & 0xffff), we initialise the
- * IDT with entries in an incorrect format.
- *
- * The entries are shuffled into the correct format in init_librm().
- */
-#define IDT_ENTRY_EMPTY(name) .word 0, 0, 0, 0
-#define IDT_ENTRY_PRESENT(name) \
- .long int_##name; \
- .word 0x8e00, VIRTUAL_CS
-
-.align 16
-idt:
- IDT_ENTRY_PRESENT(divide_error)
- IDT_ENTRY_PRESENT(debug_trap)
- IDT_ENTRY_EMPTY(non_maskable_interrupt)
- IDT_ENTRY_PRESENT(breakpoint)
- IDT_ENTRY_PRESENT(overflow)
- IDT_ENTRY_PRESENT(bound_range_exceeded)
- IDT_ENTRY_PRESENT(invalid_opcode)
- IDT_ENTRY_EMPTY(device_not_available)
- IDT_ENTRY_PRESENT(double_fault)
- IDT_ENTRY_EMPTY(coprocessor_segment_overrun)
- IDT_ENTRY_PRESENT(invalid_tss)
- IDT_ENTRY_PRESENT(segment_not_present)
- IDT_ENTRY_PRESENT(stack_segment_fault)
- IDT_ENTRY_PRESENT(general_protection)
- IDT_ENTRY_PRESENT(page_fault)
-idt_end:
- .equ idt_length, idt_end - idt
-
-/* The IDT entries are fixed up (once) in init_librm() */
-idt_fixed:
- .byte 0
-
-/****************************************************************************
- * idt_init (real-mode near call, 16-bit real-mode near return address)
- *
- * Initialise the IDT, called from init_librm.
- *
- * Parameters:
- * %eax : IDT base address
- *
- * Destroys %ax, %bx, and %di.
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
- .code16
- .globl idt_init
-idt_init:
- movl %eax, idt_base
- addl $idt, idt_base
-
- /* IDT entries are only fixed up once */
- movb idt_fixed, %al
- orb %al, %al
- jnz 2f
- movb $1, idt_fixed
-
- /* Shuffle IDT entries into the correct format */
- movb $(idt_length / 8), %al
- movw $idt, %bx
- or %al, %al
- jz 2f
-1:
- movw 2(%bx), %di
- xchg %di, 6(%bx)
- movw %di, 2(%bx)
- addw $8, %bx
- dec %al
- jnz 1b
-2:
- ret
-
-/****************************************************************************
- * Interrupt handlers
- ****************************************************************************
- */
- .section ".text", "ax", @progbits
- .code32
-
-/* POSIX signal numbers for reporting traps to GDB */
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGBUS 7
-#define SIGFPE 8
-#define SIGSEGV 11
-#define SIGSTKFLT 16
-
-int_divide_error:
- pushl $SIGFPE
- jmp do_interrupt
-
-int_debug_trap:
-int_breakpoint:
- pushl $SIGTRAP
- jmp do_interrupt
-
-int_overflow:
-int_bound_range_exceeded:
- pushl $SIGSTKFLT
- jmp do_interrupt
-
-int_invalid_opcode:
- pushl $SIGILL
- jmp do_interrupt
-
-int_double_fault:
- movl $SIGBUS, (%esp)
- jmp do_interrupt
-
-int_invalid_tss:
-int_segment_not_present:
-int_stack_segment_fault:
-int_general_protection:
-int_page_fault:
- movl $SIGSEGV, (%esp)
- jmp do_interrupt
-
-/* When invoked, the stack contains: eflags, cs, eip, signo. */
-#define IH_OFFSET_GDB_REGS ( 0 )
-#define IH_OFFSET_GDB_EIP ( IH_OFFSET_GDB_REGS + SIZEOF_I386_REGS )
-#define IH_OFFSET_GDB_EFLAGS ( IH_OFFSET_GDB_EIP + 4 )
-#define IH_OFFSET_GDB_SEG_REGS ( IH_OFFSET_GDB_EFLAGS + SIZEOF_I386_FLAGS )
-#define IH_OFFSET_GDB_END ( IH_OFFSET_GDB_SEG_REGS + 6 * 4 )
-#define IH_OFFSET_SIGNO ( IH_OFFSET_GDB_END )
-#define IH_OFFSET_OLD_EIP ( IH_OFFSET_SIGNO + 4 )
-#define IH_OFFSET_OLD_CS ( IH_OFFSET_OLD_EIP + 4 )
-#define IH_OFFSET_OLD_EFLAGS ( IH_OFFSET_OLD_CS + 4 )
-#define IH_OFFSET_END ( IH_OFFSET_OLD_EFLAGS + 4 )
-
-/* We also access the stack whilst still storing or restoring
- * the register snapshot. Since ESP is in flux, we need
- * special offsets.
- */
-#define IH_OFFSET_FLUX_OLD_CS ( IH_OFFSET_OLD_CS - 44 )
-#define IH_OFFSET_FLUX_OLD_EFLAGS ( IH_OFFSET_OLD_EFLAGS - 40 )
-#define IH_OFFSET_FLUX_OLD_EIP ( IH_OFFSET_OLD_EIP - 36 )
-#define IH_OFFSET_FLUX_END ( IH_OFFSET_END - 20 )
-do_interrupt:
- /* Store CPU state in GDB register snapshot */
- pushw $0
- pushw %gs
- pushw $0
- pushw %fs
- pushw $0
- pushw %es
- pushw $0
- pushw %ds
- pushw $0
- pushw %ss
- pushw $0
- pushw IH_OFFSET_FLUX_OLD_CS + 2(%esp)
- pushl IH_OFFSET_FLUX_OLD_EFLAGS(%esp)
- pushl IH_OFFSET_FLUX_OLD_EIP(%esp)
- pushl %edi
- pushl %esi
- pushl %ebp
- leal IH_OFFSET_FLUX_END(%esp), %edi
- pushl %edi /* old ESP */
- pushl %ebx
- pushl %edx
- pushl %ecx
- pushl %eax
-
- /* Call GDB stub exception handler */
- pushl %esp
- pushl (IH_OFFSET_SIGNO + 4)(%esp)
- call gdbmach_handler
- addl $8, %esp
-
- /* Restore CPU state from GDB register snapshot */
- popl %eax
- popl %ecx
- popl %edx
- popl %ebx
- addl $4, %esp /* Changing ESP currently not supported */
- popl %ebp
- popl %esi
- popl %edi
- popl IH_OFFSET_FLUX_OLD_EIP(%esp)
- popl IH_OFFSET_FLUX_OLD_EFLAGS(%esp)
- popl IH_OFFSET_FLUX_OLD_CS(%esp)
- popl %ss
- popl %ds
- popl %es
- popl %fs
- popl %gs
-
- addl $4, %esp /* drop signo */
- iret
diff --git a/gpxe/src/arch/i386/core/gdbmach.c b/gpxe/src/arch/i386/core/gdbmach.c
deleted file mode 100644
index 97827ecb..00000000
--- a/gpxe/src/arch/i386/core/gdbmach.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2008 Stefan Hajnoczi <stefanha@gmail.com>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You 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 <stddef.h>
-#include <stdio.h>
-#include <assert.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/gdbstub.h>
-#include <gdbmach.h>
-
-/** @file
- *
- * GDB architecture-specific bits for i386
- *
- */
-
-enum {
- DR7_CLEAR = 0x00000400, /* disable hardware breakpoints */
- DR6_CLEAR = 0xffff0ff0, /* clear breakpoint status */
-};
-
-/** Hardware breakpoint, fields stored in x86 bit pattern form */
-struct hwbp {
- int type; /* type (1=write watchpoint, 3=access watchpoint) */
- unsigned long addr; /* linear address */
- size_t len; /* length (0=1-byte, 1=2-byte, 3=4-byte) */
- int enabled;
-};
-
-static struct hwbp hwbps [ 4 ];
-static gdbreg_t dr7 = DR7_CLEAR;
-
-static struct hwbp *gdbmach_find_hwbp ( int type, unsigned long addr, size_t len ) {
- struct hwbp *available = NULL;
- unsigned int i;
- for ( i = 0; i < sizeof hwbps / sizeof hwbps [ 0 ]; i++ ) {
- if ( hwbps [ i ].type == type && hwbps [ i ].addr == addr && hwbps [ i ].len == len ) {
- return &hwbps [ i ];
- }
- if ( !hwbps [ i ].enabled ) {
- available = &hwbps [ i ];
- }
- }
- return available;
-}
-
-static void gdbmach_commit_hwbp ( struct hwbp *bp ) {
- unsigned int regnum = bp - hwbps;
-
- /* Set breakpoint address */
- assert ( regnum < ( sizeof hwbps / sizeof hwbps [ 0 ] ) );
- switch ( regnum ) {
- case 0:
- __asm__ __volatile__ ( "movl %0, %%dr0\n" : : "r" ( bp->addr ) );
- break;
- case 1:
- __asm__ __volatile__ ( "movl %0, %%dr1\n" : : "r" ( bp->addr ) );
- break;
- case 2:
- __asm__ __volatile__ ( "movl %0, %%dr2\n" : : "r" ( bp->addr ) );
- break;
- case 3:
- __asm__ __volatile__ ( "movl %0, %%dr3\n" : : "r" ( bp->addr ) );
- break;
- }
-
- /* Set type */
- dr7 &= ~( 0x3 << ( 16 + 4 * regnum ) );
- dr7 |= bp->type << ( 16 + 4 * regnum );
-
- /* Set length */
- dr7 &= ~( 0x3 << ( 18 + 4 * regnum ) );
- dr7 |= bp->len << ( 18 + 4 * regnum );
-
- /* Set/clear local enable bit */
- dr7 &= ~( 0x3 << 2 * regnum );
- dr7 |= bp->enabled << 2 * regnum;
-}
-
-int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable ) {
- struct hwbp *bp;
-
- /* Check and convert breakpoint type to x86 type */
- switch ( type ) {
- case GDBMACH_WATCH:
- type = 0x1;
- break;
- case GDBMACH_AWATCH:
- type = 0x3;
- break;
- default:
- return 0; /* unsupported breakpoint type */
- }
-
- /* Only lengths 1, 2, and 4 are supported */
- if ( len != 2 && len != 4 ) {
- len = 1;
- }
- len--; /* convert to x86 breakpoint length bit pattern */
-
- /* Calculate linear address by adding segment base */
- addr += virt_offset;
-
- /* Set up the breakpoint */
- bp = gdbmach_find_hwbp ( type, addr, len );
- if ( !bp ) {
- return 0; /* ran out of hardware breakpoints */
- }
- bp->type = type;
- bp->addr = addr;
- bp->len = len;
- bp->enabled = enable;
- gdbmach_commit_hwbp ( bp );
- return 1;
-}
-
-static void gdbmach_disable_hwbps ( void ) {
- /* Store and clear hardware breakpoints */
- __asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( DR7_CLEAR ) );
-}
-
-static void gdbmach_enable_hwbps ( void ) {
- /* Clear breakpoint status register */
- __asm__ __volatile__ ( "movl %0, %%dr6\n" : : "r" ( DR6_CLEAR ) );
-
- /* Restore hardware breakpoints */
- __asm__ __volatile__ ( "movl %0, %%dr7\n" : : "r" ( dr7 ) );
-}
-
-__asmcall void gdbmach_handler ( int signo, gdbreg_t *regs ) {
- gdbmach_disable_hwbps();
- gdbstub_handler ( signo, regs );
- gdbmach_enable_hwbps();
-}
diff --git a/gpxe/src/arch/i386/core/nulltrap.c b/gpxe/src/arch/i386/core/nulltrap.c
deleted file mode 100644
index 3046fbec..00000000
--- a/gpxe/src/arch/i386/core/nulltrap.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <stdint.h>
-#include <stdio.h>
-
-__attribute__ (( noreturn, section ( ".text.null_trap" ) ))
-void null_function_trap ( void ) {
- void *stack;
-
- /* 128 bytes of NOPs; the idea of this is that if something
- * dereferences a NULL pointer and overwrites us, we at least
- * have some chance of still getting to execute the printf()
- * statement.
- */
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
- __asm__ __volatile__ ( "nop ; nop ; nop ; nop" );
-
- __asm__ __volatile__ ( "movl %%esp, %0" : "=r" ( stack ) );
- printf ( "NULL method called from %p (stack %p)\n",
- __builtin_return_address ( 0 ), stack );
- DBG_HD ( stack, 256 );
- while ( 1 ) {}
-}
diff --git a/gpxe/src/arch/i386/core/pic8259.c b/gpxe/src/arch/i386/core/pic8259.c
deleted file mode 100644
index 1e2d23c5..00000000
--- a/gpxe/src/arch/i386/core/pic8259.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/io.h>
-#include <pic8259.h>
-
-/** @file
- *
- * Minimal support for the 8259 Programmable Interrupt Controller
- *
- */
-
-/**
- * Send non-specific EOI(s)
- *
- * @v irq IRQ number
- *
- * This seems to be inherently unsafe.
- */
-static inline void send_nonspecific_eoi ( unsigned int irq ) {
- DBG ( "Sending non-specific EOI for IRQ %d\n", irq );
- if ( irq >= IRQ_PIC_CUTOFF ) {
- outb ( ICR_EOI_NON_SPECIFIC, PIC2_ICR );
- }
- outb ( ICR_EOI_NON_SPECIFIC, PIC1_ICR );
-}
-
-/**
- * Send specific EOI(s)
- *
- * @v irq IRQ number
- */
-static inline void send_specific_eoi ( unsigned int irq ) {
- DBG ( "Sending specific EOI for IRQ %d\n", irq );
- if ( irq >= IRQ_PIC_CUTOFF ) {
- outb ( ( ICR_EOI_SPECIFIC | ICR_VALUE ( CHAINED_IRQ ) ),
- ICR_REG ( CHAINED_IRQ ) );
- }
- outb ( ( ICR_EOI_SPECIFIC | ICR_VALUE ( irq ) ), ICR_REG ( irq ) );
-}
-
-/**
- * Send End-Of-Interrupt to the PIC
- *
- * @v irq IRQ number
- */
-void send_eoi ( unsigned int irq ) {
- send_specific_eoi ( irq );
-}
diff --git a/gpxe/src/arch/i386/core/rdtsc_timer.c b/gpxe/src/arch/i386/core/rdtsc_timer.c
deleted file mode 100644
index 76679173..00000000
--- a/gpxe/src/arch/i386/core/rdtsc_timer.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/** @file
- *
- * RDTSC timer
- *
- */
-
-#include <assert.h>
-#include <gpxe/timer.h>
-#include <gpxe/timer2.h>
-
-/**
- * Number of TSC ticks per microsecond
- *
- * This is calibrated on the first use of the timer.
- */
-static unsigned long rdtsc_ticks_per_usec;
-
-/**
- * Delay for a fixed number of microseconds
- *
- * @v usecs Number of microseconds for which to delay
- */
-static void rdtsc_udelay ( unsigned long usecs ) {
- unsigned long start;
- unsigned long elapsed;
-
- /* Sanity guard, since we may divide by this */
- if ( ! usecs )
- usecs = 1;
-
- start = currticks();
- if ( rdtsc_ticks_per_usec ) {
- /* Already calibrated; busy-wait until done */
- do {
- elapsed = ( currticks() - start );
- } while ( elapsed < ( usecs * rdtsc_ticks_per_usec ) );
- } else {
- /* Not yet calibrated; use timer2 and calibrate
- * based on result.
- */
- timer2_udelay ( usecs );
- elapsed = ( currticks() - start );
- rdtsc_ticks_per_usec = ( elapsed / usecs );
- DBG ( "RDTSC timer calibrated: %ld ticks in %ld usecs "
- "(%ld MHz)\n", elapsed, usecs,
- ( rdtsc_ticks_per_usec << TSC_SHIFT ) );
- }
-}
-
-/**
- * Get number of ticks per second
- *
- * @ret ticks_per_sec Number of ticks per second
- */
-static unsigned long rdtsc_ticks_per_sec ( void ) {
-
- /* Calibrate timer, if not already done */
- if ( ! rdtsc_ticks_per_usec )
- udelay ( 1 );
-
- /* Sanity check */
- assert ( rdtsc_ticks_per_usec != 0 );
-
- return ( rdtsc_ticks_per_usec * 1000 * 1000 );
-}
-
-PROVIDE_TIMER ( rdtsc, udelay, rdtsc_udelay );
-PROVIDE_TIMER_INLINE ( rdtsc, currticks );
-PROVIDE_TIMER ( rdtsc, ticks_per_sec, rdtsc_ticks_per_sec );
diff --git a/gpxe/src/arch/i386/core/relocate.c b/gpxe/src/arch/i386/core/relocate.c
deleted file mode 100644
index 44e764fe..00000000
--- a/gpxe/src/arch/i386/core/relocate.c
+++ /dev/null
@@ -1,170 +0,0 @@
-#include <gpxe/io.h>
-#include <registers.h>
-#include <gpxe/memmap.h>
-
-/*
- * Originally by Eric Biederman
- *
- * Heavily modified by Michael Brown
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/*
- * The linker passes in the symbol _max_align, which is the alignment
- * that we must preserve, in bytes.
- *
- */
-extern char _max_align[];
-#define max_align ( ( unsigned int ) _max_align )
-
-/* Linker symbols */
-extern char _textdata[];
-extern char _etextdata[];
-
-/* within 1MB of 4GB is too close.
- * MAX_ADDR is the maximum address we can easily do DMA to.
- *
- * Not sure where this constraint comes from, but kept it from Eric's
- * old code - mcb30
- */
-#define MAX_ADDR (0xfff00000UL)
-
-/**
- * Relocate Etherboot
- *
- * @v ix86 x86 register dump from prefix
- * @ret ix86 x86 registers to return to prefix
- *
- * This finds a suitable location for Etherboot near the top of 32-bit
- * address space, and returns the physical address of the new location
- * to the prefix in %edi.
- */
-__asmcall void relocate ( struct i386_all_regs *ix86 ) {
- struct memory_map memmap;
- unsigned long start, end, size, padded_size;
- unsigned long new_start, new_end;
- unsigned i;
-
- /* Get memory map and current location */
- get_memmap ( &memmap );
- start = virt_to_phys ( _textdata );
- end = virt_to_phys ( _etextdata );
- size = ( end - start );
- padded_size = ( size + max_align - 1 );
-
- DBG ( "Relocate: currently at [%lx,%lx)\n"
- "...need %lx bytes for %d-byte alignment\n",
- start, end, padded_size, max_align );
-
- /* Walk through the memory map and find the highest address
- * below 4GB that etherboot will fit into. Ensure etherboot
- * lies entirely within a range with A20=0. This means that
- * even if something screws up the state of the A20 line, the
- * etherboot code is still visible and we have a chance to
- * diagnose the problem.
- */
- new_end = end;
- for ( i = 0 ; i < memmap.count ; i++ ) {
- struct memory_region *region = &memmap.regions[i];
- unsigned long r_start, r_end;
-
- DBG ( "Considering [%llx,%llx)\n", region->start, region->end);
-
- /* Truncate block to MAX_ADDR. This will be less than
- * 4GB, which means that we can get away with using
- * just 32-bit arithmetic after this stage.
- */
- if ( region->start > MAX_ADDR ) {
- DBG ( "...starts after MAX_ADDR=%lx\n", MAX_ADDR );
- continue;
- }
- r_start = region->start;
- if ( region->end > MAX_ADDR ) {
- DBG ( "...end truncated to MAX_ADDR=%lx\n", MAX_ADDR );
- r_end = MAX_ADDR;
- } else {
- r_end = region->end;
- }
-
- /* Shrink the range down to use only even megabytes
- * (i.e. A20=0).
- */
- if ( ( r_end - 1 ) & 0x100000 ) {
- /* If last byte that might be used (r_end-1)
- * is in an odd megabyte, round down r_end to
- * the top of the next even megabyte.
- *
- * Make sure that we don't accidentally wrap
- * r_end below 0.
- */
- if ( r_end >= 1 ) {
- r_end = ( r_end - 1 ) & ~0xfffff;
- DBG ( "...end truncated to %lx "
- "(avoid ending in odd megabyte)\n",
- r_end );
- }
- } else if ( ( r_end - size ) & 0x100000 ) {
- /* If the last byte that might be used
- * (r_end-1) is in an even megabyte, but the
- * first byte that might be used (r_end-size)
- * is an odd megabyte, round down to the top
- * of the next even megabyte.
- *
- * Make sure that we don't accidentally wrap
- * r_end below 0.
- */
- if ( r_end >= 0x100000 ) {
- r_end = ( r_end - 0x100000 ) & ~0xfffff;
- DBG ( "...end truncated to %lx "
- "(avoid starting in odd megabyte)\n",
- r_end );
- }
- }
-
- DBG ( "...usable portion is [%lx,%lx)\n", r_start, r_end );
-
- /* If we have rounded down r_end below r_ start, skip
- * this block.
- */
- if ( r_end < r_start ) {
- DBG ( "...truncated to negative size\n" );
- continue;
- }
-
- /* Check that there is enough space to fit in Etherboot */
- if ( ( r_end - r_start ) < size ) {
- DBG ( "...too small (need %lx bytes)\n", size );
- continue;
- }
-
- /* If the start address of the Etherboot we would
- * place in this block is higher than the end address
- * of the current highest block, use this block.
- *
- * Note that this avoids overlaps with the current
- * Etherboot, as well as choosing the highest of all
- * viable blocks.
- */
- if ( ( r_end - size ) > new_end ) {
- new_end = r_end;
- DBG ( "...new best block found.\n" );
- }
- }
-
- /* Calculate new location of Etherboot, and align it to the
- * required alignemnt.
- */
- new_start = new_end - padded_size;
- new_start += ( start - new_start ) & ( max_align - 1 );
- new_end = new_start + size;
-
- DBG ( "Relocating from [%lx,%lx) to [%lx,%lx)\n",
- start, end, new_start, new_end );
-
- /* Let prefix know what to copy */
- ix86->regs.esi = start;
- ix86->regs.edi = new_start;
- ix86->regs.ecx = size;
-}
diff --git a/gpxe/src/arch/i386/core/setjmp.S b/gpxe/src/arch/i386/core/setjmp.S
deleted file mode 100644
index 03727148..00000000
--- a/gpxe/src/arch/i386/core/setjmp.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/* setjmp and longjmp. Use of these functions is deprecated. */
-
-FILE_LICENCE ( GPL2_OR_LATER )
-
- .text
- .arch i386
- .code32
-
-/**************************************************************************
-SETJMP - Save stack context for non-local goto
-**************************************************************************/
- .globl setjmp
-setjmp:
- movl 4(%esp),%ecx /* jmpbuf */
- movl 0(%esp),%edx /* return address */
- movl %edx,0(%ecx)
- movl %ebx,4(%ecx)
- movl %esp,8(%ecx)
- movl %ebp,12(%ecx)
- movl %esi,16(%ecx)
- movl %edi,20(%ecx)
- movl $0,%eax
- ret
-
-/**************************************************************************
-LONGJMP - Non-local jump to a saved stack context
-**************************************************************************/
- .globl longjmp
-longjmp:
- movl 4(%esp),%edx /* jumpbuf */
- movl 8(%esp),%eax /* result */
- movl 0(%edx),%ecx
- movl 4(%edx),%ebx
- movl 8(%edx),%esp
- movl 12(%edx),%ebp
- movl 16(%edx),%esi
- movl 20(%edx),%edi
- cmpl $0,%eax
- jne 1f
- movl $1,%eax
-1: movl %ecx,0(%esp)
- ret
diff --git a/gpxe/src/arch/i386/core/stack.S b/gpxe/src/arch/i386/core/stack.S
deleted file mode 100644
index 737ec0ee..00000000
--- a/gpxe/src/arch/i386/core/stack.S
+++ /dev/null
@@ -1,15 +0,0 @@
-FILE_LICENCE ( GPL2_OR_LATER )
-
- .arch i386
-
-/****************************************************************************
- * Internal stack
- ****************************************************************************
- */
- .section ".stack", "aw", @nobits
- .align 8
- .globl _stack
-_stack:
- .space 4096
- .globl _estack
-_estack:
diff --git a/gpxe/src/arch/i386/core/stack16.S b/gpxe/src/arch/i386/core/stack16.S
deleted file mode 100644
index 523f0288..00000000
--- a/gpxe/src/arch/i386/core/stack16.S
+++ /dev/null
@@ -1,15 +0,0 @@
-FILE_LICENCE ( GPL2_OR_LATER )
-
- .arch i386
-
-/****************************************************************************
- * Internal stack
- ****************************************************************************
- */
- .section ".stack16", "aw", @nobits
- .align 8
- .globl _stack16
-_stack16:
- .space 4096
- .globl _estack16
-_estack16:
diff --git a/gpxe/src/arch/i386/core/timer2.c b/gpxe/src/arch/i386/core/timer2.c
deleted file mode 100644
index 6e76b2eb..00000000
--- a/gpxe/src/arch/i386/core/timer2.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * arch/i386/core/i386_timer.c
- *
- * Use the "System Timer 2" to implement the udelay callback in
- * the BIOS timer driver. Also used to calibrate the clock rate
- * in the RTDSC timer driver.
- *
- * This program is free software; you can redistribute 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.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stddef.h>
-#include <gpxe/timer2.h>
-#include <gpxe/io.h>
-
-/* Timers tick over at this rate */
-#define TIMER2_TICKS_PER_SEC 1193180U
-
-/* 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 */
-
-/* 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
-
-static 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);
-}
-
-void timer2_udelay ( unsigned long usecs ) {
- load_timer2 ( ( usecs * TIMER2_TICKS_PER_SEC ) / ( 1000 * 1000 ) );
- while (timer2_running()) {
- /* Do nothing */
- }
-}
diff --git a/gpxe/src/arch/i386/core/video_subr.c b/gpxe/src/arch/i386/core/video_subr.c
deleted file mode 100644
index c821cd02..00000000
--- a/gpxe/src/arch/i386/core/video_subr.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *
- * modified from linuxbios code
- * by Cai Qiang <rimy2000@hotmail.com>
- *
- */
-
-#include "stddef.h"
-#include "string.h"
-#include <gpxe/io.h>
-#include "console.h"
-#include <gpxe/init.h>
-#include "vga.h"
-
-struct console_driver vga_console;
-
-static char *vidmem; /* The video buffer */
-static int video_line, video_col;
-
-#define VIDBUFFER 0xB8000
-
-static void memsetw(void *s, int c, unsigned int n)
-{
- unsigned int i;
- u16 *ss = (u16 *) s;
-
- for (i = 0; i < n; i++) {
- ss[i] = ( u16 ) c;
- }
-}
-
-static void video_init(void)
-{
- static int inited=0;
-
- vidmem = (char *)phys_to_virt(VIDBUFFER);
-
- if (!inited) {
- video_line = 0;
- video_col = 0;
-
- memsetw(vidmem, VGA_ATTR_CLR_WHT, 2*1024); //
-
- inited=1;
- }
-}
-
-static void video_scroll(void)
-{
- int i;
-
- memcpy(vidmem, vidmem + COLS * 2, (LINES - 1) * COLS * 2);
- for (i = (LINES - 1) * COLS * 2; i < LINES * COLS * 2; i += 2)
- vidmem[i] = ' ';
-}
-
-static void vga_putc(int byte)
-{
- if (byte == '\n') {
- video_line++;
- video_col = 0;
-
- } else if (byte == '\r') {
- video_col = 0;
-
- } else if (byte == '\b') {
- video_col--;
-
- } else if (byte == '\t') {
- video_col += 4;
-
- } else if (byte == '\a') {
- //beep
- //beep(500);
-
- } else {
- vidmem[((video_col + (video_line *COLS)) * 2)] = byte;
- vidmem[((video_col + (video_line *COLS)) * 2) +1] = VGA_ATTR_CLR_WHT;
- video_col++;
- }
- if (video_col < 0) {
- video_col = 0;
- }
- if (video_col >= COLS) {
- video_line++;
- video_col = 0;
- }
- if (video_line >= LINES) {
- video_scroll();
- video_line--;
- }
- // move the cursor
- write_crtc((video_col + (video_line *COLS)) >> 8, CRTC_CURSOR_HI);
- write_crtc((video_col + (video_line *COLS)) & 0x0ff, CRTC_CURSOR_LO);
-}
-
-struct console_driver vga_console __console_driver = {
- .putchar = vga_putc,
- .disabled = 1,
-};
-
-struct init_fn video_init_fn __init_fn ( INIT_EARLY ) = {
- .initialise = video_init,
-};
diff --git a/gpxe/src/arch/i386/core/virtaddr.S b/gpxe/src/arch/i386/core/virtaddr.S
deleted file mode 100644
index aae1e1ed..00000000
--- a/gpxe/src/arch/i386/core/virtaddr.S
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Functions to support the virtual addressing method of relocation
- * that Etherboot uses.
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER )
-
-#include "librm.h"
-
- .arch i386
- .text
- .code32
-
-/****************************************************************************
- * _virt_to_phys (virtual addressing)
- *
- * Switch from virtual to flat physical addresses. %esp is adjusted
- * to a physical value. Segment registers are set to flat physical
- * selectors. All other registers are preserved. Flags are
- * preserved.
- *
- * Parameters: none
- * Returns: none
- ****************************************************************************
- */
- .globl _virt_to_phys
-_virt_to_phys:
- /* Preserve registers and flags */
- pushfl
- pushl %eax
- pushl %ebp
-
- /* Change return address to a physical address */
- movl virt_offset, %ebp
- addl %ebp, 12(%esp)
-
- /* Switch to physical code segment */
- pushl $PHYSICAL_CS
- leal 1f(%ebp), %eax
- pushl %eax
- lret
-1:
- /* Reload other segment registers and adjust %esp */
- movl $PHYSICAL_DS, %eax
- movl %eax, %ds
- movl %eax, %es
- movl %eax, %fs
- movl %eax, %gs
- movl %eax, %ss
- addl %ebp, %esp
-
- /* Restore registers and flags, and return */
- popl %ebp
- popl %eax
- popfl
- ret
-
-/****************************************************************************
- * _phys_to_virt (flat physical addressing)
- *
- * Switch from flat physical to virtual addresses. %esp is adjusted
- * to a virtual value. Segment registers are set to virtual
- * selectors. All other registers are preserved. Flags are
- * preserved.
- *
- * Note that this depends on the GDT already being correctly set up
- * (e.g. by a call to run_here()).
- *
- * Parameters: none
- * Returns: none
- ****************************************************************************
- */
- .globl _phys_to_virt
-_phys_to_virt:
- /* Preserve registers and flags */
- pushfl
- pushl %eax
- pushl %ebp
-
- /* Switch to virtual code segment */
- ljmp $VIRTUAL_CS, $1f
-1:
- /* Reload data segment registers */
- movl $VIRTUAL_DS, %eax
- movl %eax, %ds
- movl %eax, %es
- movl %eax, %fs
- movl %eax, %gs
-
- /* Reload stack segment and adjust %esp */
- movl virt_offset, %ebp
- movl %eax, %ss
- subl %ebp, %esp
-
- /* Change the return address to a virtual address */
- subl %ebp, 12(%esp)
-
- /* Restore registers and flags, and return */
- popl %ebp
- popl %eax
- popfl
- ret
diff --git a/gpxe/src/arch/i386/core/wince_loader.c b/gpxe/src/arch/i386/core/wince_loader.c
deleted file mode 100644
index f452b659..00000000
--- a/gpxe/src/arch/i386/core/wince_loader.c
+++ /dev/null
@@ -1,273 +0,0 @@
-#define LOAD_DEBUG 0
-
-static int get_x_header(unsigned char *data, unsigned long now);
-static void jump_2ep();
-static unsigned char ce_signature[] = {'B', '0', '0', '0', 'F', 'F', '\n',};
-static char ** ep;
-
-#define BOOT_ARG_PTR_LOCATION 0x001FFFFC
-
-typedef struct _BOOT_ARGS{
- unsigned char ucVideoMode;
- unsigned char ucComPort;
- unsigned char ucBaudDivisor;
- unsigned char ucPCIConfigType;
-
- unsigned long dwSig;
- #define BOOTARG_SIG 0x544F4F42
- unsigned long dwLen;
-
- unsigned char ucLoaderFlags;
- unsigned char ucEshellFlags;
- unsigned char ucEdbgAdapterType;
- unsigned char ucEdbgIRQ;
-
- unsigned long dwEdbgBaseAddr;
- unsigned long dwEdbgDebugZone;
- unsigned long dwDHCPLeaseTime;
- unsigned long dwEdbgFlags;
-
- unsigned long dwEBootFlag;
- unsigned long dwEBootAddr;
- unsigned long dwLaunchAddr;
-
- unsigned long pvFlatFrameBuffer;
- unsigned short vesaMode;
- unsigned short cxDisplayScreen;
- unsigned short cyDisplayScreen;
- unsigned short cxPhysicalScreen;
- unsigned short cyPhysicalScreen;
- unsigned short cbScanLineLength;
- unsigned short bppScreen;
-
- unsigned char RedMaskSize;
- unsigned char REdMaskPosition;
- unsigned char GreenMaskSize;
- unsigned char GreenMaskPosition;
- unsigned char BlueMaskSize;
- unsigned char BlueMaskPosition;
-} BOOT_ARGS;
-
-BOOT_ARGS BootArgs;
-
-static struct segment_info{
- unsigned long addr; // Section Address
- unsigned long size; // Section Size
- unsigned long checksum; // Section CheckSum
-} X;
-
-#define PSIZE (1500) //Max Packet Size
-#define DSIZE (PSIZE+12)
-static unsigned long dbuffer_available =0;
-static unsigned long not_loadin =0;
-static unsigned long d_now =0;
-
-unsigned long entry;
-static unsigned long ce_curaddr;
-
-
-static sector_t ce_loader(unsigned char *data, unsigned int len, int eof);
-static os_download_t wince_probe(unsigned char *data, unsigned int len)
-{
- if (strncmp(ce_signature, data, sizeof(ce_signature)) != 0) {
- return 0;
- }
- printf("(WINCE)");
- return ce_loader;
-}
-
-static sector_t ce_loader(unsigned char *data, unsigned int len, int eof)
-{
- static unsigned char dbuffer[DSIZE];
- int this_write = 0;
- static int firsttime = 1;
-
- /*
- * new packet in, we have to
- * [1] copy data to dbuffer,
- *
- * update...
- * [2] dbuffer_available
- */
- memcpy( (dbuffer+dbuffer_available), data, len); //[1]
- dbuffer_available += len; // [2]
- len = 0;
-
- d_now = 0;
-
-#if 0
- printf("dbuffer_available =%ld \n", dbuffer_available);
-#endif
-
- if (firsttime)
- {
- d_now = sizeof(ce_signature);
- printf("String Physical Address = %lx \n",
- *(unsigned long *)(dbuffer+d_now));
-
- d_now += sizeof(unsigned long);
- printf("Image Size = %ld [%lx]\n",
- *(unsigned long *)(dbuffer+d_now),
- *(unsigned long *)(dbuffer+d_now));
-
- d_now += sizeof(unsigned long);
- dbuffer_available -= d_now;
-
- d_now = (unsigned long)get_x_header(dbuffer, d_now);
- firsttime = 0;
- }
-
- if (not_loadin == 0)
- {
- d_now = get_x_header(dbuffer, d_now);
- }
-
- while ( not_loadin > 0 )
- {
- /* dbuffer do not have enough data to loading, copy all */
-#if LOAD_DEBUG
- printf("[0] not_loadin = [%ld], dbuffer_available = [%ld] \n",
- not_loadin, dbuffer_available);
- printf("[0] d_now = [%ld] \n", d_now);
-#endif
-
- if( dbuffer_available <= not_loadin)
- {
- this_write = dbuffer_available ;
- memcpy(phys_to_virt(ce_curaddr), (dbuffer+d_now), this_write );
- ce_curaddr += this_write;
- not_loadin -= this_write;
-
- /* reset index and available in the dbuffer */
- dbuffer_available = 0;
- d_now = 0;
-#if LOAD_DEBUG
- printf("[1] not_loadin = [%ld], dbuffer_available = [%ld] \n",
- not_loadin, dbuffer_available);
- printf("[1] d_now = [%ld], this_write = [%d] \n",
- d_now, this_write);
-#endif
-
- // get the next packet...
- return (0);
- }
-
- /* dbuffer have more data then loading ... , copy partital.... */
- else
- {
- this_write = not_loadin;
- memcpy(phys_to_virt(ce_curaddr), (dbuffer+d_now), this_write);
- ce_curaddr += this_write;
- not_loadin = 0;
-
- /* reset index and available in the dbuffer */
- dbuffer_available -= this_write;
- d_now += this_write;
-#if LOAD_DEBUG
- printf("[2] not_loadin = [%ld], dbuffer_available = [%ld] \n",
- not_loadin, dbuffer_available);
- printf("[2] d_now = [%ld], this_write = [%d] \n\n",
- d_now, this_write);
-#endif
-
- /* dbuffer not empty, proceed processing... */
-
- // don't have enough data to get_x_header..
- if ( dbuffer_available < (sizeof(unsigned long) * 3) )
- {
-// printf("we don't have enough data remaining to call get_x. \n");
- memcpy( (dbuffer+0), (dbuffer+d_now), dbuffer_available);
- return (0);
- }
- else
- {
-#if LOAD_DEBUG
- printf("with remaining data to call get_x \n");
- printf("dbuffer available = %ld , d_now = %ld\n",
- dbuffer_available, d_now);
-#endif
- d_now = get_x_header(dbuffer, d_now);
- }
- }
- }
- return (0);
-}
-
-static int get_x_header(unsigned char *dbuffer, unsigned long now)
-{
- X.addr = *(unsigned long *)(dbuffer + now);
- X.size = *(unsigned long *)(dbuffer + now + sizeof(unsigned long));
- X.checksum = *(unsigned long *)(dbuffer + now + sizeof(unsigned long)*2);
-
- if (X.addr == 0)
- {
- entry = X.size;
- done(1);
- printf("Entry Point Address = [%lx] \n", entry);
- jump_2ep();
- }
-
- if (!prep_segment(X.addr, X.addr + X.size, X.addr + X.size, 0, 0)) {
- longjmp(restart_etherboot, -2);
- }
-
- ce_curaddr = X.addr;
- now += sizeof(unsigned long)*3;
-
- /* re-calculate dbuffer available... */
- dbuffer_available -= sizeof(unsigned long)*3;
-
- /* reset index of this section */
- not_loadin = X.size;
-
-#if 1
- printf("\n");
- printf("\t Section Address = [%lx] \n", X.addr);
- printf("\t Size = %d [%lx]\n", X.size, X.size);
- printf("\t Checksum = %ld [%lx]\n", X.checksum, X.checksum);
-#endif
-#if LOAD_DEBUG
- printf("____________________________________________\n");
- printf("\t dbuffer_now = %ld \n", now);
- printf("\t dbuffer available = %ld \n", dbuffer_available);
- printf("\t not_loadin = %ld \n", not_loadin);
-#endif
-
- return now;
-}
-
-static void jump_2ep()
-{
- BootArgs.ucVideoMode = 1;
- BootArgs.ucComPort = 1;
- BootArgs.ucBaudDivisor = 1;
- BootArgs.ucPCIConfigType = 1; // do not fill with 0
-
- BootArgs.dwSig = BOOTARG_SIG;
- BootArgs.dwLen = sizeof(BootArgs);
-
- if(BootArgs.ucVideoMode == 0)
- {
- BootArgs.cxDisplayScreen = 640;
- BootArgs.cyDisplayScreen = 480;
- BootArgs.cxPhysicalScreen = 640;
- BootArgs.cyPhysicalScreen = 480;
- BootArgs.bppScreen = 16;
- BootArgs.cbScanLineLength = 1024;
- BootArgs.pvFlatFrameBuffer = 0x800a0000; // ollie say 0x98000000
- }
- else if(BootArgs.ucVideoMode != 0xFF)
- {
- BootArgs.cxDisplayScreen = 0;
- BootArgs.cyDisplayScreen = 0;
- BootArgs.cxPhysicalScreen = 0;
- BootArgs.cyPhysicalScreen = 0;
- BootArgs.bppScreen = 0;
- BootArgs.cbScanLineLength = 0;
- BootArgs.pvFlatFrameBuffer = 0;
- }
-
- ep = phys_to_virt(BOOT_ARG_PTR_LOCATION);
- *ep= virt_to_phys(&BootArgs);
- xstart32(entry);
-}
diff --git a/gpxe/src/arch/i386/core/x86_io.c b/gpxe/src/arch/i386/core/x86_io.c
deleted file mode 100644
index d2c363b9..00000000
--- a/gpxe/src/arch/i386/core/x86_io.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/io.h>
-#include <gpxe/x86_io.h>
-
-/** @file
- *
- * gPXE I/O API for x86
- *
- */
-
-/**
- * Read 64-bit qword from memory-mapped device
- *
- * @v io_addr I/O address
- * @ret data Value read
- *
- * This routine uses MMX instructions.
- */
-static uint64_t x86_readq ( volatile uint64_t *io_addr ) {
- uint64_t data;
- __asm__ __volatile__ ( "pushl %%edx\n\t"
- "pushl %%eax\n\t"
- "movq (%1), %%mm0\n\t"
- "movq %%mm0, (%%esp)\n\t"
- "popl %%eax\n\t"
- "popl %%edx\n\t"
- "emms\n\t"
- : "=A" ( data ) : "r" ( io_addr ) );
- return data;
-}
-
-/**
- * Write 64-bit qword to memory-mapped device
- *
- * @v data Value to write
- * @v io_addr I/O address
- *
- * This routine uses MMX instructions.
- */
-static void x86_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
- __asm__ __volatile__ ( "pushl %%edx\n\t"
- "pushl %%eax\n\t"
- "movq (%%esp), %%mm0\n\t"
- "movq %%mm0, (%1)\n\t"
- "popl %%eax\n\t"
- "popl %%edx\n\t"
- "emms\n\t"
- : : "A" ( data ), "r" ( io_addr ) );
-}
-
-PROVIDE_IOAPI_INLINE ( x86, phys_to_bus );
-PROVIDE_IOAPI_INLINE ( x86, bus_to_phys );
-PROVIDE_IOAPI_INLINE ( x86, ioremap );
-PROVIDE_IOAPI_INLINE ( x86, iounmap );
-PROVIDE_IOAPI_INLINE ( x86, io_to_bus );
-PROVIDE_IOAPI_INLINE ( x86, readb );
-PROVIDE_IOAPI_INLINE ( x86, readw );
-PROVIDE_IOAPI_INLINE ( x86, readl );
-PROVIDE_IOAPI ( x86, readq, x86_readq );
-PROVIDE_IOAPI_INLINE ( x86, writeb );
-PROVIDE_IOAPI_INLINE ( x86, writew );
-PROVIDE_IOAPI_INLINE ( x86, writel );
-PROVIDE_IOAPI ( x86, writeq, x86_writeq );
-PROVIDE_IOAPI_INLINE ( x86, inb );
-PROVIDE_IOAPI_INLINE ( x86, inw );
-PROVIDE_IOAPI_INLINE ( x86, inl );
-PROVIDE_IOAPI_INLINE ( x86, outb );
-PROVIDE_IOAPI_INLINE ( x86, outw );
-PROVIDE_IOAPI_INLINE ( x86, outl );
-PROVIDE_IOAPI_INLINE ( x86, insb );
-PROVIDE_IOAPI_INLINE ( x86, insw );
-PROVIDE_IOAPI_INLINE ( x86, insl );
-PROVIDE_IOAPI_INLINE ( x86, outsb );
-PROVIDE_IOAPI_INLINE ( x86, outsw );
-PROVIDE_IOAPI_INLINE ( x86, outsl );
-PROVIDE_IOAPI_INLINE ( x86, iodelay );
-PROVIDE_IOAPI_INLINE ( x86, mb );
diff --git a/gpxe/src/arch/i386/drivers/net/undi.c b/gpxe/src/arch/i386/drivers/net/undi.c
deleted file mode 100644
index c6e253c0..00000000
--- a/gpxe/src/arch/i386/drivers/net/undi.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <gpxe/pci.h>
-#include <undi.h>
-#include <undirom.h>
-#include <undiload.h>
-#include <undinet.h>
-#include <undipreload.h>
-
-/** @file
- *
- * UNDI PCI driver
- *
- */
-
-/**
- * Find UNDI ROM for PCI device
- *
- * @v pci PCI device
- * @ret undirom UNDI ROM, or NULL
- *
- * Try to find a driver for this device. Try an exact match on the
- * ROM address first, then fall back to a vendor/device ID match only
- */
-static struct undi_rom * undipci_find_rom ( struct pci_device *pci ) {
- struct undi_rom *undirom;
- unsigned long rombase;
-
- rombase = pci_bar_start ( pci, PCI_ROM_ADDRESS );
- undirom = undirom_find_pci ( pci->vendor, pci->device, rombase );
- if ( ! undirom )
- undirom = undirom_find_pci ( pci->vendor, pci->device, 0 );
- return undirom;
-}
-
-/**
- * Probe PCI device
- *
- * @v pci PCI device
- * @v id PCI ID
- * @ret rc Return status code
- */
-static int undipci_probe ( struct pci_device *pci,
- const struct pci_device_id *id __unused ) {
- struct undi_device *undi;
- struct undi_rom *undirom;
- unsigned int busdevfn = PCI_BUSDEVFN ( pci->bus, pci->devfn );
- int rc;
-
- /* Ignore non-network devices */
- if ( PCI_BASE_CLASS ( pci->class ) != PCI_BASE_CLASS_NETWORK )
- return -ENOTTY;
-
- /* Allocate UNDI device structure */
- undi = zalloc ( sizeof ( *undi ) );
- if ( ! undi )
- return -ENOMEM;
- pci_set_drvdata ( pci, undi );
-
- /* Find/create our pixie */
- if ( preloaded_undi.pci_busdevfn == busdevfn ) {
- /* Claim preloaded UNDI device */
- DBGC ( undi, "UNDI %p using preloaded UNDI device\n", undi );
- memcpy ( undi, &preloaded_undi, sizeof ( *undi ) );
- memset ( &preloaded_undi, 0, sizeof ( preloaded_undi ) );
- } else {
- /* Find UNDI ROM for PCI device */
- if ( ! ( undirom = undipci_find_rom ( pci ) ) ) {
- rc = -ENODEV;
- goto err_find_rom;
- }
-
- /* Call UNDI ROM loader to create pixie */
- if ( ( rc = undi_load_pci ( undi, undirom, busdevfn ) ) != 0 )
- goto err_load_pci;
- }
-
- /* Add to device hierarchy */
- snprintf ( undi->dev.name, sizeof ( undi->dev.name ),
- "UNDI-%s", pci->dev.name );
- memcpy ( &undi->dev.desc, &pci->dev.desc, sizeof ( undi->dev.desc ) );
- undi->dev.parent = &pci->dev;
- INIT_LIST_HEAD ( &undi->dev.children );
- list_add ( &undi->dev.siblings, &pci->dev.children );
-
- /* Create network device */
- if ( ( rc = undinet_probe ( undi ) ) != 0 )
- goto err_undinet_probe;
-
- return 0;
-
- err_undinet_probe:
- undi_unload ( undi );
- list_del ( &undi->dev.siblings );
- err_find_rom:
- err_load_pci:
- free ( undi );
- pci_set_drvdata ( pci, NULL );
- return rc;
-}
-
-/**
- * Remove PCI device
- *
- * @v pci PCI device
- */
-static void undipci_remove ( struct pci_device *pci ) {
- struct undi_device *undi = pci_get_drvdata ( pci );
-
- undinet_remove ( undi );
- undi_unload ( undi );
- list_del ( &undi->dev.siblings );
- free ( undi );
- pci_set_drvdata ( pci, NULL );
-}
-
-static struct pci_device_id undipci_nics[] = {
-PCI_ROM ( 0xffff, 0xffff, "undipci", "UNDI (PCI)", 0 ),
-};
-
-struct pci_driver undipci_driver __pci_driver = {
- .ids = undipci_nics,
- .id_count = ( sizeof ( undipci_nics ) / sizeof ( undipci_nics[0] ) ),
- .probe = undipci_probe,
- .remove = undipci_remove,
-};
diff --git a/gpxe/src/arch/i386/drivers/net/undiisr.S b/gpxe/src/arch/i386/drivers/net/undiisr.S
deleted file mode 100644
index b27effe1..00000000
--- a/gpxe/src/arch/i386/drivers/net/undiisr.S
+++ /dev/null
@@ -1,87 +0,0 @@
-FILE_LICENCE ( GPL2_OR_LATER )
-
-#define PXENV_UNDI_ISR 0x0014
-#define PXENV_UNDI_ISR_IN_START 1
-#define PXENV_UNDI_ISR_OUT_OURS 0
-#define PXENV_UNDI_ISR_OUT_NOT_OURS 1
-
-#define IRQ_PIC_CUTOFF 8
-#define ICR_EOI_NON_SPECIFIC 0x20
-#define PIC1_ICR 0x20
-#define PIC2_ICR 0xa0
-
- .text
- .arch i386
- .code16
-
- .section ".text16", "ax", @progbits
- .globl undiisr
-undiisr:
-
- /* Preserve registers */
- pushw %ds
- pushw %es
- pushw %fs
- pushw %gs
- pushfl
- pushal
-
- /* Set up our segment registers */
- movw %cs:rm_ds, %ax
- movw %ax, %ds
-
- /* Check that we have an UNDI entry point */
- cmpw $0, pxeparent_entry_point
- je chain
-
- /* Issue UNDI API call */
- movw %ax, %es
- movw $undinet_params, %di
- movw $PXENV_UNDI_ISR, %bx
- movw $PXENV_UNDI_ISR_IN_START, funcflag
- pushw %es
- pushw %di
- pushw %bx
- lcall *pxeparent_entry_point
- cli /* Just in case */
- addw $6, %sp
- cmpw $PXENV_UNDI_ISR_OUT_OURS, funcflag
- jne eoi
-
-trig: /* Record interrupt occurence */
- incb undiisr_trigger_count
-
-eoi: /* Send EOI */
- movb $ICR_EOI_NON_SPECIFIC, %al
- cmpb $IRQ_PIC_CUTOFF, undiisr_irq
- jb 1f
- outb %al, $PIC2_ICR
-1: outb %al, $PIC1_ICR
- jmp exit
-
-chain: /* Chain to next handler */
- pushfw
- lcall *undiisr_next_handler
-
-exit: /* Restore registers and return */
- cli
- popal
- movzwl %sp, %esp
- addr32 movl -20(%esp), %esp /* %esp isn't restored by popal */
- popfl
- popw %gs
- popw %fs
- popw %es
- popw %ds
- iret
-
- .section ".data16", "aw", @progbits
-undinet_params:
-status: .word 0
-funcflag: .word 0
-bufferlength: .word 0
-framelength: .word 0
-frameheaderlength: .word 0
-frame: .word 0, 0
-prottype: .byte 0
-pkttype: .byte 0
diff --git a/gpxe/src/arch/i386/drivers/net/undiload.c b/gpxe/src/arch/i386/drivers/net/undiload.c
deleted file mode 100644
index 1d4e88d7..00000000
--- a/gpxe/src/arch/i386/drivers/net/undiload.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pxe.h>
-#include <realmode.h>
-#include <bios.h>
-#include <pnpbios.h>
-#include <basemem.h>
-#include <gpxe/pci.h>
-#include <undi.h>
-#include <undirom.h>
-#include <undiload.h>
-
-/** @file
- *
- * UNDI load/unload
- *
- */
-
-/** Parameter block for calling UNDI loader */
-static struct s_UNDI_LOADER __bss16 ( undi_loader );
-#define undi_loader __use_data16 ( undi_loader )
-
-/** UNDI loader entry point */
-static SEGOFF16_t __bss16 ( undi_loader_entry );
-#define undi_loader_entry __use_data16 ( undi_loader_entry )
-
-/**
- * Call UNDI loader to create a pixie
- *
- * @v undi UNDI device
- * @v undirom UNDI ROM
- * @ret rc Return status code
- */
-int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
- struct s_PXE ppxe;
- unsigned int fbms_seg;
- uint16_t exit;
- int rc;
-
- /* Set up START_UNDI parameters */
- memset ( &undi_loader, 0, sizeof ( undi_loader ) );
- undi_loader.AX = undi->pci_busdevfn;
- undi_loader.BX = undi->isapnp_csn;
- undi_loader.DX = undi->isapnp_read_port;
- undi_loader.ES = BIOS_SEG;
- undi_loader.DI = find_pnp_bios();
-
- /* Allocate base memory for PXE stack */
- undi->restore_fbms = get_fbms();
- fbms_seg = ( undi->restore_fbms << 6 );
- fbms_seg -= ( ( undirom->code_size + 0x0f ) >> 4 );
- undi_loader.UNDI_CS = fbms_seg;
- fbms_seg -= ( ( undirom->data_size + 0x0f ) >> 4 );
- undi_loader.UNDI_DS = fbms_seg;
-
- /* Debug info */
- DBGC ( undi, "UNDI %p loading UNDI ROM %p to CS %04x DS %04x for ",
- undi, undirom, undi_loader.UNDI_CS, undi_loader.UNDI_DS );
- if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
- unsigned int bus = ( undi->pci_busdevfn >> 8 );
- unsigned int devfn = ( undi->pci_busdevfn & 0xff );
- DBGC ( undi, "PCI %02x:%02x.%x\n",
- bus, PCI_SLOT ( devfn ), PCI_FUNC ( devfn ) );
- }
- if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
- DBGC ( undi, "ISAPnP(%04x) CSN %04x\n",
- undi->isapnp_read_port, undi->isapnp_csn );
- }
-
- /* Call loader */
- undi_loader_entry = undirom->loader_entry;
- __asm__ __volatile__ ( REAL_CODE ( "pushw %%ds\n\t"
- "pushw %%ax\n\t"
- "lcall *undi_loader_entry\n\t"
- "addw $4, %%sp\n\t" )
- : "=a" ( exit )
- : "a" ( __from_data16 ( &undi_loader ) )
- : "ebx", "ecx", "edx", "esi", "edi", "ebp" );
-
- /* 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();
-
- if ( exit != PXENV_EXIT_SUCCESS ) {
- rc = -undi_loader.Status;
- if ( rc == 0 ) /* Paranoia */
- rc = -EIO;
- DBGC ( undi, "UNDI %p loader failed: %s\n",
- undi, strerror ( rc ) );
- return rc;
- }
-
- /* Populate PXE device structure */
- undi->pxenv = undi_loader.PXENVptr;
- undi->ppxe = undi_loader.PXEptr;
- copy_from_real ( &ppxe, undi->ppxe.segment, undi->ppxe.offset,
- sizeof ( ppxe ) );
- undi->entry = ppxe.EntryPointSP;
- DBGC ( undi, "UNDI %p loaded PXENV+ %04x:%04x !PXE %04x:%04x "
- "entry %04x:%04x\n", undi, undi->pxenv.segment,
- undi->pxenv.offset, undi->ppxe.segment, undi->ppxe.offset,
- undi->entry.segment, undi->entry.offset );
-
- /* Update free base memory counter */
- undi->fbms = ( fbms_seg >> 6 );
- set_fbms ( undi->fbms );
- DBGC ( undi, "UNDI %p using [%d,%d) kB of base memory\n",
- undi, undi->fbms, undi->restore_fbms );
-
- return 0;
-}
-
-/**
- * Unload a pixie
- *
- * @v undi UNDI device
- * @ret rc Return status code
- *
- * Erases the PXENV+ and !PXE signatures, and frees the used base
- * memory (if possible).
- */
-int undi_unload ( struct undi_device *undi ) {
- static uint32_t dead = 0xdeaddead;
-
- DBGC ( undi, "UNDI %p unloading\n", undi );
-
- /* Erase signatures */
- if ( undi->pxenv.segment )
- put_real ( dead, undi->pxenv.segment, undi->pxenv.offset );
- if ( undi->ppxe.segment )
- put_real ( dead, undi->ppxe.segment, undi->ppxe.offset );
-
- /* Free base memory, if possible */
- if ( undi->fbms == get_fbms() ) {
- DBGC ( undi, "UNDI %p freeing [%d,%d) kB of base memory\n",
- undi, undi->fbms, undi->restore_fbms );
- set_fbms ( undi->restore_fbms );
- return 0;
- } else {
- DBGC ( undi, "UNDI %p leaking [%d,%d) kB of base memory\n",
- undi, undi->fbms, undi->restore_fbms );
- return -EBUSY;
- }
-}
diff --git a/gpxe/src/arch/i386/drivers/net/undinet.c b/gpxe/src/arch/i386/drivers/net/undinet.c
deleted file mode 100644
index 83b79e7f..00000000
--- a/gpxe/src/arch/i386/drivers/net/undinet.c
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <string.h>
-#include <pxe.h>
-#include <realmode.h>
-#include <pic8259.h>
-#include <biosint.h>
-#include <pnpbios.h>
-#include <basemem_packet.h>
-#include <gpxe/io.h>
-#include <gpxe/iobuf.h>
-#include <gpxe/netdevice.h>
-#include <gpxe/if_ether.h>
-#include <gpxe/ethernet.h>
-#include <undi.h>
-#include <undinet.h>
-#include <pxeparent.h>
-
-
-/** @file
- *
- * UNDI network device driver
- *
- */
-
-/** An UNDI NIC */
-struct undi_nic {
- /** Assigned IRQ number */
- unsigned int irq;
- /** Currently processing ISR */
- int isr_processing;
- /** Bug workarounds */
- int hacks;
-};
-
-/**
- * @defgroup undi_hacks UNDI workarounds
- * @{
- */
-
-/** Work around Etherboot 5.4 bugs */
-#define UNDI_HACK_EB54 0x0001
-
-/** @} */
-
-static void undinet_close ( struct net_device *netdev );
-
-/** Address of UNDI entry point */
-static SEGOFF16_t undinet_entry;
-
-/*****************************************************************************
- *
- * UNDI interrupt service routine
- *
- *****************************************************************************
- */
-
-/**
- * UNDI interrupt service routine
- *
- * The UNDI ISR increments a counter (@c trigger_count) and exits.
- */
-extern void undiisr ( void );
-
-/** IRQ number */
-uint8_t __data16 ( undiisr_irq );
-#define undiisr_irq __use_data16 ( undiisr_irq )
-
-/** IRQ chain vector */
-struct segoff __data16 ( undiisr_next_handler );
-#define undiisr_next_handler __use_data16 ( undiisr_next_handler )
-
-/** IRQ trigger count */
-volatile uint8_t __data16 ( undiisr_trigger_count ) = 0;
-#define undiisr_trigger_count __use_data16 ( undiisr_trigger_count )
-
-/** Last observed trigger count */
-static unsigned int last_trigger_count = 0;
-
-/**
- * Hook UNDI interrupt service routine
- *
- * @v irq IRQ number
- */
-static void undinet_hook_isr ( unsigned int irq ) {
-
- assert ( irq <= IRQ_MAX );
- assert ( undiisr_irq == 0 );
-
- undiisr_irq = irq;
- hook_bios_interrupt ( IRQ_INT ( irq ),
- ( ( unsigned int ) undiisr ),
- &undiisr_next_handler );
-}
-
-/**
- * Unhook UNDI interrupt service routine
- *
- * @v irq IRQ number
- */
-static void undinet_unhook_isr ( unsigned int irq ) {
-
- assert ( irq <= IRQ_MAX );
-
- unhook_bios_interrupt ( IRQ_INT ( irq ),
- ( ( unsigned int ) undiisr ),
- &undiisr_next_handler );
- undiisr_irq = 0;
-}
-
-/**
- * Test to see if UNDI ISR has been triggered
- *
- * @ret triggered ISR has been triggered since last check
- */
-static int undinet_isr_triggered ( void ) {
- unsigned int this_trigger_count;
-
- /* Read trigger_count. Do this only once; it is volatile */
- this_trigger_count = undiisr_trigger_count;
-
- if ( this_trigger_count == last_trigger_count ) {
- /* Not triggered */
- return 0;
- } else {
- /* Triggered */
- last_trigger_count = this_trigger_count;
- return 1;
- }
-}
-
-/*****************************************************************************
- *
- * UNDI network device interface
- *
- *****************************************************************************
- */
-
-/** UNDI transmit buffer descriptor */
-static struct s_PXENV_UNDI_TBD __data16 ( undinet_tbd );
-#define undinet_tbd __use_data16 ( undinet_tbd )
-
-/**
- * Transmit packet
- *
- * @v netdev Network device
- * @v iobuf I/O buffer
- * @ret rc Return status code
- */
-static int undinet_transmit ( struct net_device *netdev,
- struct io_buffer *iobuf ) {
- struct s_PXENV_UNDI_TRANSMIT undi_transmit;
- size_t len = iob_len ( iobuf );
- int rc;
-
- /* Technically, we ought to make sure that the previous
- * transmission has completed before we re-use the buffer.
- * However, many PXE stacks (including at least some Intel PXE
- * stacks and Etherboot 5.4) fail to generate TX completions.
- * In practice this won't be a problem, since our TX datapath
- * has a very low packet volume and we can get away with
- * assuming that a TX will be complete by the time we want to
- * transmit the next packet.
- */
-
- /* Copy packet to UNDI I/O buffer */
- if ( len > sizeof ( basemem_packet ) )
- len = sizeof ( basemem_packet );
- memcpy ( &basemem_packet, iobuf->data, len );
-
- /* Create PXENV_UNDI_TRANSMIT data structure */
- memset ( &undi_transmit, 0, sizeof ( undi_transmit ) );
- undi_transmit.DestAddr.segment = rm_ds;
- undi_transmit.DestAddr.offset = __from_data16 ( &undinet_tbd );
- undi_transmit.TBD.segment = rm_ds;
- undi_transmit.TBD.offset = __from_data16 ( &undinet_tbd );
-
- /* Create PXENV_UNDI_TBD data structure */
- undinet_tbd.ImmedLength = len;
- undinet_tbd.Xmit.segment = rm_ds;
- undinet_tbd.Xmit.offset = __from_data16 ( basemem_packet );
-
- /* Issue PXE API call */
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_TRANSMIT,
- &undi_transmit,
- sizeof ( undi_transmit ) ) ) != 0 )
- goto done;
-
- /* Free I/O buffer */
- netdev_tx_complete ( netdev, iobuf );
-
- done:
- return rc;
-}
-
-/**
- * Poll for received packets
- *
- * @v netdev Network device
- *
- * Fun, fun, fun. UNDI drivers don't use polling; they use
- * interrupts. We therefore cheat and pretend that an interrupt has
- * occurred every time undinet_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
- * undinet_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.
- *
- * Addendum (10/07/07). When doing things such as iSCSI boot, in
- * which we have to co-operate with a running OS, we can't get away
- * with the "ISR-just-increments-a-counter-and-returns" trick at all,
- * because it involves tying up the PIC for far too long, and other
- * interrupt-dependent components (e.g. local disks) start breaking.
- * We therefore implement a "proper" ISR which calls PXENV_UNDI_ISR
- * from within interrupt context in order to deassert the device
- * interrupt, and sends EOI if applicable.
- */
-static void undinet_poll ( struct net_device *netdev ) {
- struct undi_nic *undinic = netdev->priv;
- struct s_PXENV_UNDI_ISR undi_isr;
- struct io_buffer *iobuf = NULL;
- size_t len;
- size_t frag_len;
- size_t max_frag_len;
- int rc;
-
- if ( ! undinic->isr_processing ) {
- /* Do nothing unless ISR has been triggered */
- if ( ! undinet_isr_triggered() ) {
- /* Allow interrupt to occur */
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- "nop\n\t"
- "nop\n\t"
- "cli\n\t" ) : : );
- return;
- }
-
- /* Start ISR processing */
- undinic->isr_processing = 1;
- undi_isr.FuncFlag = PXENV_UNDI_ISR_IN_PROCESS;
- } else {
- /* Continue ISR processing */
- undi_isr.FuncFlag = PXENV_UNDI_ISR_IN_GET_NEXT;
- }
-
- /* Run through the ISR loop */
- while ( 1 ) {
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
- &undi_isr,
- sizeof ( undi_isr ) ) ) != 0 )
- break;
- switch ( undi_isr.FuncFlag ) {
- case PXENV_UNDI_ISR_OUT_TRANSMIT:
- /* We don't care about transmit completions */
- break;
- case PXENV_UNDI_ISR_OUT_RECEIVE:
- /* Packet fragment received */
- len = undi_isr.FrameLength;
- frag_len = undi_isr.BufferLength;
- if ( ( len == 0 ) || ( len < frag_len ) ) {
- /* Don't laugh. VMWare does it. */
- DBGC ( undinic, "UNDINIC %p reported insane "
- "fragment (%zd of %zd bytes)\n",
- undinic, frag_len, len );
- netdev_rx_err ( netdev, NULL, -EINVAL );
- break;
- }
- if ( ! iobuf )
- iobuf = alloc_iob ( len );
- if ( ! iobuf ) {
- DBGC ( undinic, "UNDINIC %p could not "
- "allocate %zd bytes for RX buffer\n",
- undinic, len );
- /* Fragment will be dropped */
- netdev_rx_err ( netdev, NULL, -ENOMEM );
- goto done;
- }
- max_frag_len = iob_tailroom ( iobuf );
- if ( frag_len > max_frag_len ) {
- DBGC ( undinic, "UNDINIC %p fragment too big "
- "(%zd+%zd does not fit into %zd)\n",
- undinic, iob_len ( iobuf ), frag_len,
- ( iob_len ( iobuf ) + max_frag_len ) );
- frag_len = max_frag_len;
- }
- copy_from_real ( iob_put ( iobuf, frag_len ),
- undi_isr.Frame.segment,
- undi_isr.Frame.offset, frag_len );
- if ( iob_len ( iobuf ) == len ) {
- /* Whole packet received; deliver it */
- netdev_rx ( netdev, iob_disown ( iobuf ) );
- /* Etherboot 5.4 fails to return all packets
- * under mild load; pretend it retriggered.
- */
- if ( undinic->hacks & UNDI_HACK_EB54 )
- --last_trigger_count;
- }
- break;
- case PXENV_UNDI_ISR_OUT_DONE:
- /* Processing complete */
- undinic->isr_processing = 0;
- goto done;
- default:
- /* Should never happen. VMWare does it routinely. */
- DBGC ( undinic, "UNDINIC %p ISR returned invalid "
- "FuncFlag %04x\n", undinic, undi_isr.FuncFlag );
- undinic->isr_processing = 0;
- goto done;
- }
- undi_isr.FuncFlag = PXENV_UNDI_ISR_IN_GET_NEXT;
- }
-
- done:
- if ( iobuf ) {
- DBGC ( undinic, "UNDINIC %p returned incomplete packet "
- "(%zd of %zd)\n", undinic, iob_len ( iobuf ),
- ( iob_len ( iobuf ) + iob_tailroom ( iobuf ) ) );
- netdev_rx_err ( netdev, iobuf, -EINVAL );
- }
-}
-
-/**
- * Open NIC
- *
- * @v netdev Net device
- * @ret rc Return status code
- */
-static int undinet_open ( struct net_device *netdev ) {
- struct undi_nic *undinic = netdev->priv;
- struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_address;
- struct s_PXENV_UNDI_OPEN undi_open;
- int rc;
-
- /* Hook interrupt service routine and enable interrupt */
- undinet_hook_isr ( undinic->irq );
- enable_irq ( undinic->irq );
- send_eoi ( undinic->irq );
-
- /* Set station address. Required for some PXE stacks; will
- * spuriously fail on others. Ignore failures. We only ever
- * use it to set the MAC address to the card's permanent value
- * anyway.
- */
- memcpy ( undi_set_address.StationAddress, netdev->ll_addr,
- sizeof ( undi_set_address.StationAddress ) );
- pxeparent_call ( undinet_entry, PXENV_UNDI_SET_STATION_ADDRESS,
- &undi_set_address, sizeof ( undi_set_address ) );
-
- /* Open NIC. We ask for promiscuous operation, since it's the
- * only way to ask for all multicast addresses. On any
- * switched network, it shouldn't really make a difference to
- * performance.
- */
- memset ( &undi_open, 0, sizeof ( undi_open ) );
- undi_open.PktFilter = ( FLTR_DIRECTED | FLTR_BRDCST | FLTR_PRMSCS );
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_OPEN,
- &undi_open, sizeof ( undi_open ) ) ) != 0 )
- goto err;
-
- DBGC ( undinic, "UNDINIC %p opened\n", undinic );
- return 0;
-
- err:
- undinet_close ( netdev );
- return rc;
-}
-
-/**
- * Close NIC
- *
- * @v netdev Net device
- */
-static void undinet_close ( struct net_device *netdev ) {
- struct undi_nic *undinic = netdev->priv;
- struct s_PXENV_UNDI_ISR undi_isr;
- struct s_PXENV_UNDI_CLOSE undi_close;
- int rc;
-
- /* Ensure ISR has exited cleanly */
- while ( undinic->isr_processing ) {
- undi_isr.FuncFlag = PXENV_UNDI_ISR_IN_GET_NEXT;
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_ISR,
- &undi_isr,
- sizeof ( undi_isr ) ) ) != 0 )
- break;
- switch ( undi_isr.FuncFlag ) {
- case PXENV_UNDI_ISR_OUT_TRANSMIT:
- case PXENV_UNDI_ISR_OUT_RECEIVE:
- /* Continue draining */
- break;
- default:
- /* Stop processing */
- undinic->isr_processing = 0;
- break;
- }
- }
-
- /* Close NIC */
- pxeparent_call ( undinet_entry, PXENV_UNDI_CLOSE,
- &undi_close, sizeof ( undi_close ) );
-
- /* Disable interrupt and unhook ISR */
- disable_irq ( undinic->irq );
- undinet_unhook_isr ( undinic->irq );
-
- DBGC ( undinic, "UNDINIC %p closed\n", undinic );
-}
-
-/**
- * Enable/disable interrupts
- *
- * @v netdev Net device
- * @v enable Interrupts should be enabled
- */
-static void undinet_irq ( struct net_device *netdev, int enable ) {
- struct undi_nic *undinic = netdev->priv;
-
- /* Cannot support interrupts yet */
- DBGC ( undinic, "UNDINIC %p cannot %s interrupts\n",
- undinic, ( enable ? "enable" : "disable" ) );
-}
-
-/** UNDI network device operations */
-static struct net_device_operations undinet_operations = {
- .open = undinet_open,
- .close = undinet_close,
- .transmit = undinet_transmit,
- .poll = undinet_poll,
- .irq = undinet_irq,
-};
-
-/**
- * Probe UNDI device
- *
- * @v undi UNDI device
- * @ret rc Return status code
- */
-int undinet_probe ( struct undi_device *undi ) {
- struct net_device *netdev;
- struct undi_nic *undinic;
- struct s_PXENV_START_UNDI start_undi;
- struct s_PXENV_UNDI_STARTUP undi_startup;
- struct s_PXENV_UNDI_INITIALIZE undi_initialize;
- struct s_PXENV_UNDI_GET_INFORMATION undi_info;
- struct s_PXENV_UNDI_GET_IFACE_INFO undi_iface;
- struct s_PXENV_UNDI_SHUTDOWN undi_shutdown;
- struct s_PXENV_UNDI_CLEANUP undi_cleanup;
- struct s_PXENV_STOP_UNDI stop_undi;
- int rc;
-
- /* Allocate net device */
- netdev = alloc_etherdev ( sizeof ( *undinic ) );
- if ( ! netdev )
- return -ENOMEM;
- netdev_init ( netdev, &undinet_operations );
- undinic = netdev->priv;
- undi_set_drvdata ( undi, netdev );
- netdev->dev = &undi->dev;
- memset ( undinic, 0, sizeof ( *undinic ) );
- undinet_entry = undi->entry;
- DBGC ( undinic, "UNDINIC %p using UNDI %p\n", undinic, undi );
-
- /* Hook in UNDI stack */
- if ( ! ( undi->flags & UNDI_FL_STARTED ) ) {
- memset ( &start_undi, 0, sizeof ( start_undi ) );
- start_undi.AX = undi->pci_busdevfn;
- start_undi.BX = undi->isapnp_csn;
- start_undi.DX = undi->isapnp_read_port;
- start_undi.ES = BIOS_SEG;
- start_undi.DI = find_pnp_bios();
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_START_UNDI,
- &start_undi,
- sizeof ( start_undi ) ) ) != 0 )
- goto err_start_undi;
- }
- undi->flags |= UNDI_FL_STARTED;
-
- /* Bring up UNDI stack */
- if ( ! ( undi->flags & UNDI_FL_INITIALIZED ) ) {
- memset ( &undi_startup, 0, sizeof ( undi_startup ) );
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_STARTUP,
- &undi_startup,
- sizeof ( undi_startup ) ) ) != 0 )
- goto err_undi_startup;
- memset ( &undi_initialize, 0, sizeof ( undi_initialize ) );
- if ( ( rc = pxeparent_call ( undinet_entry,
- PXENV_UNDI_INITIALIZE,
- &undi_initialize,
- sizeof ( undi_initialize ))) != 0 )
- goto err_undi_initialize;
- }
- undi->flags |= UNDI_FL_INITIALIZED;
-
- /* Get device information */
- memset ( &undi_info, 0, sizeof ( undi_info ) );
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_GET_INFORMATION,
- &undi_info, sizeof ( undi_info ) ) ) != 0 )
- goto err_undi_get_information;
- memcpy ( netdev->hw_addr, undi_info.PermNodeAddress, ETH_ALEN );
- undinic->irq = undi_info.IntNumber;
- if ( undinic->irq > IRQ_MAX ) {
- DBGC ( undinic, "UNDINIC %p invalid IRQ %d\n",
- undinic, undinic->irq );
- goto err_bad_irq;
- }
- DBGC ( undinic, "UNDINIC %p is %s on IRQ %d\n",
- undinic, eth_ntoa ( netdev->hw_addr ), undinic->irq );
-
- /* Get interface information */
- memset ( &undi_iface, 0, sizeof ( undi_iface ) );
- if ( ( rc = pxeparent_call ( undinet_entry, PXENV_UNDI_GET_IFACE_INFO,
- &undi_iface,
- sizeof ( undi_iface ) ) ) != 0 )
- goto err_undi_get_iface_info;
- DBGC ( undinic, "UNDINIC %p has type %s, speed %d, flags %08x\n",
- undinic, undi_iface.IfaceType, undi_iface.LinkSpeed,
- undi_iface.ServiceFlags );
- if ( strncmp ( ( ( char * ) undi_iface.IfaceType ), "Etherboot",
- sizeof ( undi_iface.IfaceType ) ) == 0 ) {
- DBGC ( undinic, "UNDINIC %p Etherboot 5.4 workaround enabled\n",
- undinic );
- undinic->hacks |= UNDI_HACK_EB54;
- }
-
- /* Mark as link up; we don't handle link state */
- netdev_link_up ( netdev );
-
- /* Register network device */
- if ( ( rc = register_netdev ( netdev ) ) != 0 )
- goto err_register;
-
- DBGC ( undinic, "UNDINIC %p added\n", undinic );
- return 0;
-
- err_register:
- err_undi_get_iface_info:
- err_bad_irq:
- err_undi_get_information:
- err_undi_initialize:
- /* Shut down UNDI stack */
- memset ( &undi_shutdown, 0, sizeof ( undi_shutdown ) );
- pxeparent_call ( undinet_entry, PXENV_UNDI_SHUTDOWN, &undi_shutdown,
- sizeof ( undi_shutdown ) );
- memset ( &undi_cleanup, 0, sizeof ( undi_cleanup ) );
- pxeparent_call ( undinet_entry, PXENV_UNDI_CLEANUP, &undi_cleanup,
- sizeof ( undi_cleanup ) );
- undi->flags &= ~UNDI_FL_INITIALIZED;
- err_undi_startup:
- /* Unhook UNDI stack */
- memset ( &stop_undi, 0, sizeof ( stop_undi ) );
- pxeparent_call ( undinet_entry, PXENV_STOP_UNDI, &stop_undi,
- sizeof ( stop_undi ) );
- undi->flags &= ~UNDI_FL_STARTED;
- err_start_undi:
- netdev_nullify ( netdev );
- netdev_put ( netdev );
- undi_set_drvdata ( undi, NULL );
- return rc;
-}
-
-/**
- * Remove UNDI device
- *
- * @v undi UNDI device
- */
-void undinet_remove ( struct undi_device *undi ) {
- struct net_device *netdev = undi_get_drvdata ( undi );
- struct undi_nic *undinic = netdev->priv;
- struct s_PXENV_UNDI_SHUTDOWN undi_shutdown;
- struct s_PXENV_UNDI_CLEANUP undi_cleanup;
- struct s_PXENV_STOP_UNDI stop_undi;
-
- /* Unregister net device */
- unregister_netdev ( netdev );
-
- /* If we are preparing for an OS boot, or if we cannot exit
- * via the PXE stack, then shut down the PXE stack.
- */
- if ( ! ( undi->flags & UNDI_FL_KEEP_ALL ) ) {
-
- /* Shut down UNDI stack */
- memset ( &undi_shutdown, 0, sizeof ( undi_shutdown ) );
- pxeparent_call ( undinet_entry, PXENV_UNDI_SHUTDOWN,
- &undi_shutdown, sizeof ( undi_shutdown ) );
- memset ( &undi_cleanup, 0, sizeof ( undi_cleanup ) );
- pxeparent_call ( undinet_entry, PXENV_UNDI_CLEANUP,
- &undi_cleanup, sizeof ( undi_cleanup ) );
- undi->flags &= ~UNDI_FL_INITIALIZED;
-
- /* Unhook UNDI stack */
- memset ( &stop_undi, 0, sizeof ( stop_undi ) );
- pxeparent_call ( undinet_entry, PXENV_STOP_UNDI, &stop_undi,
- sizeof ( stop_undi ) );
- undi->flags &= ~UNDI_FL_STARTED;
- }
-
- /* Clear entry point */
- memset ( &undinet_entry, 0, sizeof ( undinet_entry ) );
-
- /* Free network device */
- netdev_nullify ( netdev );
- netdev_put ( netdev );
-
- DBGC ( undinic, "UNDINIC %p removed\n", undinic );
-}
diff --git a/gpxe/src/arch/i386/drivers/net/undionly.c b/gpxe/src/arch/i386/drivers/net/undionly.c
deleted file mode 100644
index 7dfb5d15..00000000
--- a/gpxe/src/arch/i386/drivers/net/undionly.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gpxe/device.h>
-#include <gpxe/init.h>
-#include <undi.h>
-#include <undinet.h>
-#include <undipreload.h>
-
-/** @file
- *
- * "Pure" UNDI driver
- *
- * This is the UNDI driver without explicit support for PCI or any
- * other bus type. It is capable only of using the preloaded UNDI
- * device. It must not be combined in an image with any other
- * drivers.
- *
- * If you want a PXE-loadable image that contains only the UNDI
- * driver, build "bin/undionly.kpxe".
- *
- * If you want any other image format, or any other drivers in
- * addition to the UNDI driver, build e.g. "bin/undi.dsk".
- */
-
-/**
- * Probe UNDI root bus
- *
- * @v rootdev UNDI bus root device
- *
- * Scans the UNDI bus for devices and registers all devices it can
- * find.
- */
-static int undibus_probe ( struct root_device *rootdev ) {
- struct undi_device *undi = &preloaded_undi;
- int rc;
-
- /* Check for a valie preloaded UNDI device */
- if ( ! undi->entry.segment ) {
- DBG ( "No preloaded UNDI device found!\n" );
- return -ENODEV;
- }
-
- /* Add to device hierarchy */
- strncpy ( undi->dev.name, "UNDI",
- ( sizeof ( undi->dev.name ) - 1 ) );
- if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
- undi->dev.desc.bus_type = BUS_TYPE_PCI;
- undi->dev.desc.location = undi->pci_busdevfn;
- undi->dev.desc.vendor = undi->pci_vendor;
- undi->dev.desc.device = undi->pci_device;
- } else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
- undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
- }
- undi->dev.parent = &rootdev->dev;
- list_add ( &undi->dev.siblings, &rootdev->dev.children);
- INIT_LIST_HEAD ( &undi->dev.children );
-
- /* Create network device */
- if ( ( rc = undinet_probe ( undi ) ) != 0 )
- goto err;
-
- return 0;
-
- err:
- list_del ( &undi->dev.siblings );
- return rc;
-}
-
-/**
- * Remove UNDI root bus
- *
- * @v rootdev UNDI bus root device
- */
-static void undibus_remove ( struct root_device *rootdev __unused ) {
- struct undi_device *undi = &preloaded_undi;
-
- undinet_remove ( undi );
- list_del ( &undi->dev.siblings );
-}
-
-/** UNDI bus root device driver */
-static struct root_driver undi_root_driver = {
- .probe = undibus_probe,
- .remove = undibus_remove,
-};
-
-/** UNDI bus root device */
-struct root_device undi_root_device __root_device = {
- .dev = { .name = "UNDI" },
- .driver = &undi_root_driver,
-};
-
-/**
- * Prepare for exit
- *
- * @v flags Shutdown flags
- */
-static void undionly_shutdown ( int flags ) {
- /* If we are shutting down to boot an OS, clear the "keep PXE
- * stack" flag.
- */
- if ( flags & SHUTDOWN_BOOT )
- preloaded_undi.flags &= ~UNDI_FL_KEEP_ALL;
-}
-
-struct startup_fn startup_undionly __startup_fn ( STARTUP_LATE ) = {
- .shutdown = undionly_shutdown,
-};
diff --git a/gpxe/src/arch/i386/drivers/net/undipreload.c b/gpxe/src/arch/i386/drivers/net/undipreload.c
deleted file mode 100644
index a4b2f4ac..00000000
--- a/gpxe/src/arch/i386/drivers/net/undipreload.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <realmode.h>
-#include <undipreload.h>
-
-/** @file
- *
- * Preloaded UNDI stack
- *
- */
-
-/**
- * Preloaded UNDI device
- *
- * This is the UNDI device that was present when Etherboot started
- * execution (i.e. when loading a .kpxe image). The first driver to
- * claim this device must zero out this data structure.
- */
-struct undi_device __data16 ( preloaded_undi );
diff --git a/gpxe/src/arch/i386/drivers/net/undirom.c b/gpxe/src/arch/i386/drivers/net/undirom.c
deleted file mode 100644
index 2463d969..00000000
--- a/gpxe/src/arch/i386/drivers/net/undirom.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pxe.h>
-#include <realmode.h>
-#include <undirom.h>
-
-/** @file
- *
- * UNDI expansion ROMs
- *
- */
-
-/** List of all UNDI ROMs */
-static LIST_HEAD ( undiroms );
-
-/**
- * Parse PXE ROM ID structure
- *
- * @v undirom UNDI ROM
- * @v pxeromid Offset within ROM to PXE ROM ID structure
- * @ret rc Return status code
- */
-static int undirom_parse_pxeromid ( struct undi_rom *undirom,
- unsigned int pxeromid ) {
- struct undi_rom_id undi_rom_id;
- unsigned int undiloader;
-
- DBGC ( undirom, "UNDIROM %p has PXE ROM ID at %04x:%04x\n", undirom,
- undirom->rom_segment, pxeromid );
-
- /* Read PXE ROM ID structure and verify */
- copy_from_real ( &undi_rom_id, undirom->rom_segment, pxeromid,
- sizeof ( undi_rom_id ) );
- if ( undi_rom_id.Signature != UNDI_ROM_ID_SIGNATURE ) {
- DBGC ( undirom, "UNDIROM %p has bad PXE ROM ID signature "
- "%08x\n", undirom, undi_rom_id.Signature );
- return -EINVAL;
- }
-
- /* Check for UNDI loader */
- undiloader = undi_rom_id.UNDILoader;
- if ( ! undiloader ) {
- DBGC ( undirom, "UNDIROM %p has no UNDI loader\n", undirom );
- return -EINVAL;
- }
-
- /* Fill in UNDI ROM loader fields */
- undirom->loader_entry.segment = undirom->rom_segment;
- undirom->loader_entry.offset = undiloader;
- undirom->code_size = undi_rom_id.CodeSize;
- undirom->data_size = undi_rom_id.DataSize;
-
- DBGC ( undirom, "UNDIROM %p has UNDI loader at %04x:%04x "
- "(code %04zx data %04zx)\n", undirom,
- undirom->loader_entry.segment, undirom->loader_entry.offset,
- undirom->code_size, undirom->data_size );
- return 0;
-}
-
-/**
- * Parse PCI expansion header
- *
- * @v undirom UNDI ROM
- * @v pcirheader Offset within ROM to PCI expansion header
- */
-static int undirom_parse_pcirheader ( struct undi_rom *undirom,
- unsigned int pcirheader ) {
- struct pcir_header pcir_header;
-
- DBGC ( undirom, "UNDIROM %p has PCI expansion header at %04x:%04x\n",
- undirom, undirom->rom_segment, pcirheader );
-
- /* Read PCI expansion header and verify */
- copy_from_real ( &pcir_header, undirom->rom_segment, pcirheader,
- sizeof ( pcir_header ) );
- if ( pcir_header.signature != PCIR_SIGNATURE ) {
- DBGC ( undirom, "UNDIROM %p has bad PCI expansion header "
- "signature %08x\n", undirom, pcir_header.signature );
- return -EINVAL;
- }
-
- /* Fill in UNDI ROM PCI device fields */
- undirom->bus_type = PCI_NIC;
- undirom->bus_id.pci.vendor_id = pcir_header.vendor_id;
- undirom->bus_id.pci.device_id = pcir_header.device_id;
-
- DBGC ( undirom, "UNDIROM %p is for PCI devices %04x:%04x\n", undirom,
- undirom->bus_id.pci.vendor_id, undirom->bus_id.pci.device_id );
- return 0;
-
-}
-
-/**
- * Probe UNDI ROM
- *
- * @v rom_segment ROM segment address
- * @ret rc Return status code
- */
-static int undirom_probe ( unsigned int rom_segment ) {
- struct undi_rom *undirom = NULL;
- struct undi_rom_header romheader;
- size_t rom_len;
- unsigned int pxeromid;
- unsigned int pcirheader;
- int rc;
-
- /* Read expansion ROM header and verify */
- copy_from_real ( &romheader, rom_segment, 0, sizeof ( romheader ) );
- if ( romheader.Signature != ROM_SIGNATURE ) {
- rc = -EINVAL;
- goto err;
- }
- rom_len = ( romheader.ROMLength * 512 );
-
- /* Allocate memory for UNDI ROM */
- undirom = zalloc ( sizeof ( *undirom ) );
- if ( ! undirom ) {
- DBG ( "Could not allocate UNDI ROM structure\n" );
- rc = -ENOMEM;
- goto err;
- }
- DBGC ( undirom, "UNDIROM %p trying expansion ROM at %04x:0000 "
- "(%zdkB)\n", undirom, rom_segment, ( rom_len / 1024 ) );
- undirom->rom_segment = rom_segment;
-
- /* Check for and parse PXE ROM ID */
- pxeromid = romheader.PXEROMID;
- if ( ! pxeromid ) {
- DBGC ( undirom, "UNDIROM %p has no PXE ROM ID\n", undirom );
- rc = -EINVAL;
- goto err;
- }
- if ( pxeromid > rom_len ) {
- DBGC ( undirom, "UNDIROM %p PXE ROM ID outside ROM\n",
- undirom );
- rc = -EINVAL;
- goto err;
- }
- if ( ( rc = undirom_parse_pxeromid ( undirom, pxeromid ) ) != 0 )
- goto err;
-
- /* Parse PCIR header, if present */
- pcirheader = romheader.PCIRHeader;
- if ( pcirheader )
- undirom_parse_pcirheader ( undirom, pcirheader );
-
- /* Add to UNDI ROM list and return */
- DBGC ( undirom, "UNDIROM %p registered\n", undirom );
- list_add ( &undirom->list, &undiroms );
- return 0;
-
- err:
- free ( undirom );
- return rc;
-}
-
-/**
- * Create UNDI ROMs for all possible expansion ROMs
- *
- * @ret
- */
-static void undirom_probe_all_roms ( void ) {
- static int probed = 0;
- unsigned int rom_segment;
-
- /* Perform probe only once */
- if ( probed )
- return;
-
- DBG ( "Scanning for PXE expansion ROMs\n" );
-
- /* Scan through expansion ROM region at 512 byte intervals */
- for ( rom_segment = 0xc000 ; rom_segment < 0x10000 ;
- rom_segment += 0x20 ) {
- undirom_probe ( rom_segment );
- }
-
- probed = 1;
-}
-
-/**
- * Find UNDI ROM for PCI device
- *
- * @v vendor_id PCI vendor ID
- * @v device_id PCI device ID
- * @v rombase ROM base address, or 0 for any
- * @ret undirom UNDI ROM, or NULL
- */
-struct undi_rom * undirom_find_pci ( unsigned int vendor_id,
- unsigned int device_id,
- unsigned int rombase ) {
- struct undi_rom *undirom;
-
- undirom_probe_all_roms();
-
- list_for_each_entry ( undirom, &undiroms, list ) {
- if ( undirom->bus_type != PCI_NIC )
- continue;
- if ( undirom->bus_id.pci.vendor_id != vendor_id )
- continue;
- if ( undirom->bus_id.pci.device_id != device_id )
- continue;
- if ( rombase && ( ( undirom->rom_segment << 4 ) != rombase ) )
- continue;
- DBGC ( undirom, "UNDIROM %p matched PCI %04x:%04x (%08x)\n",
- undirom, vendor_id, device_id, rombase );
- return undirom;
- }
-
- DBG ( "No UNDI ROM matched PCI %04x:%04x (%08x)\n",
- vendor_id, device_id, rombase );
- return NULL;
-}
diff --git a/gpxe/src/arch/i386/firmware/pcbios/basemem.c b/gpxe/src/arch/i386/firmware/pcbios/basemem.c
deleted file mode 100644
index 1ba7d1f6..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/basemem.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <realmode.h>
-#include <bios.h>
-#include <basemem.h>
-#include <gpxe/hidemem.h>
-
-/** @file
- *
- * Base memory allocation
- *
- */
-
-/**
- * Set the BIOS free base memory counter
- *
- * @v new_fbms New free base memory counter (in kB)
- */
-void set_fbms ( unsigned int new_fbms ) {
- uint16_t fbms = new_fbms;
-
- /* Update the BIOS memory counter */
- put_real ( fbms, BDA_SEG, BDA_FBMS );
-
- /* Update our hidden memory region map */
- hide_basemem();
-}
diff --git a/gpxe/src/arch/i386/firmware/pcbios/bios_console.c b/gpxe/src/arch/i386/firmware/pcbios/bios_console.c
deleted file mode 100644
index 1d18e54c..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/bios_console.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <assert.h>
-#include <realmode.h>
-#include <console.h>
-#include <gpxe/ansiesc.h>
-
-#define ATTR_BOLD 0x08
-
-#define ATTR_FCOL_MASK 0x07
-#define ATTR_FCOL_BLACK 0x00
-#define ATTR_FCOL_BLUE 0x01
-#define ATTR_FCOL_GREEN 0x02
-#define ATTR_FCOL_CYAN 0x03
-#define ATTR_FCOL_RED 0x04
-#define ATTR_FCOL_MAGENTA 0x05
-#define ATTR_FCOL_YELLOW 0x06
-#define ATTR_FCOL_WHITE 0x07
-
-#define ATTR_BCOL_MASK 0x70
-#define ATTR_BCOL_BLACK 0x00
-#define ATTR_BCOL_BLUE 0x10
-#define ATTR_BCOL_GREEN 0x20
-#define ATTR_BCOL_CYAN 0x30
-#define ATTR_BCOL_RED 0x40
-#define ATTR_BCOL_MAGENTA 0x50
-#define ATTR_BCOL_YELLOW 0x60
-#define ATTR_BCOL_WHITE 0x70
-
-#define ATTR_DEFAULT ATTR_FCOL_WHITE
-
-/** Current character attribute */
-static unsigned int bios_attr = ATTR_DEFAULT;
-
-/**
- * Handle ANSI CUP (cursor position)
- *
- * @v count Parameter count
- * @v params[0] Row (1 is top)
- * @v params[1] Column (1 is left)
- */
-static void bios_handle_cup ( unsigned int count __unused, int params[] ) {
- int cx = ( params[1] - 1 );
- int cy = ( params[0] - 1 );
-
- if ( cx < 0 )
- cx = 0;
- if ( cy < 0 )
- cy = 0;
-
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- "int $0x10\n\t"
- "cli\n\t" )
- : : "a" ( 0x0200 ), "b" ( 1 ),
- "d" ( ( cy << 8 ) | cx ) );
-}
-
-/**
- * Handle ANSI ED (erase in page)
- *
- * @v count Parameter count
- * @v params[0] Region to erase
- */
-static void bios_handle_ed ( unsigned int count __unused,
- int params[] __unused ) {
- /* We assume that we always clear the whole screen */
- assert ( params[0] == ANSIESC_ED_ALL );
-
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- "int $0x10\n\t"
- "cli\n\t" )
- : : "a" ( 0x0600 ), "b" ( bios_attr << 8 ),
- "c" ( 0 ), "d" ( 0xffff ) );
-}
-
-/**
- * Handle ANSI SGR (set graphics rendition)
- *
- * @v count Parameter count
- * @v params List of graphic rendition aspects
- */
-static void bios_handle_sgr ( unsigned int count, int params[] ) {
- static const uint8_t bios_attr_fcols[10] = {
- ATTR_FCOL_BLACK, ATTR_FCOL_RED, ATTR_FCOL_GREEN,
- ATTR_FCOL_YELLOW, ATTR_FCOL_BLUE, ATTR_FCOL_MAGENTA,
- ATTR_FCOL_CYAN, ATTR_FCOL_WHITE,
- ATTR_FCOL_WHITE, ATTR_FCOL_WHITE /* defaults */
- };
- static const uint8_t bios_attr_bcols[10] = {
- ATTR_BCOL_BLACK, ATTR_BCOL_RED, ATTR_BCOL_GREEN,
- ATTR_BCOL_YELLOW, ATTR_BCOL_BLUE, ATTR_BCOL_MAGENTA,
- ATTR_BCOL_CYAN, ATTR_BCOL_WHITE,
- ATTR_BCOL_BLACK, ATTR_BCOL_BLACK /* defaults */
- };
- unsigned int i;
- int aspect;
-
- for ( i = 0 ; i < count ; i++ ) {
- aspect = params[i];
- if ( aspect == 0 ) {
- bios_attr = ATTR_DEFAULT;
- } else if ( aspect == 1 ) {
- bios_attr |= ATTR_BOLD;
- } else if ( aspect == 22 ) {
- bios_attr &= ~ATTR_BOLD;
- } else if ( ( aspect >= 30 ) && ( aspect <= 39 ) ) {
- bios_attr &= ~ATTR_FCOL_MASK;
- bios_attr |= bios_attr_fcols[ aspect - 30 ];
- } else if ( ( aspect >= 40 ) && ( aspect <= 49 ) ) {
- bios_attr &= ~ATTR_BCOL_MASK;
- bios_attr |= bios_attr_bcols[ aspect - 40 ];
- }
- }
-}
-
-/** BIOS console ANSI escape sequence handlers */
-static struct ansiesc_handler bios_ansiesc_handlers[] = {
- { ANSIESC_CUP, bios_handle_cup },
- { ANSIESC_ED, bios_handle_ed },
- { ANSIESC_SGR, bios_handle_sgr },
- { 0, NULL }
-};
-
-/** BIOS console ANSI escape sequence context */
-static struct ansiesc_context bios_ansiesc_ctx = {
- .handlers = bios_ansiesc_handlers,
-};
-
-/**
- * Print a character to BIOS console
- *
- * @v character Character to be printed
- */
-static void bios_putchar ( int character ) {
- int discard_a, discard_b, discard_c;
-
- /* Intercept ANSI escape sequences */
- character = ansiesc_process ( &bios_ansiesc_ctx, character );
- if ( character < 0 )
- return;
-
- /* Print character with attribute */
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- /* Skip non-printable characters */
- "cmpb $0x20, %%al\n\t"
- "jb 1f\n\t"
- /* Set attribute */
- "movw $0x0001, %%cx\n\t"
- "movb $0x09, %%ah\n\t"
- "int $0x10\n\t"
- "\n1:\n\t"
- /* Print character */
- "xorw %%bx, %%bx\n\t"
- "movb $0x0e, %%ah\n\t"
- "int $0x10\n\t"
- "cli\n\t" )
- : "=a" ( discard_a ), "=b" ( discard_b ),
- "=c" ( discard_c )
- : "a" ( character ), "b" ( bios_attr )
- : "ebp" );
-}
-
-/**
- * Pointer to current ANSI output sequence
- *
- * While we are in the middle of returning an ANSI sequence for a
- * special key, this will point to the next character to return. When
- * not in the middle of such a sequence, this will point to a NUL
- * (note: not "will be NULL").
- */
-static const char *ansi_input = "";
-
-/**
- * Lowest BIOS scancode of interest
- *
- * Most of the BIOS key scancodes that we are interested in are in a
- * dense range, so subtracting a constant and treating them as offsets
- * into an array works efficiently.
- */
-#define BIOS_KEY_MIN 0x42
-
-/** Offset into list of interesting BIOS scancodes */
-#define BIOS_KEY(scancode) ( (scancode) - BIOS_KEY_MIN )
-
-/** Mapping from BIOS scan codes to ANSI escape sequences */
-static const char *ansi_sequences[] = {
- [ BIOS_KEY ( 0x42 ) ] = "[19~", /* F8 (required for PXE) */
- [ BIOS_KEY ( 0x47 ) ] = "[H", /* Home */
- [ BIOS_KEY ( 0x48 ) ] = "[A", /* Up arrow */
- [ BIOS_KEY ( 0x4b ) ] = "[D", /* Left arrow */
- [ BIOS_KEY ( 0x4d ) ] = "[C", /* Right arrow */
- [ BIOS_KEY ( 0x4f ) ] = "[F", /* End */
- [ BIOS_KEY ( 0x50 ) ] = "[B", /* Down arrow */
- [ BIOS_KEY ( 0x53 ) ] = "[3~", /* Delete */
-};
-
-/**
- * Get ANSI escape sequence corresponding to BIOS scancode
- *
- * @v scancode BIOS scancode
- * @ret ansi_seq ANSI escape sequence, if any, otherwise NULL
- */
-static const char * scancode_to_ansi_seq ( unsigned int scancode ) {
- unsigned int bios_key = BIOS_KEY ( scancode );
-
- if ( bios_key < ( sizeof ( ansi_sequences ) /
- sizeof ( ansi_sequences[0] ) ) ) {
- return ansi_sequences[bios_key];
- }
- DBG ( "Unrecognised BIOS scancode %02x\n", scancode );
- return NULL;
-}
-
-/**
- * Get character from BIOS console
- *
- * @ret character Character read from console
- */
-static int bios_getchar ( void ) {
- uint16_t keypress;
- unsigned int character;
- const char *ansi_seq;
-
- /* If we are mid-sequence, pass out the next byte */
- if ( ( character = *ansi_input ) ) {
- ansi_input++;
- return character;
- }
-
- /* Read character from real BIOS console */
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- "int $0x16\n\t"
- "cli\n\t" )
- : "=a" ( keypress ) : "a" ( 0x1000 ) );
- character = ( keypress & 0xff );
-
- /* If it's a normal character, just return it */
- if ( character && ( character < 0x80 ) )
- return character;
-
- /* Otherwise, check for a special key that we know about */
- if ( ( ansi_seq = scancode_to_ansi_seq ( keypress >> 8 ) ) ) {
- /* Start of escape sequence: return ESC (0x1b) */
- ansi_input = ansi_seq;
- return 0x1b;
- }
-
- return 0;
-}
-
-/**
- * Check for character ready to read from BIOS console
- *
- * @ret True Character available to read
- * @ret False No character available to read
- */
-static int bios_iskey ( void ) {
- unsigned int discard_a;
- unsigned int flags;
-
- /* If we are mid-sequence, we are always ready */
- if ( *ansi_input )
- return 1;
-
- /* Otherwise check the real BIOS console */
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
- "int $0x16\n\t"
- "pushfw\n\t"
- "popw %w0\n\t"
- "cli\n\t" )
- : "=r" ( flags ), "=a" ( discard_a )
- : "a" ( 0x0100 ) );
- return ( ! ( flags & ZF ) );
-}
-
-struct console_driver bios_console __console_driver = {
- .putchar = bios_putchar,
- .getchar = bios_getchar,
- .iskey = bios_iskey,
-};
diff --git a/gpxe/src/arch/i386/firmware/pcbios/e820mangler.S b/gpxe/src/arch/i386/firmware/pcbios/e820mangler.S
deleted file mode 100644
index 99ca519b..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/e820mangler.S
+++ /dev/null
@@ -1,596 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER )
-
- .text
- .arch i386
- .code16
-
-#define SMAP 0x534d4150
-
-/* Most documentation refers to the E820 buffer as being 20 bytes, and
- * the API makes it perfectly legitimate to pass only a 20-byte buffer
- * and expect to get valid data. However, some morons at ACPI decided
- * to extend the data structure by adding an extra "extended
- * attributes" field and by including critical information within this
- * field, such as whether or not the region is enabled. A caller who
- * passes in only a 20-byte buffer therefore risks getting very, very
- * misleading information.
- *
- * I have personally witnessed an HP BIOS that returns a value of
- * 0x0009 in the extended attributes field. If we don't pass this
- * value through to the caller, 32-bit WinPE will die, usually with a
- * PAGE_FAULT_IN_NONPAGED_AREA blue screen of death.
- *
- * Allow a ridiculously large maximum value (64 bytes) for the E820
- * buffer as a guard against insufficiently creative idiots in the
- * future.
- */
-#define E820MAXSIZE 64
-
-/****************************************************************************
- *
- * Allowed memory windows
- *
- * There are two ways to view this list. The first is as a list of
- * (non-overlapping) allowed memory regions, sorted by increasing
- * address. The second is as a list of (non-overlapping) hidden
- * memory regions, again sorted by increasing address. The second
- * view is offset by half an entry from the first: think about this
- * for a moment and it should make sense.
- *
- * xxx_memory_window is used to indicate an "allowed region"
- * structure, hidden_xxx_memory is used to indicate a "hidden region"
- * structure. Each structure is 16 bytes in length.
- *
- ****************************************************************************
- */
- .section ".data16", "aw", @progbits
- .align 16
- .globl hidemem_base
- .globl hidemem_umalloc
- .globl hidemem_textdata
-memory_windows:
-base_memory_window: .long 0x00000000, 0x00000000 /* Start of memory */
-
-hidemem_base: .long 0x000a0000, 0x00000000 /* Changes at runtime */
-ext_memory_window: .long 0x000a0000, 0x00000000 /* 640kB mark */
-
-hidemem_umalloc: .long 0xffffffff, 0xffffffff /* Changes at runtime */
- .long 0xffffffff, 0xffffffff /* Changes at runtime */
-
-hidemem_textdata: .long 0xffffffff, 0xffffffff /* Changes at runtime */
- .long 0xffffffff, 0xffffffff /* Changes at runtime */
-
- .long 0xffffffff, 0xffffffff /* End of memory */
-memory_windows_end:
-
-/****************************************************************************
- * Truncate region to memory window
- *
- * Parameters:
- * %edx:%eax Start of region
- * %ecx:%ebx Length of region
- * %si Memory window
- * Returns:
- * %edx:%eax Start of windowed region
- * %ecx:%ebx Length of windowed region
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-window_region:
- /* Convert (start,len) to (start, end) */
- addl %eax, %ebx
- adcl %edx, %ecx
- /* Truncate to window start */
- cmpl 4(%si), %edx
- jne 1f
- cmpl 0(%si), %eax
-1: jae 2f
- movl 4(%si), %edx
- movl 0(%si), %eax
-2: /* Truncate to window end */
- cmpl 12(%si), %ecx
- jne 1f
- cmpl 8(%si), %ebx
-1: jbe 2f
- movl 12(%si), %ecx
- movl 8(%si), %ebx
-2: /* Convert (start, end) back to (start, len) */
- subl %eax, %ebx
- sbbl %edx, %ecx
- /* If length is <0, set length to 0 */
- jae 1f
- xorl %ebx, %ebx
- xorl %ecx, %ecx
- ret
- .size window_region, . - window_region
-
-/****************************************************************************
- * Patch "memory above 1MB" figure
- *
- * Parameters:
- * %ax Memory above 1MB, in 1kB blocks
- * Returns:
- * %ax Modified memory above 1M in 1kB blocks
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-patch_1m:
- pushal
- /* Convert to (start,len) format and call truncate */
- xorl %ecx, %ecx
- movzwl %ax, %ebx
- shll $10, %ebx
- xorl %edx, %edx
- movl $0x100000, %eax
- movw $ext_memory_window, %si
- call window_region
- /* Convert back to "memory above 1MB" format and return via %ax */
- pushfw
- shrl $10, %ebx
- popfw
- movw %sp, %bp
- movw %bx, 28(%bp)
- popal
- ret
- .size patch_1m, . - patch_1m
-
-/****************************************************************************
- * Patch "memory above 16MB" figure
- *
- * Parameters:
- * %bx Memory above 16MB, in 64kB blocks
- * Returns:
- * %bx Modified memory above 16M in 64kB blocks
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-patch_16m:
- pushal
- /* Convert to (start,len) format and call truncate */
- xorl %ecx, %ecx
- shll $16, %ebx
- xorl %edx, %edx
- movl $0x1000000, %eax
- movw $ext_memory_window, %si
- call window_region
- /* Convert back to "memory above 16MB" format and return via %bx */
- pushfw
- shrl $16, %ebx
- popfw
- movw %sp, %bp
- movw %bx, 16(%bp)
- popal
- ret
- .size patch_16m, . - patch_16m
-
-/****************************************************************************
- * Patch "memory between 1MB and 16MB" and "memory above 16MB" figures
- *
- * Parameters:
- * %ax Memory between 1MB and 16MB, in 1kB blocks
- * %bx Memory above 16MB, in 64kB blocks
- * Returns:
- * %ax Modified memory between 1MB and 16MB, in 1kB blocks
- * %bx Modified memory above 16MB, in 64kB blocks
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-patch_1m_16m:
- call patch_1m
- call patch_16m
- /* If 1M region is no longer full-length, kill off the 16M region */
- cmpw $( 15 * 1024 ), %ax
- je 1f
- xorw %bx, %bx
-1: ret
- .size patch_1m_16m, . - patch_1m_16m
-
-/****************************************************************************
- * Get underlying e820 memory region to underlying_e820 buffer
- *
- * Parameters:
- * As for INT 15,e820
- * Returns:
- * As for INT 15,e820
- *
- * Wraps the underlying INT 15,e820 call so that the continuation
- * value (%ebx) is a 16-bit simple sequence counter (with the high 16
- * bits ignored), and termination is always via CF=1 rather than
- * %ebx=0.
- *
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-get_underlying_e820:
-
- /* If the requested region is in the cache, return it */
- cmpw %bx, underlying_e820_index
- jne 2f
- pushw %di
- pushw %si
- movw $underlying_e820_cache, %si
- cmpl underlying_e820_cache_size, %ecx
- jbe 1f
- movl underlying_e820_cache_size, %ecx
-1: pushl %ecx
- rep movsb
- popl %ecx
- popw %si
- popw %di
- incw %bx
- movl %edx, %eax
- clc
- ret
-2:
- /* If the requested region is earlier than the cached region,
- * invalidate the cache.
- */
- cmpw %bx, underlying_e820_index
- jbe 1f
- movw $0xffff, underlying_e820_index
-1:
- /* If the cache is invalid, reset the underlying %ebx */
- cmpw $0xffff, underlying_e820_index
- jne 1f
- andl $0, underlying_e820_ebx
-1:
- /* If the cache is valid but the continuation value is zero,
- * this means that the previous underlying call returned with
- * %ebx=0. Return with CF=1 in this case.
- */
- cmpw $0xffff, underlying_e820_index
- je 1f
- cmpl $0, underlying_e820_ebx
- jne 1f
- stc
- ret
-1:
- /* Get the next region into the cache */
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushl %esi /* Some implementations corrupt %esi, so we */
- pushl %edi /* preserve %esi, %edi and %ebp to be paranoid */
- pushl %ebp
- pushw %es
- pushw %ds
- popw %es
- movw $underlying_e820_cache, %di
- cmpl $E820MAXSIZE, %ecx
- jbe 1f
- movl $E820MAXSIZE, %ecx
-1: movl underlying_e820_ebx, %ebx
- stc
- pushfw
- lcall *%cs:int15_vector
- popw %es
- popl %ebp
- popl %edi
- popl %esi
- /* Check for error return from underlying e820 call */
- jc 2f /* CF set: error */
- cmpl $SMAP, %eax
- je 3f /* 'SMAP' missing: error */
-2: /* An error occurred: return values returned by underlying e820 call */
- stc /* Force CF set if SMAP was missing */
- addr32 leal 16(%esp), %esp /* avoid changing other flags */
- ret
-3: /* No error occurred */
- movl %ebx, underlying_e820_ebx
- movl %ecx, underlying_e820_cache_size
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
- /* Mark cache as containing this result */
- incw underlying_e820_index
-
- /* Loop until found */
- jmp get_underlying_e820
- .size get_underlying_e820, . - get_underlying_e820
-
- .section ".data16", "aw", @progbits
-underlying_e820_index:
- .word 0xffff /* Initialise to an invalid value */
- .size underlying_e820_index, . - underlying_e820_index
-
- .section ".bss16", "aw", @nobits
-underlying_e820_ebx:
- .long 0
- .size underlying_e820_ebx, . - underlying_e820_ebx
-
- .section ".bss16", "aw", @nobits
-underlying_e820_cache:
- .space E820MAXSIZE
- .size underlying_e820_cache, . - underlying_e820_cache
-
- .section ".bss16", "aw", @nobits
-underlying_e820_cache_size:
- .long 0
- .size underlying_e820_cache_size, . - underlying_e820_cache_size
-
-/****************************************************************************
- * Get windowed e820 region, without empty region stripping
- *
- * Parameters:
- * As for INT 15,e820
- * Returns:
- * As for INT 15,e820
- *
- * Wraps the underlying INT 15,e820 call so that each underlying
- * region is returned N times, windowed to fit within N visible-memory
- * windows. Termination is always via CF=1.
- *
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-get_windowed_e820:
-
- /* Preserve registers */
- pushl %esi
- pushw %bp
-
- /* Split %ebx into %si:%bx, store original %bx in %bp */
- pushl %ebx
- popw %bp
- popw %si
-
- /* %si == 0 => start of memory_windows list */
- testw %si, %si
- jne 1f
- movw $memory_windows, %si
-1:
- /* Get (cached) underlying e820 region to buffer */
- call get_underlying_e820
- jc 99f /* Abort on error */
-
- /* Preserve registers */
- pushal
- /* start => %edx:%eax, len => %ecx:%ebx */
- movl %es:0(%di), %eax
- movl %es:4(%di), %edx
- movl %es:8(%di), %ebx
- movl %es:12(%di), %ecx
- /* Truncate region to current window */
- call window_region
-1: /* Store modified values in e820 map entry */
- movl %eax, %es:0(%di)
- movl %edx, %es:4(%di)
- movl %ebx, %es:8(%di)
- movl %ecx, %es:12(%di)
- /* Restore registers */
- popal
-
- /* Derive continuation value for next call */
- addw $16, %si
- cmpw $memory_windows_end, %si
- jne 1f
- /* End of memory windows: reset %si and allow %bx to continue */
- xorw %si, %si
- jmp 2f
-1: /* More memory windows to go: restore original %bx */
- movw %bp, %bx
-2: /* Construct %ebx from %si:%bx */
- pushw %si
- pushw %bx
- popl %ebx
-
-98: /* Clear CF */
- clc
-99: /* Restore registers and return */
- popw %bp
- popl %esi
- ret
- .size get_windowed_e820, . - get_windowed_e820
-
-/****************************************************************************
- * Get windowed e820 region, with empty region stripping
- *
- * Parameters:
- * As for INT 15,e820
- * Returns:
- * As for INT 15,e820
- *
- * Wraps the underlying INT 15,e820 call so that each underlying
- * region is returned up to N times, windowed to fit within N
- * visible-memory windows. Empty windows are never returned.
- * Termination is always via CF=1.
- *
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-get_nonempty_e820:
-
- /* Record entry parameters */
- pushl %eax
- pushl %ecx
- pushl %edx
-
- /* Get next windowed region */
- call get_windowed_e820
- jc 99f /* abort on error */
-
- /* If region is non-empty, finish here */
- cmpl $0, %es:8(%di)
- jne 98f
- cmpl $0, %es:12(%di)
- jne 98f
-
- /* Region was empty: restore entry parameters and go to next region */
- popl %edx
- popl %ecx
- popl %eax
- jmp get_nonempty_e820
-
-98: /* Clear CF */
- clc
-99: /* Return values from underlying call */
- addr32 leal 12(%esp), %esp /* avoid changing flags */
- ret
- .size get_nonempty_e820, . - get_nonempty_e820
-
-/****************************************************************************
- * Get mangled e820 region, with empty region stripping
- *
- * Parameters:
- * As for INT 15,e820
- * Returns:
- * As for INT 15,e820
- *
- * Wraps the underlying INT 15,e820 call so that underlying regions
- * are windowed to the allowed memory regions. Empty regions are
- * stripped from the map. Termination is always via %ebx=0.
- *
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-get_mangled_e820:
-
- /* Get a nonempty region */
- call get_nonempty_e820
- jc 99f /* Abort on error */
-
- /* Peek ahead to see if there are any further nonempty regions */
- pushal
- pushw %es
- movw %sp, %bp
- subw %cx, %sp
- movl $0xe820, %eax
- movl $SMAP, %edx
- pushw %ss
- popw %es
- movw %sp, %di
- call get_nonempty_e820
- movw %bp, %sp
- popw %es
- popal
- jnc 99f /* There are further nonempty regions */
-
- /* No futher nonempty regions: zero %ebx and clear CF */
- xorl %ebx, %ebx
-
-99: /* Return */
- ret
- .size get_mangled_e820, . - get_mangled_e820
-
-/****************************************************************************
- * Set/clear CF on the stack as appropriate, assumes stack is as it should
- * be immediately before IRET
- ****************************************************************************
- */
-patch_cf:
- pushw %bp
- movw %sp, %bp
- setc 8(%bp) /* Set/reset CF; clears PF, AF, ZF, SF */
- popw %bp
- ret
-
-/****************************************************************************
- * INT 15,e820 handler
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-int15_e820:
- pushw %ds
- pushw %cs:rm_ds
- popw %ds
- call get_mangled_e820
- popw %ds
- call patch_cf
- iret
- .size int15_e820, . - int15_e820
-
-/****************************************************************************
- * INT 15,e801 handler
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-int15_e801:
- /* Call previous handler */
- pushfw
- lcall *%cs:int15_vector
- call patch_cf
- /* Edit result */
- pushw %ds
- pushw %cs:rm_ds
- popw %ds
- call patch_1m_16m
- xchgw %ax, %cx
- xchgw %bx, %dx
- call patch_1m_16m
- xchgw %ax, %cx
- xchgw %bx, %dx
- popw %ds
- iret
- .size int15_e801, . - int15_e801
-
-/****************************************************************************
- * INT 15,88 handler
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
-int15_88:
- /* Call previous handler */
- pushfw
- lcall *%cs:int15_vector
- call patch_cf
- /* Edit result */
- pushw %ds
- pushw %cs:rm_ds
- popw %ds
- call patch_1m
- popw %ds
- iret
- .size int15_88, . - int15_88
-
-/****************************************************************************
- * INT 15 handler
- ****************************************************************************
- */
- .section ".text16", "ax", @progbits
- .globl int15
-int15:
- /* See if we want to intercept this call */
- pushfw
- cmpw $0xe820, %ax
- jne 1f
- cmpl $SMAP, %edx
- jne 1f
- popfw
- jmp int15_e820
-1: cmpw $0xe801, %ax
- jne 2f
- popfw
- jmp int15_e801
-2: cmpb $0x88, %ah
- jne 3f
- popfw
- jmp int15_88
-3: popfw
- ljmp *%cs:int15_vector
- .size int15, . - int15
-
- .section ".text16.data", "aw", @progbits
- .globl int15_vector
-int15_vector:
- .long 0
- .size int15_vector, . - int15_vector
diff --git a/gpxe/src/arch/i386/firmware/pcbios/fakee820.c b/gpxe/src/arch/i386/firmware/pcbios/fakee820.c
deleted file mode 100644
index ea116fe5..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/fakee820.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <realmode.h>
-#include <biosint.h>
-
-/** Assembly routine in inline asm */
-extern void int15_fakee820();
-
-/** Original INT 15 handler */
-static struct segoff __text16 ( real_int15_vector );
-#define real_int15_vector __use_text16 ( real_int15_vector )
-
-/** An INT 15,e820 memory map entry */
-struct e820_entry {
- /** Start of region */
- uint64_t start;
- /** Length of region */
- uint64_t len;
- /** Type of region */
- uint32_t type;
-} __attribute__ (( packed ));
-
-#define E820_TYPE_RAM 1 /**< Normal memory */
-#define E820_TYPE_RSVD 2 /**< Reserved and unavailable */
-#define E820_TYPE_ACPI 3 /**< ACPI reclaim memory */
-#define E820_TYPE_NVS 4 /**< ACPI NVS memory */
-
-/** Fake e820 map */
-static struct e820_entry __text16_array ( e820map, [] ) __used = {
- { 0x00000000ULL, ( 0x000a0000ULL - 0x00000000ULL ), E820_TYPE_RAM },
- { 0x00100000ULL, ( 0xcfb50000ULL - 0x00100000ULL ), E820_TYPE_RAM },
- { 0xcfb50000ULL, ( 0xcfb64000ULL - 0xcfb50000ULL ), E820_TYPE_RSVD },
- { 0xcfb64000ULL, ( 0xcfb66000ULL - 0xcfb64000ULL ), E820_TYPE_RSVD },
- { 0xcfb66000ULL, ( 0xcfb85c00ULL - 0xcfb66000ULL ), E820_TYPE_ACPI },
- { 0xcfb85c00ULL, ( 0xd0000000ULL - 0xcfb85c00ULL ), E820_TYPE_RSVD },
- { 0xe0000000ULL, ( 0xf0000000ULL - 0xe0000000ULL ), E820_TYPE_RSVD },
- { 0xfe000000ULL, (0x100000000ULL - 0xfe000000ULL ), E820_TYPE_RSVD },
- {0x100000000ULL, (0x230000000ULL -0x100000000ULL ), E820_TYPE_RAM },
-};
-#define e820map __use_text16 ( e820map )
-
-void fake_e820 ( void ) {
- __asm__ __volatile__ (
- TEXT16_CODE ( "\nint15_fakee820:\n\t"
- "pushfw\n\t"
- "cmpl $0xe820, %%eax\n\t"
- "jne 99f\n\t"
- "cmpl $0x534d4150, %%edx\n\t"
- "jne 99f\n\t"
- "pushaw\n\t"
- "movw %%sp, %%bp\n\t"
- "andb $~0x01, 22(%%bp)\n\t" /* Clear return CF */
- "leaw e820map(%%bx), %%si\n\t"
- "cs rep movsb\n\t"
- "popaw\n\t"
- "movl %%edx, %%eax\n\t"
- "addl $20, %%ebx\n\t"
- "cmpl %0, %%ebx\n\t"
- "jne 1f\n\t"
- "xorl %%ebx,%%ebx\n\t"
- "\n1:\n\t"
- "popfw\n\t"
- "iret\n\t"
- "\n99:\n\t"
- "popfw\n\t"
- "ljmp *%%cs:real_int15_vector\n\t" )
- : : "i" ( sizeof ( e820map ) ) );
-
- hook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
- &real_int15_vector );
-}
-
-void unfake_e820 ( void ) {
- unhook_bios_interrupt ( 0x15, ( unsigned int ) int15_fakee820,
- &real_int15_vector );
-}
diff --git a/gpxe/src/arch/i386/firmware/pcbios/gateA20.c b/gpxe/src/arch/i386/firmware/pcbios/gateA20.c
deleted file mode 100644
index 1a71472d..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/gateA20.c
+++ /dev/null
@@ -1,176 +0,0 @@
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdio.h>
-#include <realmode.h>
-#include <bios.h>
-#include <gpxe/io.h>
-#include <gpxe/timer.h>
-
-#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 KC_CMD_NULL 0xff /* null command ("pulse nothing") */
-#define KB_SET_A20 0xdf /* enable A20,
- enable output buffer full interrupt
- enable data line
- disable clock line */
-#define KB_UNSET_A20 0xdd /* enable A20,
- enable output buffer full interrupt
- enable data line
- disable clock line */
-
-#define SCP_A 0x92 /* System Control Port A */
-
-enum { Disable_A20 = 0x2400, Enable_A20 = 0x2401, Query_A20_Status = 0x2402,
- Query_A20_Support = 0x2403 };
-
-enum a20_methods {
- A20_UNKNOWN = 0,
- A20_INT15,
- A20_KBC,
- A20_SCPA,
-};
-
-#define A20_MAX_RETRIES 32
-#define A20_INT15_RETRIES 32
-#define A20_KBC_RETRIES (2^21)
-#define A20_SCPA_RETRIES (2^21)
-
-/**
- * Drain keyboard controller
- */
-static void empty_8042 ( void ) {
- unsigned long time;
-
- time = currticks() + TICKS_PER_SEC; /* max wait of 1 second */
- while ( ( inb ( K_CMD ) & ( K_IBUF_FUL | K_OBUF_FUL ) ) &&
- currticks() < time ) {
- iodelay();
- ( void ) inb_p ( K_RDWR );
- iodelay();
- }
-}
-
-/**
- * Fast test to see if gate A20 is already set
- *
- * @v retries Number of times to retry before giving up
- * @ret set Gate A20 is set
- */
-static int gateA20_is_set ( int retries ) {
- static uint32_t test_pattern = 0xdeadbeef;
- physaddr_t test_pattern_phys = virt_to_phys ( &test_pattern );
- physaddr_t verify_pattern_phys = ( test_pattern_phys ^ 0x100000 );
- userptr_t verify_pattern_user = phys_to_user ( verify_pattern_phys );
- uint32_t verify_pattern;
-
- do {
- /* Check for difference */
- copy_from_user ( &verify_pattern, verify_pattern_user, 0,
- sizeof ( verify_pattern ) );
- if ( verify_pattern != test_pattern )
- return 1;
-
- /* Avoid false negatives */
- test_pattern++;
-
- iodelay();
-
- /* Always retry at least once, to avoid false negatives */
- } while ( retries-- >= 0 );
-
- /* Pattern matched every time; gate A20 is not set */
- return 0;
-}
-
-/*
- * Gate A20 for high memory
- *
- * Note that this function gets called as part of the return path from
- * librm's real_call, which is used to make the int15 call if librm is
- * being used. To avoid an infinite recursion, we make gateA20_set
- * return immediately if it is already part of the call stack.
- */
-void gateA20_set ( void ) {
- static char reentry_guard = 0;
- static int a20_method = A20_UNKNOWN;
- unsigned int discard_a;
- unsigned int scp_a;
- int retries = 0;
-
- /* Avoid potential infinite recursion */
- if ( reentry_guard )
- return;
- reentry_guard = 1;
-
- /* Fast check to see if gate A20 is already enabled */
- if ( gateA20_is_set ( 0 ) )
- goto out;
-
- for ( ; retries < A20_MAX_RETRIES ; retries++ ) {
- switch ( a20_method ) {
- case A20_UNKNOWN:
- case A20_INT15:
- /* Try INT 15 method */
- __asm__ __volatile__ ( REAL_CODE ( "int $0x15" )
- : "=a" ( discard_a )
- : "a" ( Enable_A20 ) );
- if ( gateA20_is_set ( A20_INT15_RETRIES ) ) {
- DBG ( "Enabled gate A20 using BIOS\n" );
- a20_method = A20_INT15;
- goto out;
- }
- /* fall through */
- case A20_KBC:
- /* Try keyboard controller method */
- empty_8042();
- outb ( KC_CMD_WOUT, K_CMD );
- empty_8042();
- outb ( KB_SET_A20, K_RDWR );
- empty_8042();
- outb ( KC_CMD_NULL, K_CMD );
- empty_8042();
- if ( gateA20_is_set ( A20_KBC_RETRIES ) ) {
- DBG ( "Enabled gate A20 using "
- "keyboard controller\n" );
- a20_method = A20_KBC;
- goto out;
- }
- /* fall through */
- case A20_SCPA:
- /* Try "Fast gate A20" method */
- scp_a = inb ( SCP_A );
- scp_a &= ~0x01; /* Avoid triggering a reset */
- scp_a |= 0x02; /* Enable A20 */
- iodelay();
- outb ( scp_a, SCP_A );
- iodelay();
- if ( gateA20_is_set ( A20_SCPA_RETRIES ) ) {
- DBG ( "Enabled gate A20 using "
- "Fast Gate A20\n" );
- a20_method = A20_SCPA;
- goto out;
- }
- }
- }
-
- /* Better to die now than corrupt memory later */
- printf ( "FATAL: Gate A20 stuck\n" );
- while ( 1 ) {}
-
- out:
- if ( retries )
- DBG ( "%d attempts were required to enable A20\n",
- ( retries + 1 ) );
- reentry_guard = 0;
-}
-
-void gateA20_unset ( void ) {
- /* Not currently implemented */
-}
diff --git a/gpxe/src/arch/i386/firmware/pcbios/hidemem.c b/gpxe/src/arch/i386/firmware/pcbios/hidemem.c
deleted file mode 100644
index 17082c35..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/hidemem.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <assert.h>
-#include <realmode.h>
-#include <biosint.h>
-#include <basemem.h>
-#include <fakee820.h>
-#include <gpxe/init.h>
-#include <gpxe/memmap.h>
-#include <gpxe/hidemem.h>
-
-/** Set to true if you want to test a fake E820 map */
-#define FAKE_E820 0
-
-/** Alignment for hidden memory regions */
-#define ALIGN_HIDDEN 4096 /* 4kB page alignment should be enough */
-
-/**
- * A hidden region of gPXE
- *
- * This represents a region that will be edited out of the system's
- * memory map.
- *
- * This structure is accessed by assembly code, so must not be
- * changed.
- */
-struct hidden_region {
- /** Physical start address */
- uint64_t start;
- /** Physical end address */
- uint64_t end;
-};
-
-/** Hidden base memory */
-extern struct hidden_region __data16 ( hidemem_base );
-#define hidemem_base __use_data16 ( hidemem_base )
-
-/** Hidden umalloc memory */
-extern struct hidden_region __data16 ( hidemem_umalloc );
-#define hidemem_umalloc __use_data16 ( hidemem_umalloc )
-
-/** Hidden text memory */
-extern struct hidden_region __data16 ( hidemem_textdata );
-#define hidemem_textdata __use_data16 ( hidemem_textdata )
-
-/** Assembly routine in e820mangler.S */
-extern void int15();
-
-/** Vector for storing original INT 15 handler */
-extern struct segoff __text16 ( int15_vector );
-#define int15_vector __use_text16 ( int15_vector )
-
-/* The linker defines these symbols for us */
-extern char _textdata[];
-extern char _etextdata[];
-extern char _text16_memsz[];
-#define _text16_memsz ( ( unsigned int ) _text16_memsz )
-extern char _data16_memsz[];
-#define _data16_memsz ( ( unsigned int ) _data16_memsz )
-
-/**
- * Hide region of memory from system memory map
- *
- * @v region Hidden memory region
- * @v start Start of region
- * @v end End of region
- */
-static void hide_region ( struct hidden_region *region,
- physaddr_t start, physaddr_t end ) {
-
- /* Some operating systems get a nasty shock if a region of the
- * E820 map seems to start on a non-page boundary. Make life
- * safer by rounding out our edited region.
- */
- region->start = ( start & ~( ALIGN_HIDDEN - 1 ) );
- region->end = ( ( end + ALIGN_HIDDEN - 1 ) & ~( ALIGN_HIDDEN - 1 ) );
-
- DBG ( "Hiding region [%llx,%llx)\n", region->start, region->end );
-}
-
-/**
- * Hide used base memory
- *
- */
-void hide_basemem ( void ) {
- /* Hide from the top of free base memory to 640kB. Don't use
- * hide_region(), because we don't want this rounded to the
- * nearest page boundary.
- */
- hidemem_base.start = ( get_fbms() * 1024 );
-}
-
-/**
- * Hide umalloc() region
- *
- */
-void hide_umalloc ( physaddr_t start, physaddr_t end ) {
- assert ( end <= virt_to_phys ( _textdata ) );
- hide_region ( &hidemem_umalloc, start, end );
-}
-
-/**
- * Hide .text and .data
- *
- */
-void hide_textdata ( void ) {
- hide_region ( &hidemem_textdata, virt_to_phys ( _textdata ),
- virt_to_phys ( _etextdata ) );
-}
-
-/**
- * Hide Etherboot
- *
- * Installs an INT 15 handler to edit Etherboot out of the memory map
- * returned by the BIOS.
- */
-static void hide_etherboot ( void ) {
- struct memory_map memmap;
- unsigned int rm_ds_top;
- unsigned int rm_cs_top;
- unsigned int fbms;
-
- /* Dump memory map before mangling */
- DBG ( "Hiding gPXE from system memory map\n" );
- get_memmap ( &memmap );
-
- /* Hook in fake E820 map, if we're testing one */
- if ( FAKE_E820 ) {
- DBG ( "Hooking in fake E820 map\n" );
- fake_e820();
- get_memmap ( &memmap );
- }
-
- /* Initialise the hidden regions */
- hide_basemem();
- hide_umalloc ( virt_to_phys ( _textdata ), virt_to_phys ( _textdata ) );
- hide_textdata();
-
- /* Some really moronic BIOSes bring up the PXE stack via the
- * UNDI loader entry point and then don't bother to unload it
- * before overwriting the code and data segments. If this
- * happens, we really don't want to leave INT 15 hooked,
- * because that will cause any loaded OS to die horribly as
- * soon as it attempts to fetch the system memory map.
- *
- * We use a heuristic to guess whether or not we are being
- * loaded sensibly.
- */
- rm_cs_top = ( ( ( rm_cs << 4 ) + _text16_memsz + 1024 - 1 ) >> 10 );
- rm_ds_top = ( ( ( rm_ds << 4 ) + _data16_memsz + 1024 - 1 ) >> 10 );
- fbms = get_fbms();
- if ( ( rm_cs_top < fbms ) && ( rm_ds_top < fbms ) ) {
- DBG ( "Detected potentially unsafe UNDI load at CS=%04x "
- "DS=%04x FBMS=%dkB\n", rm_cs, rm_ds, fbms );
- DBG ( "Disabling INT 15 memory hiding\n" );
- return;
- }
-
- /* Hook INT 15 */
- hook_bios_interrupt ( 0x15, ( unsigned int ) int15,
- &int15_vector );
-
- /* Dump memory map after mangling */
- DBG ( "Hidden gPXE from system memory map\n" );
- get_memmap ( &memmap );
-}
-
-/**
- * Unhide Etherboot
- *
- * Uninstalls the INT 15 handler installed by hide_etherboot(), if
- * possible.
- */
-static void unhide_etherboot ( int flags __unused ) {
-
- /* If we have more than one hooked interrupt at this point, it
- * means that some other vector is still hooked, in which case
- * we can't safely unhook INT 15 because we need to keep our
- * memory protected. (We expect there to be at least one
- * hooked interrupt, because INT 15 itself is still hooked).
- */
- if ( hooked_bios_interrupts > 1 ) {
- DBG ( "Cannot unhide: %d interrupt vectors still hooked\n",
- hooked_bios_interrupts );
- return;
- }
-
- /* Try to unhook INT 15. If it fails, then just leave it
- * hooked; it takes care of protecting itself. :)
- */
- unhook_bios_interrupt ( 0x15, ( unsigned int ) int15,
- &int15_vector );
-
- /* Unhook fake E820 map, if used */
- if ( FAKE_E820 )
- unfake_e820();
-}
-
-/** Hide Etherboot startup function */
-struct startup_fn hide_etherboot_startup_fn __startup_fn ( STARTUP_EARLY ) = {
- .startup = hide_etherboot,
- .shutdown = unhide_etherboot,
-};
diff --git a/gpxe/src/arch/i386/firmware/pcbios/memmap.c b/gpxe/src/arch/i386/firmware/pcbios/memmap.c
deleted file mode 100644
index 8a30dbae..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/memmap.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <errno.h>
-#include <realmode.h>
-#include <bios.h>
-#include <memsizes.h>
-#include <gpxe/memmap.h>
-
-/**
- * @file
- *
- * Memory mapping
- *
- */
-
-/** Magic value for INT 15,e820 calls */
-#define SMAP ( 0x534d4150 )
-
-/** An INT 15,e820 memory map entry */
-struct e820_entry {
- /** Start of region */
- uint64_t start;
- /** Length of region */
- uint64_t len;
- /** Type of region */
- uint32_t type;
- /** Extended attributes (optional) */
- uint32_t attrs;
-} __attribute__ (( packed ));
-
-#define E820_TYPE_RAM 1 /**< Normal memory */
-#define E820_TYPE_RESERVED 2 /**< Reserved and unavailable */
-#define E820_TYPE_ACPI 3 /**< ACPI reclaim memory */
-#define E820_TYPE_NVS 4 /**< ACPI NVS memory */
-
-#define E820_ATTR_ENABLED 0x00000001UL
-#define E820_ATTR_NONVOLATILE 0x00000002UL
-#define E820_ATTR_UNKNOWN 0xfffffffcUL
-
-#define E820_MIN_SIZE 20
-
-/** Buffer for INT 15,e820 calls */
-static struct e820_entry __bss16 ( e820buf );
-#define e820buf __use_data16 ( e820buf )
-
-/**
- * Get size of extended memory via INT 15,e801
- *
- * @ret extmem Extended memory size, in kB, or 0
- */
-static unsigned int extmemsize_e801 ( void ) {
- uint16_t extmem_1m_to_16m_k, extmem_16m_plus_64k;
- uint16_t confmem_1m_to_16m_k, confmem_16m_plus_64k;
- unsigned int flags;
- unsigned int extmem;
-
- __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
- "int $0x15\n\t"
- "pushfw\n\t"
- "popw %w0\n\t" )
- : "=r" ( flags ),
- "=a" ( extmem_1m_to_16m_k ),
- "=b" ( extmem_16m_plus_64k ),
- "=c" ( confmem_1m_to_16m_k ),
- "=d" ( confmem_16m_plus_64k )
- : "a" ( 0xe801 ) );
-
- if ( flags & CF ) {
- DBG ( "INT 15,e801 failed with CF set\n" );
- return 0;
- }
-
- if ( ! ( extmem_1m_to_16m_k | extmem_16m_plus_64k ) ) {
- DBG ( "INT 15,e801 extmem=0, using confmem\n" );
- extmem_1m_to_16m_k = confmem_1m_to_16m_k;
- extmem_16m_plus_64k = confmem_16m_plus_64k;
- }
-
- extmem = ( extmem_1m_to_16m_k + ( extmem_16m_plus_64k * 64 ) );
- DBG ( "INT 15,e801 extended memory size %d+64*%d=%d kB "
- "[100000,%llx)\n", extmem_1m_to_16m_k, extmem_16m_plus_64k,
- extmem, ( 0x100000 + ( ( ( uint64_t ) extmem ) * 1024 ) ) );
-
- /* Sanity check. Some BIOSes report the entire 4GB address
- * space as available, which cannot be correct (since that
- * would leave no address space available for 32-bit PCI
- * BARs).
- */
- if ( extmem == ( 0x400000 - 0x400 ) ) {
- DBG ( "INT 15,e801 reported whole 4GB; assuming insane\n" );
- return 0;
- }
-
- return extmem;
-}
-
-/**
- * Get size of extended memory via INT 15,88
- *
- * @ret extmem Extended memory size, in kB
- */
-static unsigned int extmemsize_88 ( void ) {
- uint16_t extmem;
-
- /* Ignore CF; it is not reliable for this call */
- __asm__ __volatile__ ( REAL_CODE ( "int $0x15" )
- : "=a" ( extmem ) : "a" ( 0x8800 ) );
-
- DBG ( "INT 15,88 extended memory size %d kB [100000, %x)\n",
- extmem, ( 0x100000 + ( extmem * 1024 ) ) );
- return extmem;
-}
-
-/**
- * Get size of extended memory
- *
- * @ret extmem Extended memory size, in kB
- *
- * Note that this is only an approximation; for an accurate picture,
- * use the E820 memory map obtained via get_memmap();
- */
-unsigned int extmemsize ( void ) {
- unsigned int extmem;
-
- /* Try INT 15,e801 first, then fall back to INT 15,88 */
- extmem = extmemsize_e801();
- if ( ! extmem )
- extmem = extmemsize_88();
- return extmem;
-}
-
-/**
- * Get e820 memory map
- *
- * @v memmap Memory map to fill in
- * @ret rc Return status code
- */
-static int meme820 ( struct memory_map *memmap ) {
- struct memory_region *region = memmap->regions;
- uint32_t next = 0;
- uint32_t smap;
- size_t size;
- unsigned int flags;
- unsigned int discard_D;
-
- /* Clear the E820 buffer. Do this once before starting,
- * rather than on each call; some BIOSes rely on the contents
- * being preserved between calls.
- */
- memset ( &e820buf, 0, sizeof ( e820buf ) );
-
- do {
- /* Some BIOSes corrupt %esi for fun. Guard against
- * this by telling gcc that all non-output registers
- * may be corrupted.
- */
- __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t"
- "stc\n\t"
- "int $0x15\n\t"
- "pushfw\n\t"
- "popw %%dx\n\t"
- "popl %%ebp\n\t" )
- : "=a" ( smap ), "=b" ( next ),
- "=c" ( size ), "=d" ( flags ),
- "=D" ( discard_D )
- : "a" ( 0xe820 ), "b" ( next ),
- "D" ( __from_data16 ( &e820buf ) ),
- "c" ( sizeof ( e820buf ) ),
- "d" ( SMAP )
- : "esi", "memory" );
-
- if ( smap != SMAP ) {
- DBG ( "INT 15,e820 failed SMAP signature check\n" );
- return -ENOTSUP;
- }
-
- if ( size < E820_MIN_SIZE ) {
- DBG ( "INT 15,e820 returned only %zd bytes\n", size );
- return -EINVAL;
- }
-
- if ( flags & CF ) {
- DBG ( "INT 15,e820 terminated on CF set\n" );
- break;
- }
-
- /* If first region is not RAM, assume map is invalid */
- if ( ( memmap->count == 0 ) &&
- ( e820buf.type != E820_TYPE_RAM ) ) {
- DBG ( "INT 15,e820 failed, first entry not RAM\n" );
- return -EINVAL;
- }
-
- DBG ( "INT 15,e820 region [%llx,%llx) type %d",
- e820buf.start, ( e820buf.start + e820buf.len ),
- ( int ) e820buf.type );
- if ( size > offsetof ( typeof ( e820buf ), attrs ) ) {
- DBG ( " (%s", ( ( e820buf.attrs & E820_ATTR_ENABLED )
- ? "enabled" : "disabled" ) );
- if ( e820buf.attrs & E820_ATTR_NONVOLATILE )
- DBG ( ", non-volatile" );
- if ( e820buf.attrs & E820_ATTR_UNKNOWN )
- DBG ( ", other [%08x]", e820buf.attrs );
- DBG ( ")" );
- }
- DBG ( "\n" );
-
- /* Discard non-RAM regions */
- if ( e820buf.type != E820_TYPE_RAM )
- continue;
-
- /* Check extended attributes, if present */
- if ( size > offsetof ( typeof ( e820buf ), attrs ) ) {
- if ( ! ( e820buf.attrs & E820_ATTR_ENABLED ) )
- continue;
- if ( e820buf.attrs & E820_ATTR_NONVOLATILE )
- continue;
- }
-
- region->start = e820buf.start;
- region->end = e820buf.start + e820buf.len;
- region++;
- memmap->count++;
-
- if ( memmap->count >= ( sizeof ( memmap->regions ) /
- sizeof ( memmap->regions[0] ) ) ) {
- DBG ( "INT 15,e820 too many regions returned\n" );
- /* Not a fatal error; what we've got so far at
- * least represents valid regions of memory,
- * even if we couldn't get them all.
- */
- break;
- }
- } while ( next != 0 );
-
- /* Sanity checks. Some BIOSes report complete garbage via INT
- * 15,e820 (especially at POST time), despite passing the
- * signature checks. We currently check for a base memory
- * region (starting at 0) and at least one high memory region
- * (starting at 0x100000).
- */
- if ( memmap->count < 2 ) {
- DBG ( "INT 15,e820 returned only %d regions; assuming "
- "insane\n", memmap->count );
- return -EINVAL;
- }
- if ( memmap->regions[0].start != 0 ) {
- DBG ( "INT 15,e820 region 0 starts at %llx (expected 0); "
- "assuming insane\n", memmap->regions[0].start );
- return -EINVAL;
- }
- if ( memmap->regions[1].start != 0x100000 ) {
- DBG ( "INT 15,e820 region 1 starts at %llx (expected 100000); "
- "assuming insane\n", memmap->regions[0].start );
- return -EINVAL;
- }
-
- return 0;
-}
-
-/**
- * Get memory map
- *
- * @v memmap Memory map to fill in
- */
-void get_memmap ( struct memory_map *memmap ) {
- unsigned int basemem, extmem;
- int rc;
-
- DBG ( "Fetching system memory map\n" );
-
- /* Clear memory map */
- memset ( memmap, 0, sizeof ( *memmap ) );
-
- /* Get base and extended memory sizes */
- basemem = basememsize();
- DBG ( "FBMS base memory size %d kB [0,%x)\n",
- basemem, ( basemem * 1024 ) );
- extmem = extmemsize();
-
- /* Try INT 15,e820 first */
- if ( ( rc = meme820 ( memmap ) ) == 0 ) {
- DBG ( "Obtained system memory map via INT 15,e820\n" );
- return;
- }
-
- /* Fall back to constructing a map from basemem and extmem sizes */
- DBG ( "INT 15,e820 failed; constructing map\n" );
- memmap->regions[0].end = ( basemem * 1024 );
- memmap->regions[1].start = 0x100000;
- memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
- memmap->count = 2;
-}
diff --git a/gpxe/src/arch/i386/firmware/pcbios/pnpbios.c b/gpxe/src/arch/i386/firmware/pcbios/pnpbios.c
deleted file mode 100644
index c572914f..00000000
--- a/gpxe/src/arch/i386/firmware/pcbios/pnpbios.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-#include <realmode.h>
-#include <pnpbios.h>
-
-/** @file
- *
- * PnP BIOS
- *
- */
-
-/** PnP BIOS structure */
-struct pnp_bios {
- /** Signature
- *
- * Must be equal to @c PNP_BIOS_SIGNATURE
- */
- uint32_t signature;
- /** Version as BCD (e.g. 1.0 is 0x10) */
- uint8_t version;
- /** Length of this structure */
- uint8_t length;
- /** System capabilities */
- uint16_t control;
- /** Checksum */
- uint8_t checksum;
-} __attribute__ (( packed ));
-
-/** Signature for a PnP BIOS structure */
-#define PNP_BIOS_SIGNATURE \
- ( ( '$' << 0 ) + ( 'P' << 8 ) + ( 'n' << 16 ) + ( 'P' << 24 ) )
-
-/**
- * Test address for PnP BIOS structure
- *
- * @v offset Offset within BIOS segment to test
- * @ret rc Return status code
- */
-static int is_pnp_bios ( unsigned int offset ) {
- union {
- struct pnp_bios pnp_bios;
- uint8_t bytes[256]; /* 256 is maximum length possible */
- } u;
- size_t len;
- unsigned int i;
- uint8_t sum = 0;
-
- /* Read start of header and verify signature */
- copy_from_real ( &u.pnp_bios, BIOS_SEG, offset, sizeof ( u.pnp_bios ));
- if ( u.pnp_bios.signature != PNP_BIOS_SIGNATURE )
- return -EINVAL;
-
- /* Read whole header and verify checksum */
- len = u.pnp_bios.length;
- copy_from_real ( &u.bytes, BIOS_SEG, offset, len );
- for ( i = 0 ; i < len ; i++ ) {
- sum += u.bytes[i];
- }
- if ( sum != 0 )
- return -EINVAL;
-
- DBG ( "Found PnP BIOS at %04x:%04x\n", BIOS_SEG, offset );
-
- return 0;
-}
-
-/**
- * Locate Plug-and-Play BIOS
- *
- * @ret pnp_offset Offset of PnP BIOS structure within BIOS segment
- *
- * The PnP BIOS structure will be at BIOS_SEG:pnp_offset. If no PnP
- * BIOS is found, -1 is returned.
- */
-int find_pnp_bios ( void ) {
- static int pnp_offset = 0;
-
- if ( pnp_offset )
- return pnp_offset;
-
- for ( pnp_offset = 0 ; pnp_offset < 0x10000 ; pnp_offset += 0x10 ) {
- if ( is_pnp_bios ( pnp_offset ) == 0 )
- return pnp_offset;
- }
-
- pnp_offset = -1;
- return pnp_offset;
-}
diff --git a/gpxe/src/arch/i386/hci/commands/pxe_cmd.c b/gpxe/src/arch/i386/hci/commands/pxe_cmd.c
deleted file mode 100644
index b5df2d1b..00000000
--- a/gpxe/src/arch/i386/hci/commands/pxe_cmd.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <gpxe/netdevice.h>
-#include <gpxe/command.h>
-#include <hci/ifmgmt_cmd.h>
-#include <pxe_call.h>
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-static int startpxe_payload ( struct net_device *netdev ) {
- if ( netdev->state & NETDEV_OPEN )
- pxe_activate ( netdev );
- return 0;
-}
-
-static int startpxe_exec ( int argc, char **argv ) {
- return ifcommon_exec ( argc, argv, startpxe_payload,
- "Activate PXE on" );
-}
-
-static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
- pxe_deactivate();
- return 0;
-}
-
-struct command pxe_commands[] __command = {
- {
- .name = "startpxe",
- .exec = startpxe_exec,
- },
- {
- .name = "stoppxe",
- .exec = stoppxe_exec,
- },
-};
diff --git a/gpxe/src/arch/i386/image/bootsector.c b/gpxe/src/arch/i386/image/bootsector.c
deleted file mode 100644
index f96cf201..00000000
--- a/gpxe/src/arch/i386/image/bootsector.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * x86 bootsector image format
- *
- */
-
-#include <errno.h>
-#include <realmode.h>
-#include <biosint.h>
-#include <bootsector.h>
-
-/** Vector for storing original INT 18 handler
- *
- * We do not chain to this vector, so there is no need to place it in
- * .text16.
- */
-static struct segoff int18_vector;
-
-/** Vector for storing original INT 19 handler
- *
- * We do not chain to this vector, so there is no need to place it in
- * .text16.
- */
-static struct segoff int19_vector;
-
-/** Restart point for INT 18 or 19 */
-extern void bootsector_exec_fail ( void );
-
-/**
- * Jump to preloaded bootsector
- *
- * @v segment Real-mode segment
- * @v offset Real-mode offset
- * @v drive Drive number to pass to boot sector
- * @ret rc Return status code
- */
-int call_bootsector ( unsigned int segment, unsigned int offset,
- unsigned int drive ) {
- int discard_b, discard_D, discard_d;
-
- DBG ( "Booting from boot sector at %04x:%04x\n", segment, offset );
-
- /* Hook INTs 18 and 19 to capture failure paths */
- hook_bios_interrupt ( 0x18, ( unsigned int ) bootsector_exec_fail,
- &int18_vector );
- hook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
- &int19_vector );
-
- /* Boot the loaded sector
- *
- * We assume that the boot sector may completely destroy our
- * real-mode stack, so we preserve everything we need in
- * static storage.
- */
- __asm__ __volatile__ ( REAL_CODE ( /* Save return address off-stack */
- "popw %%cs:saved_retaddr\n\t"
- /* Save stack pointer */
- "movw %%ss, %%ax\n\t"
- "movw %%ax, %%cs:saved_ss\n\t"
- "movw %%sp, %%cs:saved_sp\n\t"
- /* Jump to boot sector */
- "pushw %%bx\n\t"
- "pushw %%di\n\t"
- "sti\n\t"
- "lret\n\t"
- /* Preserved variables */
- "\nsaved_ss: .word 0\n\t"
- "\nsaved_sp: .word 0\n\t"
- "\nsaved_retaddr: .word 0\n\t"
- /* Boot failure return point */
- "\nbootsector_exec_fail:\n\t"
- /* Restore stack pointer */
- "movw %%cs:saved_ss, %%ax\n\t"
- "movw %%ax, %%ss\n\t"
- "movw %%cs:saved_sp, %%sp\n\t"
- /* Return via saved address */
- "jmp *%%cs:saved_retaddr\n\t" )
- : "=b" ( discard_b ), "=D" ( discard_D ),
- "=d" ( discard_d )
- : "b" ( segment ), "D" ( offset ),
- "d" ( drive )
- : "eax", "ecx", "esi", "ebp" );
-
- DBG ( "Booted disk returned via INT 18 or 19\n" );
-
- /* Unhook INTs 18 and 19 */
- unhook_bios_interrupt ( 0x18, ( unsigned int ) bootsector_exec_fail,
- &int18_vector );
- unhook_bios_interrupt ( 0x19, ( unsigned int ) bootsector_exec_fail,
- &int19_vector );
-
- return -ECANCELED;
-}
diff --git a/gpxe/src/arch/i386/image/bzimage.c b/gpxe/src/arch/i386/image/bzimage.c
deleted file mode 100644
index 19450990..00000000
--- a/gpxe/src/arch/i386/image/bzimage.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * Linux bzImage image format
- *
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <bzimage.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/init.h>
-#include <gpxe/cpio.h>
-#include <gpxe/features.h>
-
-FEATURE ( FEATURE_IMAGE, "bzImage", DHCP_EB_FEATURE_BZIMAGE, 1 );
-
-struct image_type bzimage_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * bzImage context
- */
-struct bzimage_context {
- /** Boot protocol version */
- unsigned int version;
- /** Real-mode kernel portion load segment address */
- unsigned int rm_kernel_seg;
- /** Real-mode kernel portion load address */
- userptr_t rm_kernel;
- /** Real-mode kernel portion file size */
- size_t rm_filesz;
- /** Real-mode heap top (offset from rm_kernel) */
- size_t rm_heap;
- /** Command line (offset from rm_kernel) */
- size_t rm_cmdline;
- /** Command line maximum length */
- size_t cmdline_size;
- /** Real-mode kernel portion total memory size */
- size_t rm_memsz;
- /** Non-real-mode kernel portion load address */
- userptr_t pm_kernel;
- /** Non-real-mode kernel portion file and memory size */
- size_t pm_sz;
- /** Video mode */
- unsigned int vid_mode;
- /** Memory limit */
- uint64_t mem_limit;
- /** Initrd address */
- physaddr_t ramdisk_image;
- /** Initrd size */
- physaddr_t ramdisk_size;
-
- /** Command line magic block */
- struct bzimage_cmdline cmdline_magic;
- /** bzImage header */
- struct bzimage_header bzhdr;
-};
-
-/**
- * Parse bzImage header
- *
- * @v image bzImage file
- * @v bzimg bzImage context
- * @v src bzImage to parse
- * @ret rc Return status code
- */
-static int bzimage_parse_header ( struct image *image,
- struct bzimage_context *bzimg,
- userptr_t src ) {
- unsigned int syssize;
- int is_bzimage;
-
- /* Sanity check */
- if ( image->len < ( BZI_HDR_OFFSET + sizeof ( bzimg->bzhdr ) ) ) {
- DBGC ( image, "bzImage %p too short for kernel header\n",
- image );
- return -ENOEXEC;
- }
-
- /* Read in header structures */
- memset ( bzimg, 0, sizeof ( *bzimg ) );
- copy_from_user ( &bzimg->cmdline_magic, src, BZI_CMDLINE_OFFSET,
- sizeof ( bzimg->cmdline_magic ) );
- copy_from_user ( &bzimg->bzhdr, src, BZI_HDR_OFFSET,
- sizeof ( bzimg->bzhdr ) );
-
- /* Calculate size of real-mode portion */
- bzimg->rm_filesz =
- ( ( bzimg->bzhdr.setup_sects ? bzimg->bzhdr.setup_sects : 4 ) + 1 ) << 9;
- if ( bzimg->rm_filesz > image->len ) {
- DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
- image, bzimg->rm_filesz );
- return -ENOEXEC;
- }
- bzimg->rm_memsz = BZI_ASSUMED_RM_SIZE;
-
- /* Calculate size of protected-mode portion */
- bzimg->pm_sz = ( image->len - bzimg->rm_filesz );
- syssize = ( ( bzimg->pm_sz + 15 ) / 16 );
-
- /* Check for signatures and determine version */
- if ( bzimg->bzhdr.boot_flag != BZI_BOOT_FLAG ) {
- DBGC ( image, "bzImage %p missing 55AA signature\n", image );
- return -ENOEXEC;
- }
- if ( bzimg->bzhdr.header == BZI_SIGNATURE ) {
- /* 2.00+ */
- bzimg->version = bzimg->bzhdr.version;
- } else {
- /* Pre-2.00. Check that the syssize field is correct,
- * as a guard against accepting arbitrary binary data,
- * since the 55AA check is pretty lax. Note that the
- * syssize field is unreliable for protocols between
- * 2.00 and 2.03 inclusive, so we should not always
- * check this field.
- */
- bzimg->version = 0x0100;
- if ( bzimg->bzhdr.syssize != syssize ) {
- DBGC ( image, "bzImage %p bad syssize %x (expected "
- "%x)\n", image, bzimg->bzhdr.syssize, syssize );
- return -ENOEXEC;
- }
- }
-
- /* Determine image type */
- is_bzimage = ( ( bzimg->version >= 0x0200 ) ?
- ( bzimg->bzhdr.loadflags & BZI_LOAD_HIGH ) : 0 );
-
- /* Calculate load address of real-mode portion */
- bzimg->rm_kernel_seg = ( is_bzimage ? 0x1000 : 0x9000 );
- bzimg->rm_kernel = real_to_user ( bzimg->rm_kernel_seg, 0 );
-
- /* Allow space for the stack and heap */
- bzimg->rm_memsz += BZI_STACK_SIZE;
- bzimg->rm_heap = bzimg->rm_memsz;
-
- /* Allow space for the command line */
- bzimg->rm_cmdline = bzimg->rm_memsz;
- bzimg->rm_memsz += BZI_CMDLINE_SIZE;
-
- /* Calculate load address of protected-mode portion */
- bzimg->pm_kernel = phys_to_user ( is_bzimage ? BZI_LOAD_HIGH_ADDR
- : BZI_LOAD_LOW_ADDR );
-
- /* Extract video mode */
- bzimg->vid_mode = bzimg->bzhdr.vid_mode;
-
- /* Extract memory limit */
- bzimg->mem_limit = ( ( bzimg->version >= 0x0203 ) ?
- bzimg->bzhdr.initrd_addr_max : BZI_INITRD_MAX );
-
- /* Extract command line size */
- bzimg->cmdline_size = ( ( bzimg->version >= 0x0206 ) ?
- bzimg->bzhdr.cmdline_size : BZI_CMDLINE_SIZE );
-
- DBGC ( image, "bzImage %p version %04x RM %#lx+%#zx PM %#lx+%#zx "
- "cmdlen %zd\n", image, bzimg->version,
- user_to_phys ( bzimg->rm_kernel, 0 ), bzimg->rm_filesz,
- user_to_phys ( bzimg->pm_kernel, 0 ), bzimg->pm_sz,
- bzimg->cmdline_size );
-
- return 0;
-}
-
-/**
- * Update bzImage header in loaded kernel
- *
- * @v image bzImage file
- * @v bzimg bzImage context
- * @v dst bzImage to update
- */
-static void bzimage_update_header ( struct image *image,
- struct bzimage_context *bzimg,
- userptr_t dst ) {
-
- /* Set loader type */
- if ( bzimg->version >= 0x0200 )
- bzimg->bzhdr.type_of_loader = BZI_LOADER_TYPE_GPXE;
-
- /* Set heap end pointer */
- if ( bzimg->version >= 0x0201 ) {
- bzimg->bzhdr.heap_end_ptr = ( bzimg->rm_heap - 0x200 );
- bzimg->bzhdr.loadflags |= BZI_CAN_USE_HEAP;
- }
-
- /* Set command line */
- if ( bzimg->version >= 0x0202 ) {
- bzimg->bzhdr.cmd_line_ptr = user_to_phys ( bzimg->rm_kernel,
- bzimg->rm_cmdline );
- } else {
- bzimg->cmdline_magic.magic = BZI_CMDLINE_MAGIC;
- bzimg->cmdline_magic.offset = bzimg->rm_cmdline;
- bzimg->bzhdr.setup_move_size = bzimg->rm_memsz;
- }
-
- /* Set video mode */
- bzimg->bzhdr.vid_mode = bzimg->vid_mode;
-
- /* Set initrd address */
- if ( bzimg->version >= 0x0200 ) {
- bzimg->bzhdr.ramdisk_image = bzimg->ramdisk_image;
- bzimg->bzhdr.ramdisk_size = bzimg->ramdisk_size;
- }
-
- /* Write out header structures */
- copy_to_user ( dst, BZI_CMDLINE_OFFSET, &bzimg->cmdline_magic,
- sizeof ( bzimg->cmdline_magic ) );
- copy_to_user ( dst, BZI_HDR_OFFSET, &bzimg->bzhdr,
- sizeof ( bzimg->bzhdr ) );
-
- DBGC ( image, "bzImage %p vidmode %d\n", image, bzimg->vid_mode );
-}
-
-/**
- * Parse kernel command line for bootloader parameters
- *
- * @v image bzImage file
- * @v bzimg bzImage context
- * @v cmdline Kernel command line
- * @ret rc Return status code
- */
-static int bzimage_parse_cmdline ( struct image *image,
- struct bzimage_context *bzimg,
- const char *cmdline ) {
- char *vga;
- char *mem;
-
- /* Look for "vga=" */
- if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
- vga += 4;
- if ( strcmp ( vga, "normal" ) == 0 ) {
- bzimg->vid_mode = BZI_VID_MODE_NORMAL;
- } else if ( strcmp ( vga, "ext" ) == 0 ) {
- bzimg->vid_mode = BZI_VID_MODE_EXT;
- } else if ( strcmp ( vga, "ask" ) == 0 ) {
- bzimg->vid_mode = BZI_VID_MODE_ASK;
- } else {
- bzimg->vid_mode = strtoul ( vga, &vga, 0 );
- if ( *vga && ( *vga != ' ' ) ) {
- DBGC ( image, "bzImage %p strange \"vga=\""
- "terminator '%c'\n", image, *vga );
- }
- }
- }
-
- /* Look for "mem=" */
- if ( ( mem = strstr ( cmdline, "mem=" ) ) ) {
- mem += 4;
- bzimg->mem_limit = strtoul ( mem, &mem, 0 );
- switch ( *mem ) {
- case 'G':
- case 'g':
- bzimg->mem_limit <<= 10;
- case 'M':
- case 'm':
- bzimg->mem_limit <<= 10;
- case 'K':
- case 'k':
- bzimg->mem_limit <<= 10;
- break;
- case '\0':
- case ' ':
- break;
- default:
- DBGC ( image, "bzImage %p strange \"mem=\" "
- "terminator '%c'\n", image, *mem );
- break;
- }
- bzimg->mem_limit -= 1;
- }
-
- return 0;
-}
-
-/**
- * Set command line
- *
- * @v image bzImage image
- * @v bzimg bzImage context
- * @v cmdline Kernel command line
- * @ret rc Return status code
- */
-static int bzimage_set_cmdline ( struct image *image,
- struct bzimage_context *bzimg,
- const char *cmdline ) {
- size_t cmdline_len;
-
- /* Copy command line down to real-mode portion */
- cmdline_len = ( strlen ( cmdline ) + 1 );
- if ( cmdline_len > bzimg->cmdline_size )
- cmdline_len = bzimg->cmdline_size;
- copy_to_user ( bzimg->rm_kernel, bzimg->rm_cmdline,
- cmdline, cmdline_len );
- DBGC ( image, "bzImage %p command line \"%s\"\n", image, cmdline );
-
- return 0;
-}
-
-/**
- * Load initrd
- *
- * @v image bzImage image
- * @v initrd initrd image
- * @v address Address at which to load, or UNULL
- * @ret len Length of loaded image, rounded up to 4 bytes
- */
-static size_t bzimage_load_initrd ( struct image *image,
- struct image *initrd,
- userptr_t address ) {
- char *filename = initrd->cmdline;
- struct cpio_header cpio;
- size_t offset = 0;
-
- /* Do not include kernel image itself as an initrd */
- if ( initrd == image )
- return 0;
-
- /* Create cpio header before non-prebuilt images */
- if ( filename && filename[0] ) {
- size_t name_len = ( strlen ( filename ) + 1 );
-
- DBGC ( image, "bzImage %p inserting initrd %p as %s\n",
- image, initrd, filename );
- memset ( &cpio, '0', sizeof ( cpio ) );
- memcpy ( cpio.c_magic, CPIO_MAGIC, sizeof ( cpio.c_magic ) );
- cpio_set_field ( cpio.c_mode, 0100644 );
- cpio_set_field ( cpio.c_nlink, 1 );
- cpio_set_field ( cpio.c_filesize, initrd->len );
- cpio_set_field ( cpio.c_namesize, name_len );
- if ( address ) {
- copy_to_user ( address, offset, &cpio,
- sizeof ( cpio ) );
- }
- offset += sizeof ( cpio );
- if ( address ) {
- copy_to_user ( address, offset, filename,
- name_len );
- }
- offset += name_len;
- offset = ( ( offset + 0x03 ) & ~0x03 );
- }
-
- /* Copy in initrd image body */
- if ( address )
- memcpy_user ( address, offset, initrd->data, 0, initrd->len );
- offset += initrd->len;
- if ( address ) {
- DBGC ( image, "bzImage %p has initrd %p at [%lx,%lx)\n",
- image, initrd, user_to_phys ( address, 0 ),
- user_to_phys ( address, offset ) );
- }
-
- /* Round up to 4-byte boundary */
- offset = ( ( offset + 0x03 ) & ~0x03 );
- return offset;
-}
-
-/**
- * Load initrds, if any
- *
- * @v image bzImage image
- * @v bzimg bzImage context
- * @ret rc Return status code
- */
-static int bzimage_load_initrds ( struct image *image,
- struct bzimage_context *bzimg ) {
- struct image *initrd;
- size_t total_len = 0;
- physaddr_t address;
- int rc;
-
- /* Add up length of all initrd images */
- for_each_image ( initrd )
- total_len += bzimage_load_initrd ( image, initrd, UNULL );
-
- /* Give up if no initrd images found */
- if ( ! total_len )
- return 0;
-
- /* Find a suitable start address. Try 1MB boundaries,
- * starting from the downloaded kernel image itself and
- * working downwards until we hit an available region.
- */
- for ( address = ( user_to_phys ( image->data, 0 ) & ~0xfffff ) ; ;
- address -= 0x100000 ) {
- /* Check that we're not going to overwrite the
- * kernel itself. This check isn't totally
- * accurate, but errs on the side of caution.
- */
- if ( address <= ( BZI_LOAD_HIGH_ADDR + image->len ) ) {
- DBGC ( image, "bzImage %p could not find a location "
- "for initrd\n", image );
- return -ENOBUFS;
- }
- /* Check that we are within the kernel's range */
- if ( ( address + total_len - 1 ) > bzimg->mem_limit )
- continue;
- /* Prepare and verify segment */
- if ( ( rc = prep_segment ( phys_to_user ( address ), 0,
- total_len ) ) != 0 )
- continue;
- /* Use this address */
- break;
- }
-
- /* Record initrd location */
- bzimg->ramdisk_image = address;
- bzimg->ramdisk_size = total_len;
-
- /* Construct initrd */
- DBGC ( image, "bzImage %p constructing initrd at [%lx,%lx)\n",
- image, address, ( address + total_len ) );
- for_each_image ( initrd ) {
- address += bzimage_load_initrd ( image, initrd,
- phys_to_user ( address ) );
- }
-
- return 0;
-}
-
-/**
- * Execute bzImage image
- *
- * @v image bzImage image
- * @ret rc Return status code
- */
-static int bzimage_exec ( struct image *image ) {
- struct bzimage_context bzimg;
- const char *cmdline = ( image->cmdline ? image->cmdline : "" );
- int rc;
-
- /* Read and parse header from loaded kernel */
- if ( ( rc = bzimage_parse_header ( image, &bzimg,
- image->priv.user ) ) != 0 )
- return rc;
- assert ( bzimg.rm_kernel == image->priv.user );
-
- /* Parse command line for bootloader parameters */
- if ( ( rc = bzimage_parse_cmdline ( image, &bzimg, cmdline ) ) != 0)
- return rc;
-
- /* Store command line */
- if ( ( rc = bzimage_set_cmdline ( image, &bzimg, cmdline ) ) != 0 )
- return rc;
-
- /* Load any initrds */
- if ( ( rc = bzimage_load_initrds ( image, &bzimg ) ) != 0 )
- return rc;
-
- /* Update kernel header */
- bzimage_update_header ( image, &bzimg, bzimg.rm_kernel );
-
- /* Prepare for exiting */
- shutdown ( SHUTDOWN_BOOT );
-
- DBGC ( image, "bzImage %p jumping to RM kernel at %04x:0000 "
- "(stack %04x:%04zx)\n", image, ( bzimg.rm_kernel_seg + 0x20 ),
- bzimg.rm_kernel_seg, bzimg.rm_heap );
-
- /* Jump to the kernel */
- __asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
- "movw %w0, %%es\n\t"
- "movw %w0, %%fs\n\t"
- "movw %w0, %%gs\n\t"
- "movw %w0, %%ss\n\t"
- "movw %w1, %%sp\n\t"
- "pushw %w2\n\t"
- "pushw $0\n\t"
- "lret\n\t" )
- : : "r" ( bzimg.rm_kernel_seg ),
- "r" ( bzimg.rm_heap ),
- "r" ( bzimg.rm_kernel_seg + 0x20 ) );
-
- /* There is no way for the image to return, since we provide
- * no return address.
- */
- assert ( 0 );
-
- return -ECANCELED; /* -EIMPOSSIBLE */
-}
-
-/**
- * Load bzImage image into memory
- *
- * @v image bzImage file
- * @ret rc Return status code
- */
-int bzimage_load ( struct image *image ) {
- struct bzimage_context bzimg;
- int rc;
-
- /* Read and parse header from image */
- if ( ( rc = bzimage_parse_header ( image, &bzimg,
- image->data ) ) != 0 )
- return rc;
-
- /* This is a bzImage image, valid or otherwise */
- if ( ! image->type )
- image->type = &bzimage_image_type;
-
- /* Prepare segments */
- if ( ( rc = prep_segment ( bzimg.rm_kernel, bzimg.rm_filesz,
- bzimg.rm_memsz ) ) != 0 ) {
- DBGC ( image, "bzImage %p could not prepare RM segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
- if ( ( rc = prep_segment ( bzimg.pm_kernel, bzimg.pm_sz,
- bzimg.pm_sz ) ) != 0 ) {
- DBGC ( image, "bzImage %p could not prepare PM segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Load segments */
- memcpy_user ( bzimg.rm_kernel, 0, image->data,
- 0, bzimg.rm_filesz );
- memcpy_user ( bzimg.pm_kernel, 0, image->data,
- bzimg.rm_filesz, bzimg.pm_sz );
-
- /* Update and write out header */
- bzimage_update_header ( image, &bzimg, bzimg.rm_kernel );
-
- /* Record real-mode segment in image private data field */
- image->priv.user = bzimg.rm_kernel;
-
- return 0;
-}
-
-/** Linux bzImage image type */
-struct image_type bzimage_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "bzImage",
- .load = bzimage_load,
- .exec = bzimage_exec,
-};
diff --git a/gpxe/src/arch/i386/image/com32.c b/gpxe/src/arch/i386/image/com32.c
deleted file mode 100644
index 6ab347c1..00000000
--- a/gpxe/src/arch/i386/image/com32.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (C) 2008 Daniel Verkamp <daniel@drv.nu>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/**
- * @file
- *
- * SYSLINUX COM32 image format
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <basemem.h>
-#include <comboot.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/init.h>
-#include <gpxe/memmap.h>
-
-struct image_type com32_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * Execute COMBOOT image
- *
- * @v image COM32 image
- * @ret rc Return status code
- */
-static int com32_exec ( struct image *image ) {
- struct memory_map memmap;
- unsigned int i;
- int state;
- uint32_t avail_mem_top;
-
- state = rmsetjmp ( comboot_return );
-
- switch ( state ) {
- case 0: /* First time through; invoke COM32 program */
-
- /* Get memory map */
- get_memmap ( &memmap );
-
- /* Find end of block covering COM32 image loading area */
- for ( i = 0, avail_mem_top = 0 ; i < memmap.count ; i++ ) {
- if ( (memmap.regions[i].start <= COM32_START_PHYS) &&
- (memmap.regions[i].end > COM32_START_PHYS + image->len) ) {
- avail_mem_top = memmap.regions[i].end;
- break;
- }
- }
-
- DBGC ( image, "COM32 %p: available memory top = 0x%x\n",
- image, avail_mem_top );
-
- assert ( avail_mem_top != 0 );
-
- com32_external_esp = phys_to_virt ( avail_mem_top );
-
- /* Hook COMBOOT API interrupts */
- hook_comboot_interrupts();
-
- /* Unregister image, so that a "boot" command doesn't
- * throw us into an execution loop. We never
- * reregister ourselves; COMBOOT images expect to be
- * removed on exit.
- */
- unregister_image ( image );
-
- __asm__ __volatile__ (
- "movl %%esp, (com32_internal_esp)\n\t" /* Save internal virtual address space ESP */
- "movl (com32_external_esp), %%esp\n\t" /* Switch to COM32 ESP (top of available memory) */
- "call _virt_to_phys\n\t" /* Switch to flat physical address space */
- "pushl %0\n\t" /* Pointer to CDECL helper function */
- "pushl %1\n\t" /* Pointer to FAR call helper function */
- "pushl %2\n\t" /* Size of low memory bounce buffer */
- "pushl %3\n\t" /* Pointer to low memory bounce buffer */
- "pushl %4\n\t" /* Pointer to INT call helper function */
- "pushl %5\n\t" /* Pointer to the command line arguments */
- "pushl $6\n\t" /* Number of additional arguments */
- "call *%6\n\t" /* Execute image */
- "call _phys_to_virt\n\t" /* Switch back to internal virtual address space */
- "movl (com32_internal_esp), %%esp\n\t" /* Switch back to internal stack */
- :
- :
- /* %0 */ "r" ( virt_to_phys ( com32_cfarcall_wrapper ) ),
- /* %1 */ "r" ( virt_to_phys ( com32_farcall_wrapper ) ),
- /* %2 */ "r" ( get_fbms() * 1024 - (COM32_BOUNCE_SEG << 4) ),
- /* %3 */ "i" ( COM32_BOUNCE_SEG << 4 ),
- /* %4 */ "r" ( virt_to_phys ( com32_intcall_wrapper ) ),
- /* %5 */ "r" ( virt_to_phys ( image->cmdline ) ),
- /* %6 */ "r" ( COM32_START_PHYS )
- :
- "memory" );
- DBGC ( image, "COM32 %p: returned\n", image );
- break;
-
- case COMBOOT_EXIT:
- DBGC ( image, "COM32 %p: exited\n", image );
- break;
-
- case COMBOOT_EXIT_RUN_KERNEL:
- DBGC ( image, "COM32 %p: exited to run kernel %p\n",
- image, comboot_replacement_image );
- image->replacement = comboot_replacement_image;
- comboot_replacement_image = NULL;
- image_autoload ( image->replacement );
- break;
-
- case COMBOOT_EXIT_COMMAND:
- DBGC ( image, "COM32 %p: exited after executing command\n",
- image );
- break;
-
- default:
- assert ( 0 );
- break;
- }
-
- unhook_comboot_interrupts();
- comboot_force_text_mode();
-
- return 0;
-}
-
-/**
- * Check image name extension
- *
- * @v image COM32 image
- * @ret rc Return status code
- */
-static int com32_identify ( struct image *image ) {
- const char *ext;
- static const uint8_t magic[] = { 0xB8, 0xFF, 0x4C, 0xCD, 0x21 };
- uint8_t buf[5];
-
- if ( image->len >= 5 ) {
- /* Check for magic number
- * mov eax,21cd4cffh
- * B8 FF 4C CD 21
- */
- copy_from_user ( buf, image->data, 0, sizeof(buf) );
- if ( ! memcmp ( buf, magic, sizeof(buf) ) ) {
- DBGC ( image, "COM32 %p: found magic number\n",
- image );
- return 0;
- }
- }
-
- /* Magic number not found; check filename extension */
-
- ext = strrchr( image->name, '.' );
-
- if ( ! ext ) {
- DBGC ( image, "COM32 %p: no extension\n",
- image );
- return -ENOEXEC;
- }
-
- ++ext;
-
- if ( strcasecmp( ext, "c32" ) ) {
- DBGC ( image, "COM32 %p: unrecognized extension %s\n",
- image, ext );
- return -ENOEXEC;
- }
-
- return 0;
-}
-
-
-/**
- * Load COM32 image into memory
- * @v image COM32 image
- * @ret rc Return status code
- */
-static int comboot_load_image ( struct image *image ) {
- size_t filesz, memsz;
- userptr_t buffer;
- int rc;
-
- filesz = image->len;
- memsz = filesz;
- buffer = phys_to_user ( COM32_START_PHYS );
- if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "COM32 %p: could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Copy image to segment */
- memcpy_user ( buffer, 0, image->data, 0, filesz );
-
- return 0;
-}
-
-/**
- * Prepare COM32 low memory bounce buffer
- * @v image COM32 image
- * @ret rc Return status code
- */
-static int comboot_prepare_bounce_buffer ( struct image * image ) {
- unsigned int seg;
- userptr_t seg_userptr;
- size_t filesz, memsz;
- int rc;
-
- seg = COM32_BOUNCE_SEG;
- seg_userptr = real_to_user ( seg, 0 );
-
- /* Ensure the entire 64k segment is free */
- memsz = 0xFFFF;
- filesz = 0;
-
- /* Prepare, verify, and load the real-mode segment */
- if ( ( rc = prep_segment ( seg_userptr, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "COM32 %p: could not prepare bounce buffer segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Load COM32 image into memory
- *
- * @v image COM32 image
- * @ret rc Return status code
- */
-static int com32_load ( struct image *image ) {
- int rc;
-
- DBGC ( image, "COM32 %p: name '%s', cmdline '%s'\n",
- image, image->name, image->cmdline );
-
- /* Check if this is a COMBOOT image */
- if ( ( rc = com32_identify ( image ) ) != 0 ) {
- return rc;
- }
-
- /* This is a COM32 image, valid or otherwise */
- if ( ! image->type )
- image->type = &com32_image_type;
-
- /* Load image */
- if ( ( rc = comboot_load_image ( image ) ) != 0 ) {
- return rc;
- }
-
- /* Prepare bounce buffer segment */
- if ( ( rc = comboot_prepare_bounce_buffer ( image ) ) != 0 ) {
- return rc;
- }
-
- return 0;
-}
-
-/** SYSLINUX COM32 image type */
-struct image_type com32_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "COM32",
- .load = com32_load,
- .exec = com32_exec,
-};
diff --git a/gpxe/src/arch/i386/image/comboot.c b/gpxe/src/arch/i386/image/comboot.c
deleted file mode 100644
index a00b2b95..00000000
--- a/gpxe/src/arch/i386/image/comboot.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (C) 2008 Daniel Verkamp <daniel@drv.nu>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/**
- * @file
- *
- * SYSLINUX COMBOOT (16-bit) image format
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <basemem.h>
-#include <comboot.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/init.h>
-#include <gpxe/features.h>
-
-FEATURE ( FEATURE_IMAGE, "COMBOOT", DHCP_EB_FEATURE_COMBOOT, 1 );
-
-struct image_type comboot_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * COMBOOT PSP, copied to offset 0 of code segment
- */
-struct comboot_psp {
- /** INT 20 instruction, executed if COMBOOT image returns with RET */
- uint16_t int20;
- /** Segment of first non-free paragraph of memory */
- uint16_t first_non_free_para;
-};
-
-/** Offset in PSP of command line */
-#define COMBOOT_PSP_CMDLINE_OFFSET 0x81
-
-/** Maximum length of command line in PSP
- * (127 bytes minus space and CR) */
-#define COMBOOT_MAX_CMDLINE_LEN 125
-
-
-/**
- * Copy command line to PSP
- *
- * @v image COMBOOT image
- */
-static void comboot_copy_cmdline ( struct image * image, userptr_t seg_userptr ) {
- const char *cmdline = ( image->cmdline ? image->cmdline : "" );
- int cmdline_len = strlen ( cmdline );
- if( cmdline_len > COMBOOT_MAX_CMDLINE_LEN )
- cmdline_len = COMBOOT_MAX_CMDLINE_LEN;
- uint8_t len_byte = cmdline_len;
- char spc = ' ', cr = '\r';
-
- /* Copy length to byte before command line */
- copy_to_user ( seg_userptr, COMBOOT_PSP_CMDLINE_OFFSET - 1,
- &len_byte, 1 );
-
- /* Command line starts with space */
- copy_to_user ( seg_userptr,
- COMBOOT_PSP_CMDLINE_OFFSET,
- &spc, 1 );
-
- /* Copy command line */
- copy_to_user ( seg_userptr,
- COMBOOT_PSP_CMDLINE_OFFSET + 1,
- cmdline, cmdline_len );
-
- /* Command line ends with CR */
- copy_to_user ( seg_userptr,
- COMBOOT_PSP_CMDLINE_OFFSET + cmdline_len + 1,
- &cr, 1 );
-}
-
-/**
- * Initialize PSP
- *
- * @v image COMBOOT image
- * @v seg_userptr segment to initialize
- */
-static void comboot_init_psp ( struct image * image, userptr_t seg_userptr ) {
- struct comboot_psp psp;
-
- /* Fill PSP */
-
- /* INT 20h instruction, byte order reversed */
- psp.int20 = 0x20CD;
-
- /* get_fbms() returns BIOS free base memory counter, which is in
- * kilobytes; x * 1024 / 16 == x * 64 == x << 6 */
- psp.first_non_free_para = get_fbms() << 6;
-
- DBGC ( image, "COMBOOT %p: first non-free paragraph = 0x%x\n",
- image, psp.first_non_free_para );
-
- /* Copy the PSP to offset 0 of segment.
- * The rest of the PSP was already zeroed by
- * comboot_prepare_segment. */
- copy_to_user ( seg_userptr, 0, &psp, sizeof( psp ) );
-
- /* Copy the command line to the PSP */
- comboot_copy_cmdline ( image, seg_userptr );
-}
-
-/**
- * Execute COMBOOT image
- *
- * @v image COMBOOT image
- * @ret rc Return status code
- */
-static int comboot_exec ( struct image *image ) {
- userptr_t seg_userptr = real_to_user ( COMBOOT_PSP_SEG, 0 );
- int state;
-
- state = rmsetjmp ( comboot_return );
-
- switch ( state ) {
- case 0: /* First time through; invoke COMBOOT program */
-
- /* Initialize PSP */
- comboot_init_psp ( image, seg_userptr );
-
- /* Hook COMBOOT API interrupts */
- hook_comboot_interrupts();
-
- DBGC ( image, "executing 16-bit COMBOOT image at %4x:0100\n",
- COMBOOT_PSP_SEG );
-
- /* Unregister image, so that a "boot" command doesn't
- * throw us into an execution loop. We never
- * reregister ourselves; COMBOOT images expect to be
- * removed on exit.
- */
- unregister_image ( image );
-
- /* Store stack segment at 0x38 and stack pointer at 0x3A
- * in the PSP and jump to the image */
- __asm__ __volatile__ (
- REAL_CODE ( /* Save return address with segment on old stack */
- "popw %%ax\n\t"
- "pushw %%cs\n\t"
- "pushw %%ax\n\t"
- /* Set DS=ES=segment with image */
- "movw %w0, %%ds\n\t"
- "movw %w0, %%es\n\t"
- /* Set SS:SP to new stack (end of image segment) */
- "movw %w0, %%ss\n\t"
- "xor %%sp, %%sp\n\t"
- "pushw $0\n\t"
- "pushw %w0\n\t"
- "pushw $0x100\n\t"
- /* Zero registers (some COM files assume GP regs are 0) */
- "xorw %%ax, %%ax\n\t"
- "xorw %%bx, %%bx\n\t"
- "xorw %%cx, %%cx\n\t"
- "xorw %%dx, %%dx\n\t"
- "xorw %%si, %%si\n\t"
- "xorw %%di, %%di\n\t"
- "xorw %%bp, %%bp\n\t"
- "lret\n\t" )
- : : "r" ( COMBOOT_PSP_SEG ) : "eax" );
- DBGC ( image, "COMBOOT %p: returned\n", image );
- break;
-
- case COMBOOT_EXIT:
- DBGC ( image, "COMBOOT %p: exited\n", image );
- break;
-
- case COMBOOT_EXIT_RUN_KERNEL:
- DBGC ( image, "COMBOOT %p: exited to run kernel %p\n",
- image, comboot_replacement_image );
- image->replacement = comboot_replacement_image;
- comboot_replacement_image = NULL;
- image_autoload ( image->replacement );
- break;
-
- case COMBOOT_EXIT_COMMAND:
- DBGC ( image, "COMBOOT %p: exited after executing command\n",
- image );
- break;
-
- default:
- assert ( 0 );
- break;
- }
-
- unhook_comboot_interrupts();
- comboot_force_text_mode();
-
- return 0;
-}
-
-/**
- * Check image name extension
- *
- * @v image COMBOOT image
- * @ret rc Return status code
- */
-static int comboot_identify ( struct image *image ) {
- const char *ext;
-
- ext = strrchr( image->name, '.' );
-
- if ( ! ext ) {
- DBGC ( image, "COMBOOT %p: no extension\n",
- image );
- return -ENOEXEC;
- }
-
- ++ext;
-
- if ( strcasecmp( ext, "com" ) && strcasecmp( ext, "cbt" ) ) {
- DBGC ( image, "COMBOOT %p: unrecognized extension %s\n",
- image, ext );
- return -ENOEXEC;
- }
-
- return 0;
-}
-
-/**
- * Load COMBOOT image into memory, preparing a segment and returning it
- * @v image COMBOOT image
- * @ret rc Return status code
- */
-static int comboot_prepare_segment ( struct image *image )
-{
- userptr_t seg_userptr;
- size_t filesz, memsz;
- int rc;
-
- /* Load image in segment */
- seg_userptr = real_to_user ( COMBOOT_PSP_SEG, 0 );
-
- /* Allow etra 0x100 bytes before image for PSP */
- filesz = image->len + 0x100;
-
- /* Ensure the entire 64k segment is free */
- memsz = 0xFFFF;
-
- /* Prepare, verify, and load the real-mode segment */
- if ( ( rc = prep_segment ( seg_userptr, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "COMBOOT %p: could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Zero PSP */
- memset_user ( seg_userptr, 0, 0, 0x100 );
-
- /* Copy image to segment:0100 */
- memcpy_user ( seg_userptr, 0x100, image->data, 0, image->len );
-
- return 0;
-}
-
-/**
- * Load COMBOOT image into memory
- *
- * @v image COMBOOT image
- * @ret rc Return status code
- */
-static int comboot_load ( struct image *image ) {
- int rc;
-
- DBGC ( image, "COMBOOT %p: name '%s'\n",
- image, image->name );
-
- /* Check if this is a COMBOOT image */
- if ( ( rc = comboot_identify ( image ) ) != 0 ) {
-
- return rc;
- }
-
- /* This is a 16-bit COMBOOT image, valid or otherwise */
- if ( ! image->type )
- image->type = &comboot_image_type;
-
- /* Sanity check for filesize */
- if( image->len >= 0xFF00 ) {
- DBGC( image, "COMBOOT %p: image too large\n",
- image );
- return -ENOEXEC;
- }
-
- /* Prepare segment and load image */
- if ( ( rc = comboot_prepare_segment ( image ) ) != 0 ) {
- return rc;
- }
-
- return 0;
-}
-
-/** SYSLINUX COMBOOT (16-bit) image type */
-struct image_type comboot_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "COMBOOT",
- .load = comboot_load,
- .exec = comboot_exec,
-};
diff --git a/gpxe/src/arch/i386/image/elfboot.c b/gpxe/src/arch/i386/image/elfboot.c
deleted file mode 100644
index a41040e8..00000000
--- a/gpxe/src/arch/i386/image/elfboot.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <errno.h>
-#include <elf.h>
-#include <gpxe/image.h>
-#include <gpxe/elf.h>
-#include <gpxe/features.h>
-#include <gpxe/init.h>
-
-/**
- * @file
- *
- * ELF bootable image
- *
- */
-
-FEATURE ( FEATURE_IMAGE, "ELF", DHCP_EB_FEATURE_ELF, 1 );
-
-struct image_type elfboot_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * Execute ELF image
- *
- * @v image ELF image
- * @ret rc Return status code
- */
-static int elfboot_exec ( struct image *image ) {
- physaddr_t entry = image->priv.phys;
-
- /* An ELF image has no callback interface, so we need to shut
- * down before invoking it.
- */
- shutdown ( SHUTDOWN_BOOT );
-
- /* Jump to OS with flat physical addressing */
- DBGC ( image, "ELF %p starting execution at %lx\n", image, entry );
- __asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
- : : "D" ( entry )
- : "eax", "ebx", "ecx", "edx", "esi", "ebp",
- "memory" );
-
- DBGC ( image, "ELF %p returned\n", image );
-
- /* It isn't safe to continue after calling shutdown() */
- while ( 1 ) {}
-
- return -ECANCELED; /* -EIMPOSSIBLE, anyone? */
-}
-
-/**
- * Load ELF image into memory
- *
- * @v image ELF file
- * @ret rc Return status code
- */
-static int elfboot_load ( struct image *image ) {
- Elf32_Ehdr ehdr;
- static const uint8_t e_ident[] = {
- [EI_MAG0] = ELFMAG0,
- [EI_MAG1] = ELFMAG1,
- [EI_MAG2] = ELFMAG2,
- [EI_MAG3] = ELFMAG3,
- [EI_CLASS] = ELFCLASS32,
- [EI_DATA] = ELFDATA2LSB,
- [EI_VERSION] = EV_CURRENT,
- };
- int rc;
-
- /* Read ELF header */
- copy_from_user ( &ehdr, image->data, 0, sizeof ( ehdr ) );
- if ( memcmp ( ehdr.e_ident, e_ident, sizeof ( e_ident ) ) != 0 ) {
- DBG ( "Invalid ELF identifier\n" );
- return -ENOEXEC;
- }
-
- /* This is an ELF image, valid or otherwise */
- if ( ! image->type )
- image->type = &elfboot_image_type;
-
- /* Load the image using core ELF support */
- if ( ( rc = elf_load ( image ) ) != 0 ) {
- DBGC ( image, "ELF %p could not load: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/** ELF image type */
-struct image_type elfboot_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "ELF",
- .load = elfboot_load,
- .exec = elfboot_exec,
-};
diff --git a/gpxe/src/arch/i386/image/eltorito.c b/gpxe/src/arch/i386/image/eltorito.c
deleted file mode 100644
index 53eb2c02..00000000
--- a/gpxe/src/arch/i386/image/eltorito.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * El Torito bootable ISO image format
- *
- */
-
-#include <stdint.h>
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <bootsector.h>
-#include <int13.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/ramdisk.h>
-#include <gpxe/init.h>
-
-#define ISO9660_BLKSIZE 2048
-#define ELTORITO_VOL_DESC_OFFSET ( 17 * ISO9660_BLKSIZE )
-
-/** An El Torito Boot Record Volume Descriptor */
-struct eltorito_vol_desc {
- /** Boot record indicator; must be 0 */
- uint8_t record_indicator;
- /** ISO-9660 identifier; must be "CD001" */
- uint8_t iso9660_id[5];
- /** Version, must be 1 */
- uint8_t version;
- /** Boot system indicator; must be "EL TORITO SPECIFICATION" */
- uint8_t system_indicator[32];
- /** Unused */
- uint8_t unused[32];
- /** Boot catalog sector */
- uint32_t sector;
-} __attribute__ (( packed ));
-
-/** An El Torito Boot Catalog Validation Entry */
-struct eltorito_validation_entry {
- /** Header ID; must be 1 */
- uint8_t header_id;
- /** Platform ID
- *
- * 0 = 80x86
- * 1 = PowerPC
- * 2 = Mac
- */
- uint8_t platform_id;
- /** Reserved */
- uint16_t reserved;
- /** ID string */
- uint8_t id_string[24];
- /** Checksum word */
- uint16_t checksum;
- /** Signature; must be 0xaa55 */
- uint16_t signature;
-} __attribute__ (( packed ));
-
-/** A bootable entry in the El Torito Boot Catalog */
-struct eltorito_boot_entry {
- /** Boot indicator
- *
- * Must be @c ELTORITO_BOOTABLE for a bootable ISO image
- */
- uint8_t indicator;
- /** Media type
- *
- */
- uint8_t media_type;
- /** Load segment */
- uint16_t load_segment;
- /** System type */
- uint8_t filesystem;
- /** Unused */
- uint8_t reserved_a;
- /** Sector count */
- uint16_t length;
- /** Starting sector */
- uint32_t start;
- /** Unused */
- uint8_t reserved_b[20];
-} __attribute__ (( packed ));
-
-/** Boot indicator for a bootable ISO image */
-#define ELTORITO_BOOTABLE 0x88
-
-/** El Torito media types */
-enum eltorito_media_type {
- /** No emulation */
- ELTORITO_NO_EMULATION = 0,
-};
-
-struct image_type eltorito_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * Calculate 16-bit word checksum
- *
- * @v data Data to checksum
- * @v len Length (in bytes, must be even)
- * @ret sum Checksum
- */
-static unsigned int word_checksum ( void *data, size_t len ) {
- uint16_t *words;
- uint16_t sum = 0;
-
- for ( words = data ; len ; words++, len -= 2 ) {
- sum += *words;
- }
- return sum;
-}
-
-/**
- * Execute El Torito image
- *
- * @v image El Torito image
- * @ret rc Return status code
- */
-static int eltorito_exec ( struct image *image ) {
- struct ramdisk ramdisk;
- struct int13_drive int13_drive;
- unsigned int load_segment = image->priv.ul;
- unsigned int load_offset = ( load_segment ? 0 : 0x7c00 );
- int rc;
-
- memset ( &ramdisk, 0, sizeof ( ramdisk ) );
- init_ramdisk ( &ramdisk, image->data, image->len, ISO9660_BLKSIZE );
-
- memset ( &int13_drive, 0, sizeof ( int13_drive ) );
- int13_drive.blockdev = &ramdisk.blockdev;
- register_int13_drive ( &int13_drive );
-
- if ( ( rc = call_bootsector ( load_segment, load_offset,
- int13_drive.drive ) ) != 0 ) {
- DBGC ( image, "ElTorito %p boot failed: %s\n",
- image, strerror ( rc ) );
- goto err;
- }
-
- rc = -ECANCELED; /* -EIMPOSSIBLE */
- err:
- unregister_int13_drive ( &int13_drive );
- return rc;
-}
-
-/**
- * Read and verify El Torito Boot Record Volume Descriptor
- *
- * @v image El Torito file
- * @ret catalog_offset Offset of Boot Catalog
- * @ret rc Return status code
- */
-static int eltorito_read_voldesc ( struct image *image,
- unsigned long *catalog_offset ) {
- static const struct eltorito_vol_desc vol_desc_signature = {
- .record_indicator = 0,
- .iso9660_id = "CD001",
- .version = 1,
- .system_indicator = "EL TORITO SPECIFICATION",
- };
- struct eltorito_vol_desc vol_desc;
-
- /* Sanity check */
- if ( image->len < ( ELTORITO_VOL_DESC_OFFSET + ISO9660_BLKSIZE ) ) {
- DBGC ( image, "ElTorito %p too short\n", image );
- return -ENOEXEC;
- }
-
- /* Read and verify Boot Record Volume Descriptor */
- copy_from_user ( &vol_desc, image->data, ELTORITO_VOL_DESC_OFFSET,
- sizeof ( vol_desc ) );
- if ( memcmp ( &vol_desc, &vol_desc_signature,
- offsetof ( typeof ( vol_desc ), sector ) ) != 0 ) {
- DBGC ( image, "ElTorito %p invalid Boot Record Volume "
- "Descriptor\n", image );
- return -ENOEXEC;
- }
- *catalog_offset = ( vol_desc.sector * ISO9660_BLKSIZE );
-
- DBGC ( image, "ElTorito %p boot catalog at offset %#lx\n",
- image, *catalog_offset );
-
- return 0;
-}
-
-/**
- * Read and verify El Torito Boot Catalog
- *
- * @v image El Torito file
- * @v catalog_offset Offset of Boot Catalog
- * @ret boot_entry El Torito boot entry
- * @ret rc Return status code
- */
-static int eltorito_read_catalog ( struct image *image,
- unsigned long catalog_offset,
- struct eltorito_boot_entry *boot_entry ) {
- struct eltorito_validation_entry validation_entry;
-
- /* Sanity check */
- if ( image->len < ( catalog_offset + ISO9660_BLKSIZE ) ) {
- DBGC ( image, "ElTorito %p bad boot catalog offset %#lx\n",
- image, catalog_offset );
- return -ENOEXEC;
- }
-
- /* Read and verify the Validation Entry of the Boot Catalog */
- copy_from_user ( &validation_entry, image->data, catalog_offset,
- sizeof ( validation_entry ) );
- if ( word_checksum ( &validation_entry,
- sizeof ( validation_entry ) ) != 0 ) {
- DBGC ( image, "ElTorito %p bad Validation Entry checksum\n",
- image );
- return -ENOEXEC;
- }
-
- /* Read and verify the Initial/Default entry */
- copy_from_user ( boot_entry, image->data,
- ( catalog_offset + sizeof ( validation_entry ) ),
- sizeof ( *boot_entry ) );
- if ( boot_entry->indicator != ELTORITO_BOOTABLE ) {
- DBGC ( image, "ElTorito %p not bootable\n", image );
- return -ENOEXEC;
- }
- if ( boot_entry->media_type != ELTORITO_NO_EMULATION ) {
- DBGC ( image, "ElTorito %p cannot support media type %d\n",
- image, boot_entry->media_type );
- return -ENOTSUP;
- }
-
- DBGC ( image, "ElTorito %p media type %d segment %04x\n",
- image, boot_entry->media_type, boot_entry->load_segment );
-
- return 0;
-}
-
-/**
- * Load El Torito virtual disk image into memory
- *
- * @v image El Torito file
- * @v boot_entry El Torito boot entry
- * @ret rc Return status code
- */
-static int eltorito_load_disk ( struct image *image,
- struct eltorito_boot_entry *boot_entry ) {
- unsigned long start = ( boot_entry->start * ISO9660_BLKSIZE );
- unsigned long length = ( boot_entry->length * ISO9660_BLKSIZE );
- unsigned int load_segment;
- userptr_t buffer;
- int rc;
-
- /* Sanity check */
- if ( image->len < ( start + length ) ) {
- DBGC ( image, "ElTorito %p virtual disk lies outside image\n",
- image );
- return -ENOEXEC;
- }
- DBGC ( image, "ElTorito %p virtual disk at %#lx+%#lx\n",
- image, start, length );
-
- /* Calculate load address */
- load_segment = boot_entry->load_segment;
- buffer = real_to_user ( load_segment, ( load_segment ? 0 : 0x7c00 ) );
-
- /* Verify and prepare segment */
- if ( ( rc = prep_segment ( buffer, length, length ) ) != 0 ) {
- DBGC ( image, "ElTorito %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Copy image to segment */
- memcpy_user ( buffer, 0, image->data, start, length );
-
- return 0;
-}
-
-/**
- * Load El Torito image into memory
- *
- * @v image El Torito file
- * @ret rc Return status code
- */
-static int eltorito_load ( struct image *image ) {
- struct eltorito_boot_entry boot_entry;
- unsigned long bootcat_offset;
- int rc;
-
- /* Read Boot Record Volume Descriptor, if present */
- if ( ( rc = eltorito_read_voldesc ( image, &bootcat_offset ) ) != 0 )
- return rc;
-
- /* This is an El Torito image, valid or otherwise */
- if ( ! image->type )
- image->type = &eltorito_image_type;
-
- /* Read Boot Catalog */
- if ( ( rc = eltorito_read_catalog ( image, bootcat_offset,
- &boot_entry ) ) != 0 )
- return rc;
-
- /* Load Virtual Disk image */
- if ( ( rc = eltorito_load_disk ( image, &boot_entry ) ) != 0 )
- return rc;
-
- /* Record load segment in image private data field */
- image->priv.ul = boot_entry.load_segment;
-
- return 0;
-}
-
-/** El Torito image type */
-struct image_type eltorito_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "El Torito",
- .load = eltorito_load,
- .exec = eltorito_exec,
-};
diff --git a/gpxe/src/arch/i386/image/multiboot.c b/gpxe/src/arch/i386/image/multiboot.c
deleted file mode 100644
index 5b620956..00000000
--- a/gpxe/src/arch/i386/image/multiboot.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * Multiboot image format
- *
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <multiboot.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/memmap.h>
-#include <gpxe/elf.h>
-#include <gpxe/init.h>
-#include <gpxe/features.h>
-
-FEATURE ( FEATURE_IMAGE, "Multiboot", DHCP_EB_FEATURE_MULTIBOOT, 1 );
-
-struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT );
-
-/**
- * Maximum number of modules we will allow for
- *
- * If this has bitten you: sorry. I did have a perfect scheme with a
- * dynamically allocated list of modules on the protected-mode stack,
- * but it was incompatible with some broken OSes that can only access
- * low memory at boot time (even though we kindly set up 4GB flat
- * physical addressing as per the multiboot specification.
- *
- */
-#define MAX_MODULES 8
-
-/**
- * Maximum combined length of command lines
- *
- * Again; sorry. Some broken OSes zero out any non-base memory that
- * isn't part of the loaded module set, so we can't just use
- * virt_to_phys(cmdline) to point to the command lines, even though
- * this would comply with the Multiboot spec.
- */
-#define MB_MAX_CMDLINE 512
-
-/** Multiboot flags that we support */
-#define MB_SUPPORTED_FLAGS ( MB_FLAG_PGALIGN | MB_FLAG_MEMMAP | \
- MB_FLAG_VIDMODE | MB_FLAG_RAW )
-
-/** Compulsory feature multiboot flags */
-#define MB_COMPULSORY_FLAGS 0x0000ffff
-
-/** Optional feature multiboot flags */
-#define MB_OPTIONAL_FLAGS 0xffff0000
-
-/**
- * Multiboot flags that we don't support
- *
- * We only care about the compulsory feature flags (bits 0-15); we are
- * allowed to ignore the optional feature flags.
- */
-#define MB_UNSUPPORTED_FLAGS ( MB_COMPULSORY_FLAGS & ~MB_SUPPORTED_FLAGS )
-
-/** A multiboot header descriptor */
-struct multiboot_header_info {
- /** The actual multiboot header */
- struct multiboot_header mb;
- /** Offset of header within the multiboot image */
- size_t offset;
-};
-
-/** Multiboot module command lines */
-static char __bss16_array ( mb_cmdlines, [MB_MAX_CMDLINE] );
-#define mb_cmdlines __use_data16 ( mb_cmdlines )
-
-/** Offset within module command lines */
-static unsigned int mb_cmdline_offset;
-
-/**
- * Build multiboot memory map
- *
- * @v image Multiboot image
- * @v mbinfo Multiboot information structure
- * @v mbmemmap Multiboot memory map
- * @v limit Maxmimum number of memory map entries
- */
-static void multiboot_build_memmap ( struct image *image,
- struct multiboot_info *mbinfo,
- struct multiboot_memory_map *mbmemmap,
- unsigned int limit ) {
- struct memory_map memmap;
- unsigned int i;
-
- /* Get memory map */
- get_memmap ( &memmap );
-
- /* Translate into multiboot format */
- memset ( mbmemmap, 0, sizeof ( *mbmemmap ) );
- for ( i = 0 ; i < memmap.count ; i++ ) {
- if ( i >= limit ) {
- DBGC ( image, "MULTIBOOT %p limit of %d memmap "
- "entries reached\n", image, limit );
- break;
- }
- mbmemmap[i].size = ( sizeof ( mbmemmap[i] ) -
- sizeof ( mbmemmap[i].size ) );
- mbmemmap[i].base_addr = memmap.regions[i].start;
- mbmemmap[i].length = ( memmap.regions[i].end -
- memmap.regions[i].start );
- mbmemmap[i].type = MBMEM_RAM;
- mbinfo->mmap_length += sizeof ( mbmemmap[i] );
- if ( memmap.regions[i].start == 0 )
- mbinfo->mem_lower = ( memmap.regions[i].end / 1024 );
- if ( memmap.regions[i].start == 0x100000 )
- mbinfo->mem_upper = ( ( memmap.regions[i].end -
- 0x100000 ) / 1024 );
- }
-}
-
-/**
- * Add command line in base memory
- *
- * @v imgname Image name
- * @v cmdline Command line
- * @ret physaddr Physical address of command line
- */
-physaddr_t multiboot_add_cmdline ( const char *imgname, const char *cmdline ) {
- char *mb_cmdline;
-
- if ( ! cmdline )
- cmdline = "";
-
- /* Copy command line to base memory buffer */
- mb_cmdline = ( mb_cmdlines + mb_cmdline_offset );
- mb_cmdline_offset +=
- ( snprintf ( mb_cmdline,
- ( sizeof ( mb_cmdlines ) - mb_cmdline_offset ),
- "%s %s", imgname, cmdline ) + 1 );
-
- /* Truncate to terminating NUL in buffer if necessary */
- if ( mb_cmdline_offset > sizeof ( mb_cmdlines ) )
- mb_cmdline_offset = ( sizeof ( mb_cmdlines ) - 1 );
-
- return virt_to_phys ( mb_cmdline );
-}
-
-/**
- * Build multiboot module list
- *
- * @v image Multiboot image
- * @v modules Module list to fill, or NULL
- * @ret count Number of modules
- */
-static unsigned int
-multiboot_build_module_list ( struct image *image,
- struct multiboot_module *modules,
- unsigned int limit ) {
- struct image *module_image;
- struct multiboot_module *module;
- unsigned int count = 0;
- unsigned int insert;
- physaddr_t start;
- physaddr_t end;
- unsigned int i;
-
- /* Add each image as a multiboot module */
- for_each_image ( module_image ) {
-
- if ( count >= limit ) {
- DBGC ( image, "MULTIBOOT %p limit of %d modules "
- "reached\n", image, limit );
- break;
- }
-
- /* Do not include kernel image itself as a module */
- if ( module_image == image )
- continue;
-
- /* At least some OSes expect the multiboot modules to
- * be in ascending order, so we have to support it.
- */
- start = user_to_phys ( module_image->data, 0 );
- end = user_to_phys ( module_image->data, module_image->len );
- for ( insert = 0 ; insert < count ; insert++ ) {
- if ( start < modules[insert].mod_start )
- break;
- }
- module = &modules[insert];
- memmove ( ( module + 1 ), module,
- ( ( count - insert ) * sizeof ( *module ) ) );
- module->mod_start = start;
- module->mod_end = end;
- module->string = multiboot_add_cmdline ( module_image->name,
- module_image->cmdline );
- module->reserved = 0;
-
- /* We promise to page-align modules */
- assert ( ( module->mod_start & 0xfff ) == 0 );
-
- count++;
- }
-
- /* Dump module configuration */
- for ( i = 0 ; i < count ; i++ ) {
- DBGC ( image, "MULTIBOOT %p module %d is [%x,%x)\n",
- image, i, modules[i].mod_start,
- modules[i].mod_end );
- }
-
- return count;
-}
-
-/**
- * The multiboot information structure
- *
- * Kept in base memory because some OSes won't find it elsewhere,
- * along with the other structures belonging to the Multiboot
- * information table.
- */
-static struct multiboot_info __bss16 ( mbinfo );
-#define mbinfo __use_data16 ( mbinfo )
-
-/** The multiboot bootloader name */
-static char __data16_array ( mb_bootloader_name, [] ) = "gPXE " VERSION;
-#define mb_bootloader_name __use_data16 ( mb_bootloader_name )
-
-/** The multiboot memory map */
-static struct multiboot_memory_map
- __bss16_array ( mbmemmap, [MAX_MEMORY_REGIONS] );
-#define mbmemmap __use_data16 ( mbmemmap )
-
-/** The multiboot module list */
-static struct multiboot_module __bss16_array ( mbmodules, [MAX_MODULES] );
-#define mbmodules __use_data16 ( mbmodules )
-
-/**
- * Execute multiboot image
- *
- * @v image Multiboot image
- * @ret rc Return status code
- */
-static int multiboot_exec ( struct image *image ) {
- physaddr_t entry = image->priv.phys;
-
- /* Populate multiboot information structure */
- memset ( &mbinfo, 0, sizeof ( mbinfo ) );
- mbinfo.flags = ( MBI_FLAG_LOADER | MBI_FLAG_MEM | MBI_FLAG_MMAP |
- MBI_FLAG_CMDLINE | MBI_FLAG_MODS );
- mb_cmdline_offset = 0;
- mbinfo.cmdline = multiboot_add_cmdline ( image->name, image->cmdline );
- mbinfo.mods_count = multiboot_build_module_list ( image, mbmodules,
- ( sizeof(mbmodules) / sizeof(mbmodules[0]) ) );
- mbinfo.mods_addr = virt_to_phys ( mbmodules );
- mbinfo.mmap_addr = virt_to_phys ( mbmemmap );
- mbinfo.boot_loader_name = virt_to_phys ( mb_bootloader_name );
-
- /* Multiboot images may not return and have no callback
- * interface, so shut everything down prior to booting the OS.
- */
- shutdown ( SHUTDOWN_BOOT );
-
- /* Build memory map after unhiding bootloader memory regions as part of
- * shutting everything down.
- */
- multiboot_build_memmap ( image, &mbinfo, mbmemmap,
- ( sizeof(mbmemmap) / sizeof(mbmemmap[0]) ) );
-
- /* Jump to OS with flat physical addressing */
- DBGC ( image, "MULTIBOOT %p starting execution at %lx\n",
- image, entry );
- __asm__ __volatile__ ( PHYS_CODE ( "pushl %%ebp\n\t"
- "call *%%edi\n\t"
- "popl %%ebp\n\t" )
- : : "a" ( MULTIBOOT_BOOTLOADER_MAGIC ),
- "b" ( virt_to_phys ( &mbinfo ) ),
- "D" ( entry )
- : "ecx", "edx", "esi", "memory" );
-
- DBGC ( image, "MULTIBOOT %p returned\n", image );
-
- /* It isn't safe to continue after calling shutdown() */
- while ( 1 ) {}
-
- return -ECANCELED; /* -EIMPOSSIBLE, anyone? */
-}
-
-/**
- * Find multiboot header
- *
- * @v image Multiboot file
- * @v hdr Multiboot header descriptor to fill in
- * @ret rc Return status code
- */
-static int multiboot_find_header ( struct image *image,
- struct multiboot_header_info *hdr ) {
- uint32_t buf[64];
- size_t offset;
- unsigned int buf_idx;
- uint32_t checksum;
-
- /* Scan through first 8kB of image file 256 bytes at a time.
- * (Use the buffering to avoid the overhead of a
- * copy_from_user() for every dword.)
- */
- for ( offset = 0 ; offset < 8192 ; offset += sizeof ( buf[0] ) ) {
- /* Check for end of image */
- if ( offset > image->len )
- break;
- /* Refill buffer if applicable */
- buf_idx = ( ( offset % sizeof ( buf ) ) / sizeof ( buf[0] ) );
- if ( buf_idx == 0 ) {
- copy_from_user ( buf, image->data, offset,
- sizeof ( buf ) );
- }
- /* Check signature */
- if ( buf[buf_idx] != MULTIBOOT_HEADER_MAGIC )
- continue;
- /* Copy header and verify checksum */
- copy_from_user ( &hdr->mb, image->data, offset,
- sizeof ( hdr->mb ) );
- checksum = ( hdr->mb.magic + hdr->mb.flags +
- hdr->mb.checksum );
- if ( checksum != 0 )
- continue;
- /* Record offset of multiboot header and return */
- hdr->offset = offset;
- return 0;
- }
-
- /* No multiboot header found */
- return -ENOEXEC;
-}
-
-/**
- * Load raw multiboot image into memory
- *
- * @v image Multiboot file
- * @v hdr Multiboot header descriptor
- * @ret rc Return status code
- */
-static int multiboot_load_raw ( struct image *image,
- struct multiboot_header_info *hdr ) {
- size_t offset;
- size_t filesz;
- size_t memsz;
- userptr_t buffer;
- int rc;
-
- /* Sanity check */
- if ( ! ( hdr->mb.flags & MB_FLAG_RAW ) ) {
- DBGC ( image, "MULTIBOOT %p is not flagged as a raw image\n",
- image );
- return -EINVAL;
- }
-
- /* Verify and prepare segment */
- offset = ( hdr->offset - hdr->mb.header_addr + hdr->mb.load_addr );
- filesz = ( hdr->mb.load_end_addr ?
- ( hdr->mb.load_end_addr - hdr->mb.load_addr ) :
- ( image->len - offset ) );
- memsz = ( hdr->mb.bss_end_addr ?
- ( hdr->mb.bss_end_addr - hdr->mb.load_addr ) : filesz );
- buffer = phys_to_user ( hdr->mb.load_addr );
- if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Copy image to segment */
- memcpy_user ( buffer, 0, image->data, offset, filesz );
-
- /* Record execution entry point in image private data field */
- image->priv.phys = hdr->mb.entry_addr;
-
- return 0;
-}
-
-/**
- * Load ELF multiboot image into memory
- *
- * @v image Multiboot file
- * @ret rc Return status code
- */
-static int multiboot_load_elf ( struct image *image ) {
- int rc;
-
- /* Load ELF image*/
- if ( ( rc = elf_load ( image ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p ELF image failed to load: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Load multiboot image into memory
- *
- * @v image Multiboot file
- * @ret rc Return status code
- */
-static int multiboot_load ( struct image *image ) {
- struct multiboot_header_info hdr;
- int rc;
-
- /* Locate multiboot header, if present */
- if ( ( rc = multiboot_find_header ( image, &hdr ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p has no multiboot header\n",
- image );
- return rc;
- }
- DBGC ( image, "MULTIBOOT %p found header with flags %08x\n",
- image, hdr.mb.flags );
-
- /* This is a multiboot image, valid or otherwise */
- if ( ! image->type )
- image->type = &multiboot_image_type;
-
- /* Abort if we detect flags that we cannot support */
- if ( hdr.mb.flags & MB_UNSUPPORTED_FLAGS ) {
- DBGC ( image, "MULTIBOOT %p flags %08x not supported\n",
- image, ( hdr.mb.flags & MB_UNSUPPORTED_FLAGS ) );
- return -ENOTSUP;
- }
-
- /* There is technically a bit MB_FLAG_RAW to indicate whether
- * this is an ELF or a raw image. In practice, grub will use
- * the ELF header if present, and Solaris relies on this
- * behaviour.
- */
- if ( ( ( rc = multiboot_load_elf ( image ) ) != 0 ) &&
- ( ( rc = multiboot_load_raw ( image, &hdr ) ) != 0 ) )
- return rc;
-
- return 0;
-}
-
-/** Multiboot image type */
-struct image_type multiboot_image_type __image_type ( PROBE_MULTIBOOT ) = {
- .name = "Multiboot",
- .load = multiboot_load,
- .exec = multiboot_exec,
-};
diff --git a/gpxe/src/arch/i386/image/nbi.c b/gpxe/src/arch/i386/image/nbi.c
deleted file mode 100644
index a4ee4420..00000000
--- a/gpxe/src/arch/i386/image/nbi.c
+++ /dev/null
@@ -1,442 +0,0 @@
-#include <errno.h>
-#include <assert.h>
-#include <realmode.h>
-#include <gateA20.h>
-#include <memsizes.h>
-#include <basemem_packet.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/segment.h>
-#include <gpxe/init.h>
-#include <gpxe/netdevice.h>
-#include <gpxe/fakedhcp.h>
-#include <gpxe/image.h>
-#include <gpxe/features.h>
-
-/** @file
- *
- * NBI image format.
- *
- * The Net Boot Image format is defined by the "Draft Net Boot Image
- * Proposal 0.3" by Jamie Honan, Gero Kuhlmann and Ken Yap. It is now
- * considered to be a legacy format, but it still included because a
- * large amount of software (e.g. nymph, LTSP) makes use of NBI files.
- *
- * Etherboot does not implement the INT 78 callback interface
- * described by the NBI specification. For a callback interface on
- * x86 architecture, use PXE.
- *
- */
-
-FEATURE ( FEATURE_IMAGE, "NBI", DHCP_EB_FEATURE_NBI, 1 );
-
-struct image_type nbi_image_type __image_type ( PROBE_NORMAL );
-
-/**
- * An NBI image header
- *
- * Note that the length field uses a peculiar encoding; use the
- * NBI_LENGTH() macro to decode the actual header length.
- *
- */
-struct imgheader {
- unsigned long magic; /**< Magic number (NBI_MAGIC) */
- union {
- unsigned char length; /**< Nibble-coded header length */
- unsigned long flags; /**< Image flags */
- };
- segoff_t location; /**< 16-bit seg:off header location */
- union {
- segoff_t segoff; /**< 16-bit seg:off entry point */
- unsigned long linear; /**< 32-bit entry point */
- } execaddr;
-} __attribute__ (( packed ));
-
-/** NBI magic number */
-#define NBI_MAGIC 0x1B031336UL
-
-/* Interpretation of the "length" fields */
-#define NBI_NONVENDOR_LENGTH(len) ( ( (len) & 0x0f ) << 2 )
-#define NBI_VENDOR_LENGTH(len) ( ( (len) & 0xf0 ) >> 2 )
-#define NBI_LENGTH(len) ( NBI_NONVENDOR_LENGTH(len) + NBI_VENDOR_LENGTH(len) )
-
-/* Interpretation of the "flags" fields */
-#define NBI_PROGRAM_RETURNS(flags) ( (flags) & ( 1 << 8 ) )
-#define NBI_LINEAR_EXEC_ADDR(flags) ( (flags) & ( 1 << 31 ) )
-
-/** NBI header length */
-#define NBI_HEADER_LENGTH 512
-
-/**
- * An NBI segment header
- *
- * Note that the length field uses a peculiar encoding; use the
- * NBI_LENGTH() macro to decode the actual header length.
- *
- */
-struct segheader {
- unsigned char length; /**< Nibble-coded header length */
- unsigned char vendortag; /**< Vendor-defined private tag */
- unsigned char reserved;
- unsigned char flags; /**< Segment flags */
- unsigned long loadaddr; /**< Load address */
- unsigned long imglength; /**< Segment length in NBI file */
- unsigned long memlength; /**< Segment length in memory */
-};
-
-/* Interpretation of the "flags" fields */
-#define NBI_LOADADDR_FLAGS(flags) ( (flags) & 0x03 )
-#define NBI_LOADADDR_ABS 0x00
-#define NBI_LOADADDR_AFTER 0x01
-#define NBI_LOADADDR_END 0x02
-#define NBI_LOADADDR_BEFORE 0x03
-#define NBI_LAST_SEGHEADER(flags) ( (flags) & ( 1 << 2 ) )
-
-/* Define a type for passing info to a loaded program */
-struct ebinfo {
- uint8_t major, minor; /* Version */
- uint16_t flags; /* Bit flags */
-};
-
-/** Info passed to NBI image */
-static struct ebinfo loaderinfo = {
- VERSION_MAJOR, VERSION_MINOR,
- 0
-};
-
-/**
- * Prepare a segment for an NBI image
- *
- * @v image NBI image
- * @v offset Offset within NBI image
- * @v filesz Length of initialised-data portion of the segment
- * @v memsz Total length of the segment
- * @v src Source for initialised data
- * @ret rc Return status code
- */
-static int nbi_prepare_segment ( struct image *image, size_t offset __unused,
- userptr_t dest, size_t filesz, size_t memsz ){
- int rc;
-
- if ( ( rc = prep_segment ( dest, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "NBI %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Load a segment for an NBI image
- *
- * @v image NBI image
- * @v offset Offset within NBI image
- * @v filesz Length of initialised-data portion of the segment
- * @v memsz Total length of the segment
- * @v src Source for initialised data
- * @ret rc Return status code
- */
-static int nbi_load_segment ( struct image *image, size_t offset,
- userptr_t dest, size_t filesz,
- size_t memsz __unused ) {
- memcpy_user ( dest, 0, image->data, offset, filesz );
- return 0;
-}
-
-/**
- * Process segments of an NBI image
- *
- * @v image NBI image
- * @v imgheader Image header information
- * @v process Function to call for each segment
- * @ret rc Return status code
- */
-static int nbi_process_segments ( struct image *image,
- struct imgheader *imgheader,
- int ( * process ) ( struct image *image,
- size_t offset,
- userptr_t dest,
- size_t filesz,
- size_t memsz ) ) {
- struct segheader sh;
- size_t offset = 0;
- size_t sh_off;
- userptr_t dest;
- size_t filesz;
- size_t memsz;
- int rc;
-
- /* Copy image header to target location */
- dest = real_to_user ( imgheader->location.segment,
- imgheader->location.offset );
- filesz = memsz = NBI_HEADER_LENGTH;
- if ( ( rc = process ( image, offset, dest, filesz, memsz ) ) != 0 )
- return rc;
- offset += filesz;
-
- /* Process segments in turn */
- sh_off = NBI_LENGTH ( imgheader->length );
- do {
- /* Read segment header */
- copy_from_user ( &sh, image->data, sh_off, sizeof ( sh ) );
- if ( sh.length == 0 ) {
- /* Avoid infinite loop? */
- DBGC ( image, "NBI %p invalid segheader length 0\n",
- image );
- return -ENOEXEC;
- }
-
- /* Calculate segment load address */
- switch ( NBI_LOADADDR_FLAGS ( sh.flags ) ) {
- case NBI_LOADADDR_ABS:
- dest = phys_to_user ( sh.loadaddr );
- break;
- case NBI_LOADADDR_AFTER:
- dest = userptr_add ( dest, memsz + sh.loadaddr );
- break;
- case NBI_LOADADDR_BEFORE:
- dest = userptr_add ( dest, -sh.loadaddr );
- break;
- case NBI_LOADADDR_END:
- /* Not correct according to the spec, but
- * maintains backwards compatibility with
- * previous versions of Etherboot.
- */
- dest = phys_to_user ( ( extmemsize() + 1024 ) * 1024
- - sh.loadaddr );
- break;
- default:
- /* Cannot be reached */
- assert ( 0 );
- }
-
- /* Process this segment */
- filesz = sh.imglength;
- memsz = sh.memlength;
- if ( ( offset + filesz ) > image->len ) {
- DBGC ( image, "NBI %p segment outside file\n", image );
- return -ENOEXEC;
- }
- if ( ( rc = process ( image, offset, dest,
- filesz, memsz ) ) != 0 ) {
- return rc;
- }
- offset += filesz;
-
- /* Next segheader */
- sh_off += NBI_LENGTH ( sh.length );
- if ( sh_off >= NBI_HEADER_LENGTH ) {
- DBGC ( image, "NBI %p header overflow\n", image );
- return -ENOEXEC;
- }
-
- } while ( ! NBI_LAST_SEGHEADER ( sh.flags ) );
-
- if ( offset != image->len ) {
- DBGC ( image, "NBI %p length wrong (file %zd, metadata %zd)\n",
- image, image->len, offset );
- return -ENOEXEC;
- }
-
- return 0;
-}
-
-/**
- * Load an NBI image into memory
- *
- * @v image NBI image
- * @ret rc Return status code
- */
-static int nbi_load ( struct image *image ) {
- struct imgheader imgheader;
- int rc;
-
- /* If we don't have enough data give up */
- if ( image->len < NBI_HEADER_LENGTH ) {
- DBGC ( image, "NBI %p too short for an NBI image\n", image );
- return -ENOEXEC;
- }
-
- /* Check image header */
- copy_from_user ( &imgheader, image->data, 0, sizeof ( imgheader ) );
- if ( imgheader.magic != NBI_MAGIC ) {
- DBGC ( image, "NBI %p has no NBI signature\n", image );
- return -ENOEXEC;
- }
-
- /* This is an NBI image, valid or otherwise */
- if ( ! image->type )
- image->type = &nbi_image_type;
-
- DBGC ( image, "NBI %p placing header at %hx:%hx\n", image,
- imgheader.location.segment, imgheader.location.offset );
-
- /* NBI files can have overlaps between segments; the bss of
- * one segment may overlap the initialised data of another. I
- * assume this is a design flaw, but there are images out
- * there that we need to work with. We therefore do two
- * passes: first to initialise the segments, then to copy the
- * data. This avoids zeroing out already-copied data.
- */
- if ( ( rc = nbi_process_segments ( image, &imgheader,
- nbi_prepare_segment ) ) != 0 )
- return rc;
- if ( ( rc = nbi_process_segments ( image, &imgheader,
- nbi_load_segment ) ) != 0 )
- return rc;
-
- /* Record header address in image private data field */
- image->priv.user = real_to_user ( imgheader.location.segment,
- imgheader.location.offset );
-
- return 0;
-}
-
-/**
- * Boot a 16-bit NBI image
- *
- * @v imgheader Image header information
- * @ret rc Return status code, if image returns
- */
-static int nbi_boot16 ( struct image *image, struct imgheader *imgheader ) {
- int discard_D, discard_S, discard_b;
- int rc;
-
- DBGC ( image, "NBI %p executing 16-bit image at %04x:%04x\n", image,
- imgheader->execaddr.segoff.segment,
- imgheader->execaddr.segoff.offset );
-
- gateA20_unset();
-
- __asm__ __volatile__ (
- REAL_CODE ( "pushw %%ds\n\t" /* far pointer to bootp data */
- "pushw %%bx\n\t"
- "pushl %%esi\n\t" /* location */
- "pushw %%cs\n\t" /* lcall execaddr */
- "call 1f\n\t"
- "jmp 2f\n\t"
- "\n1:\n\t"
- "pushl %%edi\n\t"
- "lret\n\t"
- "\n2:\n\t"
- "addw $8,%%sp\n\t" /* clean up stack */ )
- : "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
- "=b" ( discard_b )
- : "D" ( imgheader->execaddr.segoff ),
- "S" ( imgheader->location ),
- "b" ( __from_data16 ( basemem_packet ) )
- : "ecx", "edx", "ebp" );
-
- gateA20_set();
-
- return rc;
-}
-
-/**
- * Boot a 32-bit NBI image
- *
- * @v imgheader Image header information
- * @ret rc Return status code, if image returns
- */
-static int nbi_boot32 ( struct image *image, struct imgheader *imgheader ) {
- int discard_D, discard_S, discard_b;
- int rc;
-
- DBGC ( image, "NBI %p executing 32-bit image at %lx\n",
- image, imgheader->execaddr.linear );
-
- /* no gateA20_unset for PM call */
-
- /* Jump to OS with flat physical addressing */
- __asm__ __volatile__ (
- PHYS_CODE ( "pushl %%ebx\n\t" /* bootp data */
- "pushl %%esi\n\t" /* imgheader */
- "pushl %%eax\n\t" /* loaderinfo */
- "call *%%edi\n\t"
- "addl $12, %%esp\n\t" /* clean up stack */ )
- : "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
- "=b" ( discard_b )
- : "D" ( imgheader->execaddr.linear ),
- "S" ( ( imgheader->location.segment << 4 ) +
- imgheader->location.offset ),
- "b" ( virt_to_phys ( basemem_packet ) ),
- "a" ( virt_to_phys ( &loaderinfo ) )
- : "ecx", "edx", "ebp", "memory" );
-
- return rc;
-}
-
-/**
- * Prepare DHCP parameter block for NBI image
- *
- * @v image NBI image
- * @ret rc Return status code
- */
-static int nbi_prepare_dhcp ( struct image *image ) {
- struct net_device *boot_netdev;
- int rc;
-
- boot_netdev = last_opened_netdev();
- if ( ! boot_netdev ) {
- DBGC ( image, "NBI %p could not identify a network device\n",
- image );
- return -ENODEV;
- }
-
- if ( ( rc = create_fakedhcpack ( boot_netdev, basemem_packet,
- sizeof ( basemem_packet ) ) ) != 0 ) {
- DBGC ( image, "NBI %p failed to build DHCP packet\n", image );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Execute a loaded NBI image
- *
- * @v image NBI image
- * @ret rc Return status code
- */
-static int nbi_exec ( struct image *image ) {
- struct imgheader imgheader;
- int may_return;
- int rc;
-
- copy_from_user ( &imgheader, image->priv.user, 0,
- sizeof ( imgheader ) );
-
- /* Prepare DHCP option block */
- if ( ( rc = nbi_prepare_dhcp ( image ) ) != 0 )
- return rc;
-
- /* Shut down now if NBI image will not return */
- may_return = NBI_PROGRAM_RETURNS ( imgheader.flags );
- if ( ! may_return )
- shutdown ( SHUTDOWN_BOOT );
-
- /* Execute NBI image */
- if ( NBI_LINEAR_EXEC_ADDR ( imgheader.flags ) ) {
- rc = nbi_boot32 ( image, &imgheader );
- } else {
- rc = nbi_boot16 ( image, &imgheader );
- }
-
- if ( ! may_return ) {
- /* Cannot continue after shutdown() called */
- DBGC ( image, "NBI %p returned %d from non-returnable image\n",
- image, rc );
- while ( 1 ) {}
- }
-
- DBGC ( image, "NBI %p returned %d\n", image, rc );
-
- return rc;
-}
-
-/** NBI image type */
-struct image_type nbi_image_type __image_type ( PROBE_NORMAL ) = {
- .name = "NBI",
- .load = nbi_load,
- .exec = nbi_exec,
-};
diff --git a/gpxe/src/arch/i386/image/pxe_image.c b/gpxe/src/arch/i386/image/pxe_image.c
deleted file mode 100644
index 63429f87..00000000
--- a/gpxe/src/arch/i386/image/pxe_image.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @file
- *
- * PXE image format
- *
- */
-
-#include <pxe.h>
-#include <pxe_call.h>
-#include <gpxe/uaccess.h>
-#include <gpxe/image.h>
-#include <gpxe/segment.h>
-#include <gpxe/netdevice.h>
-#include <gpxe/features.h>
-
-FEATURE ( FEATURE_IMAGE, "PXE", DHCP_EB_FEATURE_PXE, 1 );
-
-struct image_type pxe_image_type __image_type ( PROBE_PXE );
-
-/**
- * Execute PXE image
- *
- * @v image PXE image
- * @ret rc Return status code
- */
-static int pxe_exec ( struct image *image ) {
- struct net_device *netdev;
- int rc;
-
- /* Arbitrarily pick the most recently opened network device */
- if ( ( netdev = last_opened_netdev() ) == NULL ) {
- DBGC ( image, "IMAGE %p could not locate PXE net device\n",
- image );
- return -ENODEV;
- }
-
- /* Activate PXE */
- pxe_activate ( netdev );
-
- /* Start PXE NBP */
- rc = pxe_start_nbp();
-
- /* Deactivate PXE */
- pxe_deactivate();
-
- return rc;
-}
-
-/**
- * Load PXE image into memory
- *
- * @v image PXE file
- * @ret rc Return status code
- */
-int pxe_load ( struct image *image ) {
- userptr_t buffer = real_to_user ( 0, 0x7c00 );
- size_t filesz = image->len;
- size_t memsz = image->len;
- int rc;
-
- /* Images too large to fit in base memory cannot be PXE
- * images. We include this check to help prevent unrecognised
- * images from being marked as PXE images, since PXE images
- * have no signature we can check against.
- */
- if ( filesz > ( 0xa0000 - 0x7c00 ) )
- return -ENOEXEC;
-
- /* Rejecting zero-length images is also useful, since these
- * end up looking to the user like bugs in gPXE.
- */
- if ( ! filesz )
- return -ENOEXEC;
-
- /* There are no signature checks for PXE; we will accept anything */
- if ( ! image->type )
- image->type = &pxe_image_type;
-
- /* Verify and prepare segment */
- if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "IMAGE %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
- return rc;
- }
-
- /* Copy image to segment */
- memcpy_user ( buffer, 0, image->data, 0, filesz );
-
- return 0;
-}
-
-/** PXE image type */
-struct image_type pxe_image_type __image_type ( PROBE_PXE ) = {
- .name = "PXE",
- .load = pxe_load,
- .exec = pxe_exec,
-};
diff --git a/gpxe/src/arch/i386/include/basemem.h b/gpxe/src/arch/i386/include/basemem.h
deleted file mode 100644
index c477c7fe..00000000
--- a/gpxe/src/arch/i386/include/basemem.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _BASEMEM_H
-#define _BASEMEM_H
-
-/** @file
- *
- * Base memory allocation
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <realmode.h>
-#include <bios.h>
-
-/**
- * Read the BIOS free base memory counter
- *
- * @ret fbms Free base memory counter (in kB)
- */
-static inline unsigned int get_fbms ( void ) {
- uint16_t fbms;
-
- get_real ( fbms, BDA_SEG, BDA_FBMS );
- return fbms;
-}
-
-extern void set_fbms ( unsigned int new_fbms );
-
-/* Actually in hidemem.c, but putting it here avoids polluting the
- * architecture-independent include/hidemem.h.
- */
-extern void hide_basemem ( void );
-
-#endif /* _BASEMEM_H */
diff --git a/gpxe/src/arch/i386/include/basemem_packet.h b/gpxe/src/arch/i386/include/basemem_packet.h
deleted file mode 100644
index 3cb47767..00000000
--- a/gpxe/src/arch/i386/include/basemem_packet.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef BASEMEM_PACKET_H
-#define BASEMEM_PACKET_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <realmode.h>
-
-/** Maximum length of base memory packet buffer */
-#define BASEMEM_PACKET_LEN 1514
-
-/** Base memory packet buffer */
-extern char __bss16_array ( basemem_packet, [BASEMEM_PACKET_LEN] );
-#define basemem_packet __use_data16 ( basemem_packet )
-
-#endif /* BASEMEM_PACKET_H */
diff --git a/gpxe/src/arch/i386/include/bios.h b/gpxe/src/arch/i386/include/bios.h
deleted file mode 100644
index 70bb73da..00000000
--- a/gpxe/src/arch/i386/include/bios.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef BIOS_H
-#define BIOS_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#define BDA_SEG 0x0040
-#define BDA_FBMS 0x0013
-#define BDA_NUM_DRIVES 0x0075
-
-#endif /* BIOS_H */
diff --git a/gpxe/src/arch/i386/include/bios_disks.h b/gpxe/src/arch/i386/include/bios_disks.h
deleted file mode 100644
index 0dd7c4eb..00000000
--- a/gpxe/src/arch/i386/include/bios_disks.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef BIOS_DISKS_H
-#define BIOS_DISKS_H
-
-#include "dev.h"
-
-/*
- * Constants
- *
- */
-
-#define BIOS_DISK_MAX_NAME_LEN 6
-
-struct bios_disk_sector {
- char data[512];
-};
-
-/*
- * The location of a BIOS disk
- *
- */
-struct bios_disk_loc {
- uint8_t drive;
-};
-
-/*
- * A physical BIOS disk device
- *
- */
-struct bios_disk_device {
- char name[BIOS_DISK_MAX_NAME_LEN];
- uint8_t drive;
- uint8_t type;
-};
-
-/*
- * A BIOS disk driver, with a valid device ID range and naming
- * function.
- *
- */
-struct bios_disk_driver {
- void ( *fill_drive_name ) ( char *buf, uint8_t drive );
- uint8_t min_drive;
- uint8_t max_drive;
-};
-
-/*
- * Define a BIOS disk driver
- *
- */
-#define BIOS_DISK_DRIVER( _name, _fill_drive_name, _min_drive, _max_drive ) \
- static struct bios_disk_driver _name = { \
- .fill_drive_name = _fill_drive_name, \
- .min_drive = _min_drive, \
- .max_drive = _max_drive, \
- }
-
-/*
- * Functions in bios_disks.c
- *
- */
-
-
-/*
- * bios_disk bus global definition
- *
- */
-extern struct bus_driver bios_disk_driver;
-
-#endif /* BIOS_DISKS_H */
diff --git a/gpxe/src/arch/i386/include/biosint.h b/gpxe/src/arch/i386/include/biosint.h
deleted file mode 100644
index ab466af3..00000000
--- a/gpxe/src/arch/i386/include/biosint.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef BIOSINT_H
-#define BIOSINT_H
-
-/**
- * @file BIOS interrupts
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <realmode.h>
-
-struct segoff;
-
-/**
- * Hooked interrupt count
- *
- * At exit, after unhooking all possible interrupts, this counter
- * should be examined. If it is non-zero, it means that we failed to
- * unhook at least one interrupt vector, and so must not free up the
- * memory we are using. (Note that this also implies that we should
- * re-hook INT 15 in order to hide ourselves from the memory map).
- */
-extern uint16_t __text16 ( hooked_bios_interrupts );
-#define hooked_bios_interrupts __use_text16 ( hooked_bios_interrupts )
-
-extern void hook_bios_interrupt ( unsigned int interrupt, unsigned int handler,
- struct segoff *chain_vector );
-extern int unhook_bios_interrupt ( unsigned int interrupt,
- unsigned int handler,
- struct segoff *chain_vector );
-
-#endif /* BIOSINT_H */
diff --git a/gpxe/src/arch/i386/include/bits/byteswap.h b/gpxe/src/arch/i386/include/bits/byteswap.h
deleted file mode 100644
index ddbd40ed..00000000
--- a/gpxe/src/arch/i386/include/bits/byteswap.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ETHERBOOT_BITS_BYTESWAP_H
-#define ETHERBOOT_BITS_BYTESWAP_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-static inline __attribute__ ((always_inline, const)) uint16_t
-__bswap_variable_16(uint16_t x)
-{
- __asm__("xchgb %b0,%h0\n\t"
- : "=q" (x)
- : "0" (x));
- return x;
-}
-
-static inline __attribute__ ((always_inline, const)) uint32_t
-__bswap_variable_32(uint32_t x)
-{
- __asm__("xchgb %b0,%h0\n\t"
- "rorl $16,%0\n\t"
- "xchgb %b0,%h0"
- : "=q" (x)
- : "0" (x));
- return x;
-}
-
-static inline __attribute__ ((always_inline, const)) uint64_t
-__bswap_variable_64(uint64_t x)
-{
- union {
- uint64_t qword;
- uint32_t dword[2];
- } u;
-
- u.qword = x;
- u.dword[0] = __bswap_variable_32(u.dword[0]);
- u.dword[1] = __bswap_variable_32(u.dword[1]);
- __asm__("xchgl %0,%1"
- : "=r" ( u.dword[0] ), "=r" ( u.dword[1] )
- : "0" ( u.dword[0] ), "1" ( u.dword[1] ) );
- return u.qword;
-}
-
-#endif /* ETHERBOOT_BITS_BYTESWAP_H */
diff --git a/gpxe/src/arch/i386/include/bits/compiler.h b/gpxe/src/arch/i386/include/bits/compiler.h
deleted file mode 100644
index 000db0c1..00000000
--- a/gpxe/src/arch/i386/include/bits/compiler.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _BITS_COMPILER_H
-#define _BITS_COMPILER_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifndef ASSEMBLY
-
-/** Declare a function with standard calling conventions */
-#define __asmcall __attribute__ (( cdecl, regparm(0) ))
-
-/**
- * Declare a function with libgcc implicit linkage
- *
- * It seems as though gcc expects its implicit arithmetic functions to
- * be cdecl, even if -mrtd is specified. This is somewhat
- * inconsistent; for example, if -mregparm=3 is used then the implicit
- * functions do become regparm(3).
- *
- * The implicit calls to memcpy() and memset() which gcc can generate
- * do not seem to have this inconsistency; -mregparm and -mrtd affect
- * them in the same way as any other function.
- */
-#define __libgcc __attribute__ (( cdecl ))
-
-#endif /* ASSEMBLY */
-
-#endif /* _BITS_COMPILER_H */
diff --git a/gpxe/src/arch/i386/include/bits/cpu.h b/gpxe/src/arch/i386/include/bits/cpu.h
deleted file mode 100644
index 83339ddd..00000000
--- a/gpxe/src/arch/i386/include/bits/cpu.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef I386_BITS_CPU_H
-#define I386_BITS_CPU_H
-
-/* Intel-defined CPU features, CPUID level 0x00000001, word 0 */
-#define X86_FEATURE_FPU 0 /* Onboard FPU */
-#define X86_FEATURE_VME 1 /* Virtual Mode Extensions */
-#define X86_FEATURE_DE 2 /* Debugging Extensions */
-#define X86_FEATURE_PSE 3 /* Page Size Extensions */
-#define X86_FEATURE_TSC 4 /* Time Stamp Counter */
-#define X86_FEATURE_MSR 5 /* Model-Specific Registers, RDMSR, WRMSR */
-#define X86_FEATURE_PAE 6 /* Physical Address Extensions */
-#define X86_FEATURE_MCE 7 /* Machine Check Architecture */
-#define X86_FEATURE_CX8 8 /* CMPXCHG8 instruction */
-#define X86_FEATURE_APIC 9 /* Onboard APIC */
-#define X86_FEATURE_SEP 11 /* SYSENTER/SYSEXIT */
-#define X86_FEATURE_MTRR 12 /* Memory Type Range Registers */
-#define X86_FEATURE_PGE 13 /* Page Global Enable */
-#define X86_FEATURE_MCA 14 /* Machine Check Architecture */
-#define X86_FEATURE_CMOV 15 /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */
-#define X86_FEATURE_PAT 16 /* Page Attribute Table */
-#define X86_FEATURE_PSE36 17 /* 36-bit PSEs */
-#define X86_FEATURE_PN 18 /* Processor serial number */
-#define X86_FEATURE_CLFLSH 19 /* Supports the CLFLUSH instruction */
-#define X86_FEATURE_DTES 21 /* Debug Trace Store */
-#define X86_FEATURE_ACPI 22 /* ACPI via MSR */
-#define X86_FEATURE_MMX 23 /* Multimedia Extensions */
-#define X86_FEATURE_FXSR 24 /* FXSAVE and FXRSTOR instructions (fast save and restore */
- /* of FPU context), and CR4.OSFXSR available */
-#define X86_FEATURE_XMM 25 /* Streaming SIMD Extensions */
-#define X86_FEATURE_XMM2 26 /* Streaming SIMD Extensions-2 */
-#define X86_FEATURE_SELFSNOOP 27 /* CPU self snoop */
-#define X86_FEATURE_HT 28 /* Hyper-Threading */
-#define X86_FEATURE_ACC 29 /* Automatic clock control */
-#define X86_FEATURE_IA64 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 11 /* SYSCALL/SYSRET */
-#define X86_FEATURE_MMXEXT 22 /* AMD MMX extensions */
-#define X86_FEATURE_LM 29 /* Long Mode (x86-64) */
-#define X86_FEATURE_3DNOWEXT 30 /* AMD 3DNow! extensions */
-#define X86_FEATURE_3DNOW 31 /* 3DNow! */
-
-/** x86 CPU information */
-struct cpuinfo_x86 {
- /** CPU features */
- unsigned int features;
- /** 64-bit CPU features */
- unsigned int amd_features;
-};
-
-/*
- * 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 __attribute__ (( always_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 ) );
-}
-
-extern void get_cpuinfo ( struct cpuinfo_x86 *cpu );
-
-#endif /* I386_BITS_CPU_H */
diff --git a/gpxe/src/arch/i386/include/bits/eltorito.h b/gpxe/src/arch/i386/include/bits/eltorito.h
deleted file mode 100644
index d43e9aac..00000000
--- a/gpxe/src/arch/i386/include/bits/eltorito.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifndef ELTORITO_PLATFORM
-#define ELTORITO_PLATFORM ELTORITO_PLATFORM_X86
-#endif /* ELTORITO_PLATFORM */
diff --git a/gpxe/src/arch/i386/include/bits/endian.h b/gpxe/src/arch/i386/include/bits/endian.h
deleted file mode 100644
index 84188542..00000000
--- a/gpxe/src/arch/i386/include/bits/endian.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef ETHERBOOT_BITS_ENDIAN_H
-#define ETHERBOOT_BITS_ENDIAN_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#define __BYTE_ORDER __LITTLE_ENDIAN
-
-#endif /* ETHERBOOT_BITS_ENDIAN_H */
diff --git a/gpxe/src/arch/i386/include/bits/errfile.h b/gpxe/src/arch/i386/include/bits/errfile.h
deleted file mode 100644
index 32b8a085..00000000
--- a/gpxe/src/arch/i386/include/bits/errfile.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _BITS_ERRFILE_H
-#define _BITS_ERRFILE_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/**
- * @addtogroup errfile Error file identifiers
- * @{
- */
-
-#define ERRFILE_memtop_umalloc ( ERRFILE_ARCH | ERRFILE_CORE | 0x00000000 )
-#define ERRFILE_memmap ( ERRFILE_ARCH | ERRFILE_CORE | 0x00010000 )
-#define ERRFILE_pnpbios ( ERRFILE_ARCH | ERRFILE_CORE | 0x00020000 )
-#define ERRFILE_bios_smbios ( ERRFILE_ARCH | ERRFILE_CORE | 0x00030000 )
-#define ERRFILE_biosint ( ERRFILE_ARCH | ERRFILE_CORE | 0x00040000 )
-#define ERRFILE_int13 ( ERRFILE_ARCH | ERRFILE_CORE | 0x00050000 )
-#define ERRFILE_pxeparent ( ERRFILE_ARCH | ERRFILE_CORE | 0x00060000 )
-
-#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
-#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
-#define ERRFILE_eltorito ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00020000 )
-#define ERRFILE_multiboot ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00030000 )
-#define ERRFILE_nbi ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00040000 )
-#define ERRFILE_pxe_image ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00050000 )
-#define ERRFILE_elfboot ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00060000 )
-#define ERRFILE_comboot ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00070000 )
-#define ERRFILE_com32 ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00080000 )
-#define ERRFILE_comboot_resolv ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00090000 )
-#define ERRFILE_comboot_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000a0000 )
-
-#define ERRFILE_undi ( ERRFILE_ARCH | ERRFILE_NET | 0x00000000 )
-#define ERRFILE_undiload ( ERRFILE_ARCH | ERRFILE_NET | 0x00010000 )
-#define ERRFILE_undinet ( ERRFILE_ARCH | ERRFILE_NET | 0x00020000 )
-#define ERRFILE_undionly ( ERRFILE_ARCH | ERRFILE_NET | 0x00030000 )
-#define ERRFILE_undirom ( ERRFILE_ARCH | ERRFILE_NET | 0x00040000 )
-
-#define ERRFILE_timer_rdtsc ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00000000 )
-#define ERRFILE_timer_bios ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00010000 )
-
-/** @} */
-
-#endif /* _BITS_ERRFILE_H */
diff --git a/gpxe/src/arch/i386/include/bits/io.h b/gpxe/src/arch/i386/include/bits/io.h
deleted file mode 100644
index eded9778..00000000
--- a/gpxe/src/arch/i386/include/bits/io.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_IO_H
-#define _BITS_IO_H
-
-/** @file
- *
- * i386-specific I/O API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/x86_io.h>
-
-#endif /* _BITS_IO_H */
diff --git a/gpxe/src/arch/i386/include/bits/nap.h b/gpxe/src/arch/i386/include/bits/nap.h
deleted file mode 100644
index 1354f6bb..00000000
--- a/gpxe/src/arch/i386/include/bits/nap.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _BITS_NAP_H
-#define _BITS_NAP_H
-
-/** @file
- *
- * i386-specific CPU sleeping API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/bios_nap.h>
-#include <gpxe/efi/efix86_nap.h>
-
-#endif /* _BITS_MAP_H */
diff --git a/gpxe/src/arch/i386/include/bits/smbios.h b/gpxe/src/arch/i386/include/bits/smbios.h
deleted file mode 100644
index a68413aa..00000000
--- a/gpxe/src/arch/i386/include/bits/smbios.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_SMBIOS_H
-#define _BITS_SMBIOS_H
-
-/** @file
- *
- * i386-specific SMBIOS API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/bios_smbios.h>
-
-#endif /* _BITS_SMBIOS_H */
diff --git a/gpxe/src/arch/i386/include/bits/stdint.h b/gpxe/src/arch/i386/include/bits/stdint.h
deleted file mode 100644
index 8edf1319..00000000
--- a/gpxe/src/arch/i386/include/bits/stdint.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _BITS_STDINT_H
-#define _BITS_STDINT_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-typedef __SIZE_TYPE__ size_t;
-typedef signed long ssize_t;
-typedef signed long off_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_t;
-typedef signed short int16_t;
-typedef signed int int32_t;
-typedef signed long long int64_t;
-
-typedef unsigned long physaddr_t;
-typedef unsigned long intptr_t;
-
-#endif /* _BITS_STDINT_H */
diff --git a/gpxe/src/arch/i386/include/bits/timer.h b/gpxe/src/arch/i386/include/bits/timer.h
deleted file mode 100644
index 32e6bd47..00000000
--- a/gpxe/src/arch/i386/include/bits/timer.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _BITS_TIMER_H
-#define _BITS_TIMER_H
-
-/** @file
- *
- * i386-specific timer API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/bios_timer.h>
-#include <gpxe/rdtsc_timer.h>
-
-#endif /* _BITS_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/bits/uaccess.h b/gpxe/src/arch/i386/include/bits/uaccess.h
deleted file mode 100644
index 2bb52e02..00000000
--- a/gpxe/src/arch/i386/include/bits/uaccess.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_UACCESS_H
-#define _BITS_UACCESS_H
-
-/** @file
- *
- * i386-specific user access API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <librm.h>
-
-#endif /* _BITS_UACCESS_H */
diff --git a/gpxe/src/arch/i386/include/bits/umalloc.h b/gpxe/src/arch/i386/include/bits/umalloc.h
deleted file mode 100644
index 17ba2cb2..00000000
--- a/gpxe/src/arch/i386/include/bits/umalloc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_UMALLOC_H
-#define _BITS_UMALLOC_H
-
-/** @file
- *
- * i386-specific user memory allocation API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <gpxe/memtop_umalloc.h>
-
-#endif /* _BITS_UMALLOC_H */
diff --git a/gpxe/src/arch/i386/include/bochs.h b/gpxe/src/arch/i386/include/bochs.h
deleted file mode 100644
index 9d090fc1..00000000
--- a/gpxe/src/arch/i386/include/bochs.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef BOCHS_H
-#define BOCHS_H
-
-/** @file
- *
- * bochs breakpoints
- *
- * This file defines @c bochsbp, the magic breakpoint instruction that
- * is incredibly useful when debugging under bochs. This file should
- * never be included in production code.
- *
- * Use the pseudo-instruction @c bochsbp in assembly code, or the
- * bochsbp() function in C code.
- *
- */
-
-#ifdef ASSEMBLY
-
-/* Breakpoint for when debugging under bochs */
-#define bochsbp xchgw %bx, %bx
-#define BOCHSBP bochsbp
-
-#else /* ASSEMBLY */
-
-/** Breakpoint for when debugging under bochs */
-static inline void bochsbp ( void ) {
- __asm__ __volatile__ ( "xchgw %bx, %bx" );
-}
-
-#endif /* ASSEMBLY */
-
-#warning "bochs.h should not be included into production code"
-
-#endif /* BOCHS_H */
diff --git a/gpxe/src/arch/i386/include/bootsector.h b/gpxe/src/arch/i386/include/bootsector.h
deleted file mode 100644
index 8730fbfc..00000000
--- a/gpxe/src/arch/i386/include/bootsector.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BOOTSECTOR_H
-#define _BOOTSECTOR_H
-
-/** @file
- *
- * x86 bootsector image format
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-extern int call_bootsector ( unsigned int segment, unsigned int offset,
- unsigned int drive );
-
-#endif /* _BOOTSECTOR_H */
diff --git a/gpxe/src/arch/i386/include/bzimage.h b/gpxe/src/arch/i386/include/bzimage.h
deleted file mode 100644
index 42b31fe4..00000000
--- a/gpxe/src/arch/i386/include/bzimage.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef _BZIMAGE_H
-#define _BZIMAGE_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-
-/**
- * A bzImage header
- *
- * As documented in Documentation/i386/boot.txt
- */
-struct bzimage_header {
- /** The size of the setup in sectors
- *
- * If this field contains 0, assume it contains 4.
- */
- uint8_t setup_sects;
- /** If set, the root is mounted readonly */
- uint16_t root_flags;
- /** DO NOT USE - for bootsect.S use only */
- uint16_t syssize;
- /** DO NOT USE - obsolete */
- uint16_t swap_dev;
- /** DO NOT USE - for bootsect.S use only */
- uint16_t ram_size;
- /** Video mode control */
- uint16_t vid_mode;
- /** Default root device number */
- uint16_t root_dev;
- /** 0xAA55 magic number */
- uint16_t boot_flag;
- /** Jump instruction */
- uint16_t jump;
- /** Magic signature "HdrS" */
- uint32_t header;
- /** Boot protocol version supported */
- uint16_t version;
- /** Boot loader hook (see below) */
- uint32_t realmode_swtch;
- /** The load-low segment (0x1000) (obsolete) */
- uint16_t start_sys;
- /** Pointer to kernel version string */
- uint16_t kernel_version;
- /** Boot loader identifier */
- uint8_t type_of_loader;
- /** Boot protocol option flags */
- uint8_t loadflags;
- /** Move to high memory size (used with hooks) */
- uint16_t setup_move_size;
- /** Boot loader hook (see below) */
- uint32_t code32_start;
- /** initrd load address (set by boot loader) */
- uint32_t ramdisk_image;
- /** initrd size (set by boot loader) */
- uint32_t ramdisk_size;
- /** DO NOT USE - for bootsect.S use only */
- uint32_t bootsect_kludge;
- /** Free memory after setup end */
- uint16_t heap_end_ptr;
- /** Unused */
- uint16_t pad1;
- /** 32-bit pointer to the kernel command line */
- uint32_t cmd_line_ptr;
- /** Highest legal initrd address */
- uint32_t initrd_addr_max;
- /** Physical addr alignment required for kernel */
- uint32_t kernel_alignment;
- /** Whether kernel is relocatable or not */
- uint8_t relocatable_kernel;
- /** Unused */
- uint8_t pad2[3];
- /** Maximum size of the kernel command line */
- uint32_t cmdline_size;
-} __attribute__ (( packed ));
-
-/** Offset of bzImage header within kernel image */
-#define BZI_HDR_OFFSET 0x1f1
-
-/** bzImage boot flag value */
-#define BZI_BOOT_FLAG 0xaa55
-
-/** bzImage magic signature value */
-#define BZI_SIGNATURE 0x53726448
-
-/** bzImage boot loader identifier for Etherboot */
-#define BZI_LOADER_TYPE_ETHERBOOT 0x40
-
-/** bzImage boot loader identifier for gPXE
- *
- * We advertise ourselves as Etherboot version 6.
- */
-#define BZI_LOADER_TYPE_GPXE ( BZI_LOADER_TYPE_ETHERBOOT | 0x06 )
-
-/** bzImage "load high" flag */
-#define BZI_LOAD_HIGH 0x01
-
-/** Load address for high-loaded kernels */
-#define BZI_LOAD_HIGH_ADDR 0x100000
-
-/** Load address for low-loaded kernels */
-#define BZI_LOAD_LOW_ADDR 0x10000
-
-/** bzImage "kernel can use heap" flag */
-#define BZI_CAN_USE_HEAP 0x80
-
-/** bzImage special video mode "normal" */
-#define BZI_VID_MODE_NORMAL 0xffff
-
-/** bzImage special video mode "ext" */
-#define BZI_VID_MODE_EXT 0xfffe
-
-/** bzImage special video mode "ask" */
-#define BZI_VID_MODE_ASK 0xfffd
-
-/** bzImage maximum initrd address for versions < 2.03 */
-#define BZI_INITRD_MAX 0x37ffffff
-
-/** bzImage command-line structure used by older kernels */
-struct bzimage_cmdline {
- /** Magic signature */
- uint16_t magic;
- /** Offset to command line */
- uint16_t offset;
-} __attribute__ (( packed ));
-
-/** Offset of bzImage command-line structure within kernel image */
-#define BZI_CMDLINE_OFFSET 0x20
-
-/** bzImage command line present magic marker value */
-#define BZI_CMDLINE_MAGIC 0xa33f
-
-/** Assumed size of real-mode portion (including .bss) */
-#define BZI_ASSUMED_RM_SIZE 0x8000
-
-/** Amount of stack space to provide */
-#define BZI_STACK_SIZE 0x1000
-
-/** Maximum size of command line */
-#define BZI_CMDLINE_SIZE 0x100
-
-#endif /* _BZIMAGE_H */
diff --git a/gpxe/src/arch/i386/include/comboot.h b/gpxe/src/arch/i386/include/comboot.h
deleted file mode 100644
index 1232f0a7..00000000
--- a/gpxe/src/arch/i386/include/comboot.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef COMBOOT_H
-#define COMBOOT_H
-
-/**
- * @file
- *
- * SYSLINUX COMBOOT
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <setjmp.h>
-#include <gpxe/in.h>
-
-/** Segment used for COMBOOT PSP and image */
-#define COMBOOT_PSP_SEG 0x07C0
-
-/** Entry point address of COM32 images */
-#define COM32_START_PHYS 0x101000
-
-/** COM32 bounce buffer segment */
-#define COM32_BOUNCE_SEG 0x07C0
-
-/** Size of SYSLINUX file block in bytes */
-#define COMBOOT_FILE_BLOCKSZ 512
-
-/** COMBOOT feature flags (INT 22h AX=15h) */
-#define COMBOOT_FEATURE_LOCAL_BOOT (1 << 0)
-#define COMBOOT_FEATURE_IDLE_LOOP (1 << 1)
-
-/** Maximum number of shuffle descriptors for
- * shuffle and boot functions
- * (INT 22h AX=0012h, 001Ah, 001Bh)
- */
-#define COMBOOT_MAX_SHUFFLE_DESCRIPTORS 682
-
-typedef union {
- uint32_t l;
- uint16_t w[2];
- uint8_t b[4];
-} com32_reg32_t;
-
-typedef struct {
- uint16_t gs; /* Offset 0 */
- uint16_t fs; /* Offset 2 */
- uint16_t es; /* Offset 4 */
- uint16_t ds; /* Offset 6 */
-
- com32_reg32_t edi; /* Offset 8 */
- com32_reg32_t esi; /* Offset 12 */
- com32_reg32_t ebp; /* Offset 16 */
- com32_reg32_t _unused_esp; /* Offset 20 */
- com32_reg32_t ebx; /* Offset 24 */
- com32_reg32_t edx; /* Offset 28 */
- com32_reg32_t ecx; /* Offset 32 */
- com32_reg32_t eax; /* Offset 36 */
-
- com32_reg32_t eflags; /* Offset 40 */
-} com32sys_t;
-
-typedef struct {
- uint32_t eax; /* Offset 0 */
- uint32_t ecx; /* Offset 4 */
- uint32_t edx; /* Offset 8 */
- uint32_t ebx; /* Offset 12 */
- uint32_t esp; /* Offset 16 */
- uint32_t ebp; /* Offset 20 */
- uint32_t esi; /* Offset 24 */
- uint32_t edi; /* Offset 28 */
-
- uint32_t eip; /* Offset 32 */
-} syslinux_pm_regs;
-
-typedef struct {
- uint16_t es; /* Offset 0 */
- uint16_t _unused_cs; /* Offset 2 */
- uint16_t ds; /* Offset 4 */
- uint16_t ss; /* Offset 6 */
- uint16_t fs; /* Offset 8 */
- uint16_t gs; /* Offset 10 */
-
- uint32_t eax; /* Offset 12 */
- uint32_t ecx; /* Offset 16 */
- uint32_t edx; /* Offset 20 */
- uint32_t ebx; /* Offset 24 */
- uint32_t esp; /* Offset 28 */
- uint32_t ebp; /* Offset 32 */
- uint32_t esi; /* Offset 36 */
- uint32_t edi; /* Offset 40 */
-
- uint16_t ip; /* Offset 44 */
- uint16_t cs; /* Offset 46 */
-} syslinux_rm_regs;
-
-typedef struct {
- uint32_t dest;
- uint32_t src;
- uint32_t len;
-} comboot_shuffle_descriptor;
-
-extern void hook_comboot_interrupts ( );
-extern void unhook_comboot_interrupts ( );
-
-/* These are not the correct prototypes, but it doens't matter,
- * as we only ever get the address of these functions;
- * they are only called from COM32 code running in PHYS_CODE
- */
-extern void com32_intcall_wrapper ( );
-extern void com32_farcall_wrapper ( );
-extern void com32_cfarcall_wrapper ( );
-
-/* Resolve a hostname to an (IPv4) address */
-extern int comboot_resolv ( const char *name, struct in_addr *address );
-
-/* setjmp/longjmp context buffer used to return after loading an image */
-extern rmjmp_buf comboot_return;
-
-/* Replacement image when exiting with COMBOOT_EXIT_RUN_KERNEL */
-extern struct image *comboot_replacement_image;
-
-extern void *com32_external_esp;
-
-#define COMBOOT_EXIT 1
-#define COMBOOT_EXIT_RUN_KERNEL 2
-#define COMBOOT_EXIT_COMMAND 3
-
-extern void comboot_force_text_mode ( void );
-
-#define COMBOOT_VIDEO_GRAPHICS 0x01
-#define COMBOOT_VIDEO_NONSTANDARD 0x02
-#define COMBOOT_VIDEO_VESA 0x04
-#define COMBOOT_VIDEO_NOTEXT 0x08
-
-#endif
diff --git a/gpxe/src/arch/i386/include/fakee820.h b/gpxe/src/arch/i386/include/fakee820.h
deleted file mode 100644
index 9d00fb67..00000000
--- a/gpxe/src/arch/i386/include/fakee820.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _FAKEE820_H
-#define _FAKEE820_H
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-extern void fake_e820 ( void );
-extern void unfake_e820 ( void );
-
-#endif /* _FAKEE820_H */
diff --git a/gpxe/src/arch/i386/include/gateA20.h b/gpxe/src/arch/i386/include/gateA20.h
deleted file mode 100644
index 297ad6f2..00000000
--- a/gpxe/src/arch/i386/include/gateA20.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef GATEA20_H
-#define GATEA20_H
-
-extern void gateA20_set ( void );
-extern void gateA20_unset ( void );
-
-#endif /* GATEA20_H */
diff --git a/gpxe/src/arch/i386/include/gdbmach.h b/gpxe/src/arch/i386/include/gdbmach.h
deleted file mode 100644
index 794dab19..00000000
--- a/gpxe/src/arch/i386/include/gdbmach.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef GDBMACH_H
-#define GDBMACH_H
-
-/** @file
- *
- * GDB architecture specifics
- *
- * This file declares functions for manipulating the machine state and
- * debugging context.
- *
- */
-
-#include <stdint.h>
-
-typedef unsigned long gdbreg_t;
-
-/* The register snapshot, this must be in sync with interrupt handler and the
- * GDB protocol. */
-enum {
- GDBMACH_EAX,
- GDBMACH_ECX,
- GDBMACH_EDX,
- GDBMACH_EBX,
- GDBMACH_ESP,
- GDBMACH_EBP,
- GDBMACH_ESI,
- GDBMACH_EDI,
- GDBMACH_EIP,
- GDBMACH_EFLAGS,
- GDBMACH_CS,
- GDBMACH_SS,
- GDBMACH_DS,
- GDBMACH_ES,
- GDBMACH_FS,
- GDBMACH_GS,
- GDBMACH_NREGS,
- GDBMACH_SIZEOF_REGS = GDBMACH_NREGS * sizeof ( gdbreg_t )
-};
-
-/* Breakpoint types */
-enum {
- GDBMACH_BPMEM,
- GDBMACH_BPHW,
- GDBMACH_WATCH,
- GDBMACH_RWATCH,
- GDBMACH_AWATCH,
-};
-
-static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
- regs [ GDBMACH_EIP ] = pc;
-}
-
-static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
- regs [ GDBMACH_EFLAGS ] &= ~( 1 << 8 ); /* Trace Flag (TF) */
- regs [ GDBMACH_EFLAGS ] |= ( step << 8 );
-}
-
-static inline void gdbmach_breakpoint ( void ) {
- __asm__ __volatile__ ( "int $3\n" );
-}
-
-extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len, int enable );
-
-#endif /* GDBMACH_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/abft.h b/gpxe/src/arch/i386/include/gpxe/abft.h
deleted file mode 100644
index 9065e61a..00000000
--- a/gpxe/src/arch/i386/include/gpxe/abft.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _GPXE_ABFT_H
-#define _GPXE_ABFT_H
-
-/** @file
- *
- * AoE boot firmware table
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/if_ether.h>
-
-/** AoE boot firmware table signature */
-#define ABFT_SIG "aBFT"
-
-/**
- * AoE Boot Firmware Table (aBFT)
- */
-struct abft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** AoE shelf */
- uint16_t shelf;
- /** AoE slot */
- uint8_t slot;
- /** Reserved */
- uint8_t reserved_a;
- /** MAC address */
- uint8_t mac[ETH_ALEN];
-} __attribute__ (( packed ));
-
-extern void abft_fill_data ( struct aoe_session *aoe );
-
-#endif /* _GPXE_ABFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_nap.h b/gpxe/src/arch/i386/include/gpxe/bios_nap.h
deleted file mode 100644
index c32429b9..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_nap.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_BIOS_NAP_H
-#define _GPXE_BIOS_NAP_H
-
-/** @file
- *
- * BIOS CPU sleeping
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef NAP_PCBIOS
-#define NAP_PREFIX_pcbios
-#else
-#define NAP_PREFIX_pcbios __pcbios_
-#endif
-
-#endif /* _GPXE_BIOS_NAP_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_smbios.h b/gpxe/src/arch/i386/include/gpxe/bios_smbios.h
deleted file mode 100644
index 83726b11..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_smbios.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_BIOS_SMBIOS_H
-#define _GPXE_BIOS_SMBIOS_H
-
-/** @file
- *
- * Standard PC-BIOS SMBIOS interface
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef SMBIOS_PCBIOS
-#define SMBIOS_PREFIX_pcbios
-#else
-#define SMBIOS_PREFIX_pcbios __pcbios_
-#endif
-
-#endif /* _GPXE_BIOS_SMBIOS_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/bios_timer.h b/gpxe/src/arch/i386/include/gpxe/bios_timer.h
deleted file mode 100644
index ed9df522..00000000
--- a/gpxe/src/arch/i386/include/gpxe/bios_timer.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _GPXE_BIOS_TIMER_H
-#define _GPXE_BIOS_TIMER_H
-
-/** @file
- *
- * BIOS timer
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef TIMER_PCBIOS
-#define TIMER_PREFIX_pcbios
-#else
-#define TIMER_PREFIX_pcbios __pcbios_
-#endif
-
-#include <gpxe/timer2.h>
-
-/**
- * Delay for a fixed number of microseconds
- *
- * @v usecs Number of microseconds for which to delay
- */
-static inline __always_inline void
-TIMER_INLINE ( pcbios, udelay ) ( unsigned long usecs ) {
- /* BIOS timer is not high-resolution enough for udelay(), so
- * we use timer2
- */
- timer2_udelay ( usecs );
-}
-
-/**
- * Get number of ticks per second
- *
- * @ret ticks_per_sec Number of ticks per second
- */
-static inline __always_inline unsigned long
-TIMER_INLINE ( pcbios, ticks_per_sec ) ( void ) {
- /* BIOS timer ticks over at 18.2 ticks per second */
- return 18;
-}
-
-#endif /* _GPXE_BIOS_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/ibft.h b/gpxe/src/arch/i386/include/gpxe/ibft.h
deleted file mode 100644
index c41e2e40..00000000
--- a/gpxe/src/arch/i386/include/gpxe/ibft.h
+++ /dev/null
@@ -1,302 +0,0 @@
-#ifndef _GPXE_IBFT_H
-#define _GPXE_IBFT_H
-
-/*
- * Copyright Fen Systems Ltd. 2007. Portions of this code are derived
- * from IBM Corporation Sample Programs. Copyright IBM Corporation
- * 2004, 2007. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-FILE_LICENCE ( BSD2 );
-
-/** @file
- *
- * iSCSI boot firmware table
- *
- * The information in this file is derived from the document "iSCSI
- * Boot Firmware Table (iBFT)" as published by IBM at
- *
- * ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
- *
- */
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/in.h>
-
-/** iSCSI Boot Firmware Table signature */
-#define IBFT_SIG "iBFT"
-
-/** An offset from the start of the iBFT */
-typedef uint16_t ibft_off_t;
-
-/** Length of a string within the iBFT (excluding terminating NUL) */
-typedef uint16_t ibft_size_t;
-
-/** A string within the iBFT */
-struct ibft_string {
- /** Length of string */
- ibft_size_t length;
- /** Offset to string */
- ibft_off_t offset;
-} __attribute__ (( packed ));
-
-/** An IP address within the iBFT */
-struct ibft_ipaddr {
- /** Reserved; must be zero */
- uint16_t zeroes[5];
- /** Must be 0xffff if IPv4 address is present, otherwise zero */
- uint16_t ones;
- /** The IPv4 address, or zero if not present */
- struct in_addr in;
-} __attribute__ (( packed ));
-
-/**
- * iBFT structure header
- *
- * This structure is common to several sections within the iBFT.
- */
-struct ibft_header {
- /** Structure ID
- *
- * This is an IBFT_STRUCTURE_ID_XXX constant
- */
- uint8_t structure_id;
- /** Version (always 1) */
- uint8_t version;
- /** Length, including this header */
- uint16_t length;
- /** Index
- *
- * This is the number of the NIC or Target, when applicable.
- */
- uint8_t index;
- /** Flags */
- uint8_t flags;
-} __attribute__ (( packed ));
-
-/**
- * iBFT Control structure
- *
- */
-struct ibft_control {
- /** Common header */
- struct ibft_header header;
- /** Extensions */
- uint16_t extensions;
- /** Offset to Initiator structure */
- ibft_off_t initiator;
- /** Offset to NIC structure for NIC 0 */
- ibft_off_t nic_0;
- /** Offset to Target structure for target 0 */
- ibft_off_t target_0;
- /** Offset to NIC structure for NIC 1 */
- ibft_off_t nic_1;
- /** Offset to Target structure for target 1 */
- ibft_off_t target_1;
-} __attribute__ (( packed ));
-
-/** Structure ID for Control section */
-#define IBFT_STRUCTURE_ID_CONTROL 0x01
-
-/** Attempt login only to specified target
- *
- * If this flag is not set, all targets will be logged in to.
- */
-#define IBFT_FL_CONTROL_SINGLE_LOGIN_ONLY 0x01
-
-/**
- * iBFT Initiator structure
- *
- */
-struct ibft_initiator {
- /** Common header */
- struct ibft_header header;
- /** iSNS server */
- struct ibft_ipaddr isns_server;
- /** SLP server */
- struct ibft_ipaddr slp_server;
- /** Primary and secondary Radius servers */
- struct ibft_ipaddr radius[2];
- /** Initiator name */
- struct ibft_string initiator_name;
-} __attribute__ (( packed ));
-
-/** Structure ID for Initiator section */
-#define IBFT_STRUCTURE_ID_INITIATOR 0x02
-
-/** Initiator block valid */
-#define IBFT_FL_INITIATOR_BLOCK_VALID 0x01
-
-/** Initiator firmware boot selected */
-#define IBFT_FL_INITIATOR_FIRMWARE_BOOT_SELECTED 0x02
-
-/**
- * iBFT NIC structure
- *
- */
-struct ibft_nic {
- /** Common header */
- struct ibft_header header;
- /** IP address */
- struct ibft_ipaddr ip_address;
- /** Subnet mask
- *
- * This is the length of the subnet mask in bits (e.g. /24).
- */
- uint8_t subnet_mask_prefix;
- /** Origin */
- uint8_t origin;
- /** Default gateway */
- struct ibft_ipaddr gateway;
- /** Primary and secondary DNS servers */
- struct ibft_ipaddr dns[2];
- /** DHCP server */
- struct ibft_ipaddr dhcp;
- /** VLAN tag */
- uint16_t vlan;
- /** MAC address */
- uint8_t mac_address[6];
- /** PCI bus:dev:fn */
- uint16_t pci_bus_dev_func;
- /** Hostname */
- struct ibft_string hostname;
-} __attribute__ (( packed ));
-
-/** Structure ID for NIC section */
-#define IBFT_STRUCTURE_ID_NIC 0x03
-
-/** NIC block valid */
-#define IBFT_FL_NIC_BLOCK_VALID 0x01
-
-/** NIC firmware boot selected */
-#define IBFT_FL_NIC_FIRMWARE_BOOT_SELECTED 0x02
-
-/** NIC global / link local */
-#define IBFT_FL_NIC_GLOBAL 0x04
-
-/**
- * iBFT Target structure
- *
- */
-struct ibft_target {
- /** Common header */
- struct ibft_header header;
- /** IP address */
- struct ibft_ipaddr ip_address;
- /** TCP port */
- uint16_t socket;
- /** Boot LUN */
- uint64_t boot_lun;
- /** CHAP type
- *
- * This is an IBFT_CHAP_XXX constant.
- */
- uint8_t chap_type;
- /** NIC association */
- uint8_t nic_association;
- /** Target name */
- struct ibft_string target_name;
- /** CHAP name */
- struct ibft_string chap_name;
- /** CHAP secret */
- struct ibft_string chap_secret;
- /** Reverse CHAP name */
- struct ibft_string reverse_chap_name;
- /** Reverse CHAP secret */
- struct ibft_string reverse_chap_secret;
-} __attribute__ (( packed ));
-
-/** Structure ID for Target section */
-#define IBFT_STRUCTURE_ID_TARGET 0x04
-
-/** Target block valid */
-#define IBFT_FL_TARGET_BLOCK_VALID 0x01
-
-/** Target firmware boot selected */
-#define IBFT_FL_TARGET_FIRMWARE_BOOT_SELECTED 0x02
-
-/** Target use Radius CHAP */
-#define IBFT_FL_TARGET_USE_CHAP 0x04
-
-/** Target use Radius rCHAP */
-#define IBFT_FL_TARGET_USE_RCHAP 0x08
-
-/* Values for chap_type */
-#define IBFT_CHAP_NONE 0 /**< No CHAP authentication */
-#define IBFT_CHAP_ONE_WAY 1 /**< One-way CHAP */
-#define IBFT_CHAP_MUTUAL 2 /**< Mutual CHAP */
-
-/**
- * iSCSI Boot Firmware Table (iBFT)
- */
-struct ibft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** Reserved */
- uint8_t reserved[12];
- /** Control structure */
- struct ibft_control control;
-} __attribute__ (( packed ));
-
-/**
- * iSCSI string block descriptor
- *
- * This is an internal structure that we use to keep track of the
- * allocation of string data.
- */
-struct ibft_string_block {
- /** The iBFT containing these strings */
- struct ibft_table *table;
- /** Offset of first free byte within iBFT */
- unsigned int offset;
-};
-
-/** Amount of space reserved for strings in a gPXE iBFT */
-#define IBFT_STRINGS_SIZE 384
-
-/**
- * An iBFT created by gPXE
- *
- */
-struct gpxe_ibft {
- /** The fixed section */
- struct ibft_table table;
- /** The Initiator section */
- struct ibft_initiator initiator __attribute__ (( aligned ( 16 ) ));
- /** The NIC section */
- struct ibft_nic nic __attribute__ (( aligned ( 16 ) ));
- /** The Target section */
- struct ibft_target target __attribute__ (( aligned ( 16 ) ));
- /** Strings block */
- char strings[IBFT_STRINGS_SIZE];
-} __attribute__ (( packed, aligned ( 16 ) ));
-
-struct net_device;
-struct iscsi_session;
-
-extern int ibft_fill_data ( struct net_device *netdev,
- struct iscsi_session *iscsi );
-
-#endif /* _GPXE_IBFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h b/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h
deleted file mode 100644
index eaf7025b..00000000
--- a/gpxe/src/arch/i386/include/gpxe/memtop_umalloc.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _GPXE_MEMTOP_UMALLOC_H
-#define _GPXE_MEMTOP_UMALLOC_H
-
-/** @file
- *
- * External memory allocation
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef UMALLOC_MEMTOP
-#define UMALLOC_PREFIX_memtop
-#else
-#define UMALLOC_PREFIX_memtop __memtop_
-#endif
-
-#endif /* _GPXE_MEMTOP_UMALLOC_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h b/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h
deleted file mode 100644
index 67ba22f0..00000000
--- a/gpxe/src/arch/i386/include/gpxe/rdtsc_timer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _GPXE_RDTSC_TIMER_H
-#define _GPXE_RDTSC_TIMER_H
-
-/** @file
- *
- * RDTSC timer
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef TIMER_RDTSC
-#define TIMER_PREFIX_rdtsc
-#else
-#define TIMER_PREFIX_rdtsc __rdtsc_
-#endif
-
-/**
- * RDTSC values can easily overflow an unsigned long. We discard the
- * low-order bits in order to obtain sensibly-scaled values.
- */
-#define TSC_SHIFT 8
-
-/**
- * Get current system time in ticks
- *
- * @ret ticks Current time, in ticks
- */
-static inline __always_inline unsigned long
-TIMER_INLINE ( rdtsc, currticks ) ( void ) {
- unsigned long ticks;
-
- __asm__ __volatile__ ( "rdtsc\n\t"
- "shrdl %1, %%edx, %%eax\n\t"
- : "=a" ( ticks ) : "i" ( TSC_SHIFT ) : "edx" );
- return ticks;
-}
-
-#endif /* _GPXE_RDTSC_TIMER_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/sbft.h b/gpxe/src/arch/i386/include/gpxe/sbft.h
deleted file mode 100644
index 30038436..00000000
--- a/gpxe/src/arch/i386/include/gpxe/sbft.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef _GPXE_SBFT_H
-#define _GPXE_SBFT_H
-
-/*
- * Copyright (C) 2009 Fen Systems Ltd <mbrown@fensystems.co.uk>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER 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.
- */
-
-FILE_LICENCE ( BSD2 );
-
-/** @file
- *
- * SRP boot firmware table
- *
- * The working draft specification for the SRP boot firmware table can
- * be found at
- *
- * http://etherboot.org/wiki/srp/sbft
- *
- */
-
-#include <stdint.h>
-#include <gpxe/acpi.h>
-#include <gpxe/scsi.h>
-#include <gpxe/srp.h>
-#include <gpxe/ib_srp.h>
-
-/** SRP Boot Firmware Table signature */
-#define SBFT_SIG "sBFT"
-
-/** An offset from the start of the sBFT */
-typedef uint16_t sbft_off_t;
-
-/**
- * SRP Boot Firmware Table
- */
-struct sbft_table {
- /** ACPI header */
- struct acpi_description_header acpi;
- /** Offset to SCSI subtable */
- sbft_off_t scsi_offset;
- /** Offset to SRP subtable */
- sbft_off_t srp_offset;
- /** Offset to IB subtable, if present */
- sbft_off_t ib_offset;
- /** Reserved */
- uint8_t reserved[6];
-} __attribute__ (( packed ));
-
-/**
- * sBFT SCSI subtable
- */
-struct sbft_scsi_subtable {
- /** LUN */
- struct scsi_lun lun;
-} __attribute__ (( packed ));
-
-/**
- * sBFT SRP subtable
- */
-struct sbft_srp_subtable {
- /** Initiator and target ports */
- struct srp_port_ids port_ids;
-} __attribute__ (( packed ));
-
-/**
- * sBFT IB subtable
- */
-struct sbft_ib_subtable {
- /** Source GID */
- struct ib_gid sgid;
- /** Destination GID */
- struct ib_gid dgid;
- /** Service ID */
- struct ib_gid_half service_id;
- /** Partition key */
- uint16_t pkey;
- /** Reserved */
- uint8_t reserved[6];
-} __attribute__ (( packed ));
-
-/**
- * An sBFT created by gPXE
- */
-struct gpxe_sbft {
- /** The table header */
- struct sbft_table table;
- /** The SCSI subtable */
- struct sbft_scsi_subtable scsi;
- /** The SRP subtable */
- struct sbft_srp_subtable srp;
- /** The IB subtable */
- struct sbft_ib_subtable ib;
-} __attribute__ (( packed, aligned ( 16 ) ));
-
-struct srp_device;
-
-extern int sbft_fill_data ( struct srp_device *srp );
-
-#endif /* _GPXE_SBFT_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/timer2.h b/gpxe/src/arch/i386/include/gpxe/timer2.h
deleted file mode 100644
index 8f119515..00000000
--- a/gpxe/src/arch/i386/include/gpxe/timer2.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _GPXE_TIMER2_H
-#define _GPXE_TIMER2_H
-
-/** @file
- *
- * Timer chip control
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-extern void timer2_udelay ( unsigned long usecs );
-
-#endif /* _GPXE_TIMER2_H */
diff --git a/gpxe/src/arch/i386/include/gpxe/x86_io.h b/gpxe/src/arch/i386/include/gpxe/x86_io.h
deleted file mode 100644
index beb5b22a..00000000
--- a/gpxe/src/arch/i386/include/gpxe/x86_io.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef _GPXE_X86_IO_H
-#define _GPXE_X86_IO_H
-
-/** @file
- *
- * gPXE I/O API for x86
- *
- * i386 uses direct pointer dereferences for accesses to memory-mapped
- * I/O space, and the inX/outX instructions for accesses to
- * port-mapped I/O space.
- *
- * 64-bit atomic accesses (readq() and writeq()) use MMX instructions,
- * and will crash original Pentium and earlier CPUs. Fortunately, no
- * hardware that requires atomic 64-bit accesses will physically fit
- * into a machine with such an old CPU anyway.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#ifdef IOAPI_X86
-#define IOAPI_PREFIX_x86
-#else
-#define IOAPI_PREFIX_x86 __x86_
-#endif
-
-/*
- * Memory space mappings
- *
- */
-
-/*
- * Physical<->Bus and Bus<->I/O address mappings
- *
- */
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, phys_to_bus ) ( unsigned long phys_addr ) {
- return phys_addr;
-}
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, bus_to_phys ) ( unsigned long bus_addr ) {
- return bus_addr;
-}
-
-static inline __always_inline void *
-IOAPI_INLINE ( x86, ioremap ) ( unsigned long bus_addr, size_t len __unused ) {
- return phys_to_virt ( bus_addr );
-}
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, iounmap ) ( volatile const void *io_addr __unused ) {
- /* Nothing to do */
-}
-
-static inline __always_inline unsigned long
-IOAPI_INLINE ( x86, io_to_bus ) ( volatile const void *io_addr ) {
- return virt_to_phys ( io_addr );
-}
-
-/*
- * MMIO reads and writes up to 32 bits
- *
- */
-
-#define X86_READX( _api_func, _type ) \
-static inline __always_inline _type \
-IOAPI_INLINE ( x86, _api_func ) ( volatile _type *io_addr ) { \
- return *io_addr; \
-}
-X86_READX ( readb, uint8_t );
-X86_READX ( readw, uint16_t );
-X86_READX ( readl, uint32_t );
-
-#define X86_WRITEX( _api_func, _type ) \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, _api_func ) ( _type data, \
- volatile _type *io_addr ) { \
- *io_addr = data; \
-}
-X86_WRITEX ( writeb, uint8_t );
-X86_WRITEX ( writew, uint16_t );
-X86_WRITEX ( writel, uint32_t );
-
-/*
- * PIO reads and writes up to 32 bits
- *
- */
-
-#define X86_INX( _insn_suffix, _type, _reg_prefix ) \
-static inline __always_inline _type \
-IOAPI_INLINE ( x86, in ## _insn_suffix ) ( volatile _type *io_addr ) { \
- _type data; \
- __asm__ __volatile__ ( "in" #_insn_suffix " %w1, %" _reg_prefix "0" \
- : "=a" ( data ) : "Nd" ( io_addr ) ); \
- return data; \
-} \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, ins ## _insn_suffix ) ( volatile _type *io_addr, \
- _type *data, \
- unsigned int count ) { \
- unsigned int discard_D; \
- __asm__ __volatile__ ( "rep ins" #_insn_suffix \
- : "=D" ( discard_D ) \
- : "d" ( io_addr ), "c" ( count ), \
- "0" ( data ) ); \
-}
-X86_INX ( b, uint8_t, "b" );
-X86_INX ( w, uint16_t, "w" );
-X86_INX ( l, uint32_t, "k" );
-
-#define X86_OUTX( _insn_suffix, _type, _reg_prefix ) \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, out ## _insn_suffix ) ( _type data, \
- volatile _type *io_addr ) { \
- __asm__ __volatile__ ( "out" #_insn_suffix " %" _reg_prefix "0, %w1" \
- : : "a" ( data ), "Nd" ( io_addr ) ); \
-} \
-static inline __always_inline void \
-IOAPI_INLINE ( x86, outs ## _insn_suffix ) ( volatile _type *io_addr, \
- const _type *data, \
- unsigned int count ) { \
- unsigned int discard_S; \
- __asm__ __volatile__ ( "rep outs" #_insn_suffix \
- : "=S" ( discard_S ) \
- : "d" ( io_addr ), "c" ( count ), \
- "0" ( data ) ); \
-}
-X86_OUTX ( b, uint8_t, "b" );
-X86_OUTX ( w, uint16_t, "w" );
-X86_OUTX ( l, uint32_t, "k" );
-
-/*
- * Slow down I/O
- *
- */
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, iodelay ) ( void ) {
- __asm__ __volatile__ ( "outb %al, $0x80" );
-}
-
-/*
- * Memory barrier
- *
- */
-
-static inline __always_inline void
-IOAPI_INLINE ( x86, mb ) ( void ) {
- __asm__ __volatile__ ( "lock; addl $0, 0(%%esp)" : : : "memory" );
-}
-
-#endif /* _GPXE_X86_IO_H */
diff --git a/gpxe/src/arch/i386/include/int13.h b/gpxe/src/arch/i386/include/int13.h
deleted file mode 100644
index e1884d94..00000000
--- a/gpxe/src/arch/i386/include/int13.h
+++ /dev/null
@@ -1,292 +0,0 @@
-#ifndef INT13_H
-#define INT13_H
-
-/** @file
- *
- * INT 13 emulation
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdint.h>
-#include <gpxe/list.h>
-#include <realmode.h>
-
-struct block_device;
-
-/**
- * @defgroup int13ops INT 13 operation codes
- * @{
- */
-
-/** Reset disk system */
-#define INT13_RESET 0x00
-/** Get status of last operation */
-#define INT13_GET_LAST_STATUS 0x01
-/** Read sectors */
-#define INT13_READ_SECTORS 0x02
-/** Write sectors */
-#define INT13_WRITE_SECTORS 0x03
-/** Get drive parameters */
-#define INT13_GET_PARAMETERS 0x08
-/** Get disk type */
-#define INT13_GET_DISK_TYPE 0x15
-/** Extensions installation check */
-#define INT13_EXTENSION_CHECK 0x41
-/** Extended read */
-#define INT13_EXTENDED_READ 0x42
-/** Extended write */
-#define INT13_EXTENDED_WRITE 0x43
-/** Get extended drive parameters */
-#define INT13_GET_EXTENDED_PARAMETERS 0x48
-/** Get CD-ROM status / terminate emulation */
-#define INT13_CDROM_STATUS_TERMINATE 0x4b
-
-/** @} */
-
-/**
- * @defgroup int13status INT 13 status codes
- * @{
- */
-
-/** Operation completed successfully */
-#define INT13_STATUS_SUCCESS 0x00
-/** Invalid function or parameter */
-#define INT13_STATUS_INVALID 0x01
-/** Read error */
-#define INT13_STATUS_READ_ERROR 0x04
-/** Write error */
-#define INT13_STATUS_WRITE_ERROR 0xcc
-
-/** @} */
-
-/** Block size for non-extended INT 13 calls */
-#define INT13_BLKSIZE 512
-
-/** An INT 13 emulated drive */
-struct int13_drive {
- /** List of all registered drives */
- struct list_head list;
-
- /** Underlying block device */
- struct block_device *blockdev;
-
- /** BIOS in-use drive number (0x80-0xff) */
- unsigned int drive;
- /** BIOS natural drive number (0x80-0xff)
- *
- * This is the drive number that would have been assigned by
- * 'naturally' appending the drive to the end of the BIOS
- * drive list.
- *
- * If the emulated drive replaces a preexisting drive, this is
- * the drive number that the preexisting drive gets remapped
- * to.
- */
- unsigned int natural_drive;
-
- /** Number of cylinders
- *
- * The cylinder number field in an INT 13 call is ten bits
- * wide, giving a maximum of 1024 cylinders. Conventionally,
- * when the 7.8GB limit of a CHS address is exceeded, it is
- * the number of cylinders that is increased beyond the
- * addressable limit.
- */
- unsigned int cylinders;
- /** Number of heads
- *
- * The head number field in an INT 13 call is eight bits wide,
- * giving a maximum of 256 heads. However, apparently all
- * versions of MS-DOS up to and including Win95 fail with 256
- * heads, so the maximum encountered in practice is 255.
- */
- unsigned int heads;
- /** Number of sectors per track
- *
- * The sector number field in an INT 13 call is six bits wide,
- * giving a maximum of 63 sectors, since sector numbering
- * (unlike head and cylinder numbering) starts at 1, not 0.
- */
- unsigned int sectors_per_track;
-
- /** Status of last operation */
- int last_status;
-};
-
-/** An INT 13 disk address packet */
-struct int13_disk_address {
- /** Size of the packet, in bytes */
- uint8_t bufsize;
- /** Reserved, must be zero */
- uint8_t reserved;
- /** Block count */
- uint16_t count;
- /** Data buffer */
- struct segoff buffer;
- /** Starting block number */
- uint64_t lba;
- /** Data buffer (EDD-3.0 only) */
- uint64_t buffer_phys;
-} __attribute__ (( packed ));
-
-/** INT 13 disk parameters */
-struct int13_disk_parameters {
- /** Size of this structure */
- uint16_t bufsize;
- /** Flags */
- uint16_t flags;
- /** Number of cylinders */
- uint32_t cylinders;
- /** Number of heads */
- uint32_t heads;
- /** Number of sectors per track */
- uint32_t sectors_per_track;
- /** Total number of sectors on drive */
- uint64_t sectors;
- /** Bytes per sector */
- uint16_t sector_size;
-
-} __attribute__ (( packed ));
-
-/**
- * @defgroup int13types INT 13 disk types
- * @{
- */
-
-/** No such drive */
-#define INT13_DISK_TYPE_NONE 0x00
-/** Floppy without change-line support */
-#define INT13_DISK_TYPE_FDD 0x01
-/** Floppy with change-line support */
-#define INT13_DISK_TYPE_FDD_CL 0x02
-/** Hard disk */
-#define INT13_DISK_TYPE_HDD 0x03
-
-/** @} */
-
-/**
- * @defgroup int13flags INT 13 disk parameter flags
- * @{
- */
-
-/** DMA boundary errors handled transparently */
-#define INT13_FL_DMA_TRANSPARENT 0x01
-/** CHS information is valid */
-#define INT13_FL_CHS_VALID 0x02
-/** Removable drive */
-#define INT13_FL_REMOVABLE 0x04
-/** Write with verify supported */
-#define INT13_FL_VERIFIABLE 0x08
-/** Has change-line supported (valid only for removable drives) */
-#define INT13_FL_CHANGE_LINE 0x10
-/** Drive can be locked (valid only for removable drives) */
-#define INT13_FL_LOCKABLE 0x20
-/** CHS is max possible, not current media (valid only for removable drives) */
-#define INT13_FL_CHS_MAX 0x40
-
-/** @} */
-
-/**
- * @defgroup int13exts INT 13 extension flags
- * @{
- */
-
-/** Extended disk access functions supported */
-#define INT13_EXTENSION_LINEAR 0x01
-/** Removable drive functions supported */
-#define INT13_EXTENSION_REMOVABLE 0x02
-/** ED