summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/arch/x86
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/ipxe/src/arch/x86
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/ipxe/src/arch/x86')
-rw-r--r--qemu/roms/ipxe/src/arch/x86/Makefile22
-rw-r--r--qemu/roms/ipxe/src/arch/x86/Makefile.efi42
-rw-r--r--qemu/roms/ipxe/src/arch/x86/Makefile.linux13
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/cpuid.c141
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/cpuid_settings.c278
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/debugcon.c90
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/linux/linux_api.c110
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/linux/linux_strerror.c169
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/pcidirect.c52
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/pic8259.c67
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/pit8254.c70
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/vram_settings.c72
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/x86_bigint.c95
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/x86_io.c106
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/x86_string.c110
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/x86_tcpip.c173
-rw-r--r--qemu/roms/ipxe/src/arch/x86/core/x86_uart.c69
-rw-r--r--qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.c597
-rw-r--r--qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.h57
-rw-r--r--qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.c503
-rw-r--r--qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.h75
-rw-r--r--qemu/roms/ipxe/src/arch/x86/hci/commands/cpuid_cmd.c101
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/bigint.h318
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/endian.h8
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/errfile.h59
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/io.h14
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/linux_api_platform.h6
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/pci_io.h15
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/string.h344
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/tcpip.h17
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/uart.h41
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/bits/xen.h183
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/cpuid.h81
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/efi/efix86_nap.h18
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/pcibios.h135
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/pcidirect.h141
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/pit8254.h81
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/ipxe/x86_io.h162
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/linux/ipxe/dhcp_arch.h41
-rw-r--r--qemu/roms/ipxe/src/arch/x86/include/pic8259.h70
-rw-r--r--qemu/roms/ipxe/src/arch/x86/interface/efi/efi_entropy.c223
-rw-r--r--qemu/roms/ipxe/src/arch/x86/interface/efi/efix86_nap.c53
-rw-r--r--qemu/roms/ipxe/src/arch/x86/prefix/efidrvprefix.c81
-rw-r--r--qemu/roms/ipxe/src/arch/x86/prefix/efiprefix.c101
-rw-r--r--qemu/roms/ipxe/src/arch/x86/scripts/efi.lds110
45 files changed, 0 insertions, 5314 deletions
diff --git a/qemu/roms/ipxe/src/arch/x86/Makefile b/qemu/roms/ipxe/src/arch/x86/Makefile
deleted file mode 100644
index 98c49b98d..000000000
--- a/qemu/roms/ipxe/src/arch/x86/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# Include common x86 headers
-#
-INCDIRS += arch/x86/include
-
-# x86-specific directories containing source files
-#
-SRCDIRS += arch/x86/core
-SRCDIRS += arch/x86/interface/efi
-SRCDIRS += arch/x86/prefix
-SRCDIRS += arch/x86/hci/commands
-SRCDIRS += arch/x86/drivers/xen
-SRCDIRS += arch/x86/drivers/hyperv
-
-# breaks building some of the linux-related objects
-CFLAGS += -Ulinux
-
-# disable valgrind
-CFLAGS += -DNVALGRIND
-
-# Include Hyper-V driver in the all-drivers build
-#
-DRIVERS_hyperv += hyperv
diff --git a/qemu/roms/ipxe/src/arch/x86/Makefile.efi b/qemu/roms/ipxe/src/arch/x86/Makefile.efi
deleted file mode 100644
index f73bc7d5d..000000000
--- a/qemu/roms/ipxe/src/arch/x86/Makefile.efi
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- makefile -*- : Force emacs to use Makefile mode
-
-# The EFI linker script
-#
-LDSCRIPT = arch/x86/scripts/efi.lds
-
-# Retain relocation information for elf2efi
-#
-LDFLAGS += -q -S
-
-# Media types.
-#
-NON_AUTO_MEDIA += efi
-NON_AUTO_MEDIA += efidrv
-NON_AUTO_MEDIA += drv.efi
-NON_AUTO_MEDIA += efirom
-
-# Include SNP driver in the all-drivers build
-#
-DRIVERS_net += snp
-
-# Rules for building EFI files
-#
-$(BIN)/%.efi : $(BIN)/%.efi.tmp $(ELF2EFI)
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)$(ELF2EFI) --subsystem=10 $< $@
-
-$(BIN)/%.efidrv : $(BIN)/%.efidrv.tmp $(ELF2EFI)
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)$(ELF2EFI) --subsystem=11 $< $@
-
-$(BIN)/%.drv.efi : $(BIN)/%.efidrv
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)$(CP) $< $@
-
-$(BIN)/%.efirom : $(BIN)/%.efidrv $(EFIROM)
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)$(EFIROM) -v $(TGT_PCI_VENDOR) -d $(TGT_PCI_DEVICE) $< $@
-
-$(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
- $(QM)$(ECHO) " [CAB] $@"
- $(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
diff --git a/qemu/roms/ipxe/src/arch/x86/Makefile.linux b/qemu/roms/ipxe/src/arch/x86/Makefile.linux
deleted file mode 100644
index 1faf84753..000000000
--- a/qemu/roms/ipxe/src/arch/x86/Makefile.linux
+++ /dev/null
@@ -1,13 +0,0 @@
-MEDIA = linux
-
-# enable valgrind
-CFLAGS += -UNVALGRIND
-
-INCDIRS += arch/x86/include/linux
-SRCDIRS += interface/linux
-SRCDIRS += drivers/linux
-SRCDIRS += arch/x86/core/linux
-
-$(BIN)/%.linux : $(BIN)/%.linux.tmp
- $(QM)$(ECHO) " [FINISH] $@"
- $(Q)$(CP) $< $@
diff --git a/qemu/roms/ipxe/src/arch/x86/core/cpuid.c b/qemu/roms/ipxe/src/arch/x86/core/cpuid.c
deleted file mode 100644
index bc5a6c68c..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/cpuid.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <string.h>
-#include <ipxe/cpuid.h>
-
-/** @file
- *
- * x86 CPU feature detection
- *
- */
-
-/**
- * Check whether or not CPUID instruction is supported
- *
- * @ret is_supported CPUID instruction is supported
- */
-int cpuid_is_supported ( void ) {
- unsigned long original;
- unsigned long inverted;
-
- __asm__ ( "pushf\n\t"
- "pushf\n\t"
- "pop %0\n\t"
- "mov %0,%1\n\t"
- "xor %2,%1\n\t"
- "push %1\n\t"
- "popf\n\t"
- "pushf\n\t"
- "pop %1\n\t"
- "popf\n\t"
- : "=&r" ( original ), "=&r" ( inverted )
- : "ir" ( CPUID_FLAG ) );
- return ( ( original ^ inverted ) & CPUID_FLAG );
-}
-
-/**
- * Get Intel-defined x86 CPU features
- *
- * @v features x86 CPU features to fill in
- */
-static void x86_intel_features ( struct x86_features *features ) {
- uint32_t max_level;
- uint32_t discard_a;
- uint32_t discard_b;
- uint32_t discard_c;
- uint32_t discard_d;
-
- /* Check that features are available via CPUID */
- cpuid ( CPUID_VENDOR_ID, &max_level, &discard_b, &discard_c,
- &discard_d );
- if ( max_level < CPUID_FEATURES ) {
- DBGC ( features, "CPUID has no Intel-defined features (max "
- "level %08x)\n", max_level );
- return;
- }
-
- /* Get features */
- cpuid ( CPUID_FEATURES, &discard_a, &discard_b,
- &features->intel.ecx, &features->intel.edx );
- DBGC ( features, "CPUID Intel features: %%ecx=%08x, %%edx=%08x\n",
- features->intel.ecx, features->intel.edx );
-
-}
-
-/**
- * Get AMD-defined x86 CPU features
- *
- * @v features x86 CPU features to fill in
- */
-static void x86_amd_features ( struct x86_features *features ) {
- uint32_t max_level;
- uint32_t discard_a;
- uint32_t discard_b;
- uint32_t discard_c;
- uint32_t discard_d;
-
- /* Check that features are available via CPUID */
- cpuid ( CPUID_AMD_MAX_FN, &max_level, &discard_b, &discard_c,
- &discard_d );
- if ( ( max_level & CPUID_AMD_CHECK_MASK ) != CPUID_AMD_CHECK ) {
- DBGC ( features, "CPUID has no extended functions\n" );
- return;
- }
- if ( max_level < CPUID_AMD_FEATURES ) {
- DBGC ( features, "CPUID has no AMD-defined features (max "
- "level %08x)\n", max_level );
- return;
- }
-
- /* Get features */
- cpuid ( CPUID_AMD_FEATURES, &discard_a, &discard_b,
- &features->amd.ecx, &features->amd.edx );
- DBGC ( features, "CPUID AMD features: %%ecx=%08x, %%edx=%08x\n",
- features->amd.ecx, features->amd.edx );
-}
-
-/**
- * Get x86 CPU features
- *
- * @v features x86 CPU features to fill in
- */
-void x86_features ( struct x86_features *features ) {
-
- /* Clear all features */
- memset ( features, 0, sizeof ( *features ) );
-
- /* Check that CPUID instruction is available */
- if ( ! cpuid_is_supported() ) {
- DBGC ( features, "CPUID instruction is not supported\n" );
- return;
- }
-
- /* Get Intel-defined features */
- x86_intel_features ( features );
-
- /* Get AMD-defined features */
- x86_amd_features ( features );
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/cpuid_settings.c b/qemu/roms/ipxe/src/arch/x86/core/cpuid_settings.c
deleted file mode 100644
index 08bd3918a..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/cpuid_settings.c
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (C) 2013 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <string.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <ipxe/init.h>
-#include <ipxe/settings.h>
-#include <ipxe/cpuid.h>
-
-/** @file
- *
- * x86 CPUID settings
- *
- * CPUID settings are numerically encoded as:
- *
- * Bit 31 Extended function
- * Bits 30-28 Unused
- * Bits 27-24 Number of consecutive functions to call, minus one
- * Bit 23 Return result as little-endian (used for strings)
- * Bits 22-18 Unused
- * Bits 17-16 Number of registers in register array, minus one
- * Bits 15-8 Array of register indices. First entry in array is in
- * bits 9-8. Indices are 0-%eax, 1-%ebx, 2-%ecx, 3-%edx.
- * Bits 7-0 Starting function number (excluding "extended" bit)
- *
- * This encoding scheme is designed to allow the common case of
- * extracting a single register from a single function to be encoded
- * using "cpuid/<register>.<function>", e.g. "cpuid/2.0x80000001" to
- * retrieve the value of %ecx from calling CPUID with %eax=0x80000001.
- */
-
-/** CPUID setting tag register indices */
-enum cpuid_registers {
- CPUID_EAX = 0,
- CPUID_EBX = 1,
- CPUID_ECX = 2,
- CPUID_EDX = 3,
-};
-
-/**
- * Construct CPUID setting tag
- *
- * @v function Starting function number
- * @v num_functions Number of consecutive functions
- * @v little_endian Return result as little-endian
- * @v num_registers Number of registers in register array
- * @v register1 First register in register array (or zero, if empty)
- * @v register2 Second register in register array (or zero, if empty)
- * @v register3 Third register in register array (or zero, if empty)
- * @v register4 Fourth register in register array (or zero, if empty)
- * @ret tag Setting tag
- */
-#define CPUID_TAG( function, num_functions, little_endian, num_registers, \
- register1, register2, register3, register4 ) \
- ( (function) | ( ( (num_functions) - 1 ) << 24 ) | \
- ( (little_endian) << 23 ) | ( ( (num_registers) - 1) << 16 ) | \
- ( (register1) << 8 ) | ( (register2) << 10 ) | \
- ( (register3) << 12 ) | ( (register4) << 14 ) )
-
-/**
- * Extract endianness from CPUID setting tag
- *
- * @v tag Setting tag
- * @ret little_endian Result should be returned as little-endian
- */
-#define CPUID_LITTLE_ENDIAN( tag ) ( (tag) & 0x00800000UL )
-
-/**
- * Extract starting function number from CPUID setting tag
- *
- * @v tag Setting tag
- * @ret function Starting function number
- */
-#define CPUID_FUNCTION( tag ) ( (tag) & 0x800000ffUL )
-
-/**
- * Extract number of consecutive functions from CPUID setting tag
- *
- * @v tag Setting tag
- * @ret num_functions Number of consecutive functions
- */
-#define CPUID_NUM_FUNCTIONS( tag ) ( ( ( (tag) >> 24 ) & 0xf ) + 1 )
-
-/**
- * Extract register array from CPUID setting tag
- *
- * @v tag Setting tag
- * @ret registers Register array
- */
-#define CPUID_REGISTERS( tag ) ( ( (tag) >> 8 ) & 0xff )
-
-/**
- * Extract number of registers from CPUID setting tag
- *
- * @v tag Setting tag
- * @ret num_registers Number of registers within register array
- */
-#define CPUID_NUM_REGISTERS( tag ) ( ( ( (tag) >> 16 ) & 0x3 ) + 1 )
-
-/** CPUID settings scope */
-static const struct settings_scope cpuid_settings_scope;
-
-/**
- * Check applicability of CPUID setting
- *
- * @v settings Settings block
- * @v setting Setting
- * @ret applies Setting applies within this settings block
- */
-static int cpuid_settings_applies ( struct settings *settings __unused,
- const struct setting *setting ) {
-
- return ( setting->scope == &cpuid_settings_scope );
-}
-
-/**
- * Fetch value of CPUID setting
- *
- * @v settings Settings block
- * @v setting Setting to fetch
- * @v data Buffer to fill with setting data
- * @v len Length of buffer
- * @ret len Length of setting data, or negative error
- */
-static int cpuid_settings_fetch ( struct settings *settings,
- struct setting *setting,
- void *data, size_t len ) {
- uint32_t function;
- uint32_t max_function;
- uint32_t num_functions;
- uint32_t registers;
- uint32_t num_registers;
- uint32_t buf[4];
- uint32_t output;
- uint32_t discard_b;
- uint32_t discard_c;
- uint32_t discard_d;
- size_t frag_len;
- size_t result_len = 0;
-
- /* Fail unless CPUID is supported */
- if ( ! cpuid_is_supported() ) {
- DBGC ( settings, "CPUID not supported\n" );
- return -ENOTSUP;
- }
-
- /* Find highest supported function number within this set */
- function = CPUID_FUNCTION ( setting->tag );
- cpuid ( function & CPUID_EXTENDED, &max_function, &discard_b,
- &discard_c, &discard_d );
-
- /* Fail if maximum function number is meaningless (e.g. if we
- * are attempting to call an extended function on a CPU which
- * does not support them).
- */
- if ( ( max_function & CPUID_AMD_CHECK_MASK ) !=
- ( function & CPUID_AMD_CHECK_MASK ) ) {
- DBGC ( settings, "CPUID invalid maximum function\n" );
- return -ENOTSUP;
- }
-
- /* Call each function in turn */
- num_functions = CPUID_NUM_FUNCTIONS ( setting->tag );
- for ( ; num_functions-- ; function++ ) {
-
- /* Fail if this function is not supported */
- if ( function > max_function ) {
- DBGC ( settings, "CPUID function %#08x not supported\n",
- function );
- return -ENOTSUP;
- }
-
- /* Issue CPUID */
- cpuid ( function, &buf[CPUID_EAX], &buf[CPUID_EBX],
- &buf[CPUID_ECX], &buf[CPUID_EDX] );
- DBGC ( settings, "CPUID %#08x => %#08x:%#08x:%#08x:%#08x\n",
- function, buf[0], buf[1], buf[2], buf[3] );
-
- /* Copy results to buffer */
- registers = CPUID_REGISTERS ( setting->tag );
- num_registers = CPUID_NUM_REGISTERS ( setting->tag );
- for ( ; num_registers-- ; registers >>= 2 ) {
- output = buf[ registers & 0x3 ];
- if ( ! CPUID_LITTLE_ENDIAN ( setting->tag ) )
- output = cpu_to_be32 ( output );
- frag_len = sizeof ( output );
- if ( frag_len > len )
- frag_len = len;
- memcpy ( data, &output, frag_len );
- data += frag_len;
- len -= frag_len;
- result_len += sizeof ( output );
- }
- }
-
- /* Set type if not already specified */
- if ( ! setting->type )
- setting->type = &setting_type_hexraw;
-
- return result_len;
-}
-
-/** CPUID settings operations */
-static struct settings_operations cpuid_settings_operations = {
- .applies = cpuid_settings_applies,
- .fetch = cpuid_settings_fetch,
-};
-
-/** CPUID settings */
-static struct settings cpuid_settings = {
- .refcnt = NULL,
- .siblings = LIST_HEAD_INIT ( cpuid_settings.siblings ),
- .children = LIST_HEAD_INIT ( cpuid_settings.children ),
- .op = &cpuid_settings_operations,
- .default_scope = &cpuid_settings_scope,
-};
-
-/** Initialise CPUID settings */
-static void cpuid_settings_init ( void ) {
- int rc;
-
- if ( ( rc = register_settings ( &cpuid_settings, NULL,
- "cpuid" ) ) != 0 ) {
- DBG ( "CPUID could not register settings: %s\n",
- strerror ( rc ) );
- return;
- }
-}
-
-/** CPUID settings initialiser */
-struct init_fn cpuid_settings_init_fn __init_fn ( INIT_NORMAL ) = {
- .initialise = cpuid_settings_init,
-};
-
-/** CPU vendor setting */
-const struct setting cpuvendor_setting __setting ( SETTING_HOST_EXTRA,
- cpuvendor ) = {
- .name = "cpuvendor",
- .description = "CPU vendor",
- .tag = CPUID_TAG ( CPUID_VENDOR_ID, 1, 1, 3,
- CPUID_EBX, CPUID_EDX, CPUID_ECX, 0 ),
- .type = &setting_type_string,
- .scope = &cpuid_settings_scope,
-};
-
-/** CPU model setting */
-const struct setting cpumodel_setting __setting ( SETTING_HOST_EXTRA,
- cpumodel ) = {
- .name = "cpumodel",
- .description = "CPU model",
- .tag = CPUID_TAG ( CPUID_MODEL, 3, 1, 4,
- CPUID_EAX, CPUID_EBX, CPUID_ECX, CPUID_EDX ),
- .type = &setting_type_string,
- .scope = &cpuid_settings_scope,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/core/debugcon.c b/qemu/roms/ipxe/src/arch/x86/core/debugcon.c
deleted file mode 100644
index 60de61f55..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/debugcon.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2012 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** @file
- *
- * Debug port console
- *
- * The debug port is supported by bochs (via the "port_e9_hack"
- * configuration file directive) and by qemu (via the "-debugcon"
- * command-line option).
- */
-
-#include <stdint.h>
-#include <ipxe/io.h>
-#include <ipxe/console.h>
-#include <ipxe/init.h>
-#include <config/console.h>
-
-/** Debug port */
-#define DEBUG_PORT 0xe9
-
-/** Debug port installation check magic value */
-#define DEBUG_PORT_CHECK 0xe9
-
-/* Set default console usage if applicable */
-#if ! ( defined ( CONSOLE_DEBUGCON ) && CONSOLE_EXPLICIT ( CONSOLE_DEBUGCON ) )
-#undef CONSOLE_DEBUGCON
-#define CONSOLE_DEBUGCON ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )
-#endif
-
-/**
- * Print a character to debug port console
- *
- * @v character Character to be printed
- */
-static void debugcon_putchar ( int character ) {
-
- /* Write character to debug port */
- outb ( character, DEBUG_PORT );
-}
-
-/** Debug port console driver */
-struct console_driver debugcon_console __console_driver = {
- .putchar = debugcon_putchar,
- .usage = CONSOLE_DEBUGCON,
-};
-
-/**
- * Initialise debug port console
- *
- */
-static void debugcon_init ( void ) {
- uint8_t check;
-
- /* Check if console is present */
- check = inb ( DEBUG_PORT );
- if ( check != DEBUG_PORT_CHECK ) {
- DBG ( "Debug port not present; disabling console\n" );
- debugcon_console.disabled = CONSOLE_DISABLED;
- }
-}
-
-/**
- * Debug port console initialisation function
- */
-struct init_fn debugcon_init_fn __init_fn ( INIT_EARLY ) = {
- .initialise = debugcon_init,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/core/linux/linux_api.c b/qemu/roms/ipxe/src/arch/x86/core/linux/linux_api.c
deleted file mode 100644
index 0bed9fd57..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/linux/linux_api.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2010 Piotr Jaroszyński <p.jaroszynski@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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/** @file
- *
- * Implementation of most of the linux API.
- */
-
-#include <linux_api.h>
-
-#include <stdarg.h>
-#include <asm/unistd.h>
-#include <string.h>
-
-int linux_open ( const char *pathname, int flags ) {
- return linux_syscall ( __NR_open, pathname, flags );
-}
-
-int linux_close ( int fd ) {
- return linux_syscall ( __NR_close, fd );
-}
-
-off_t linux_lseek ( int fd, off_t offset, int whence ) {
- return linux_syscall ( __NR_lseek, fd, offset, whence );
-}
-
-__kernel_ssize_t linux_read ( int fd, void *buf, __kernel_size_t count ) {
- return linux_syscall ( __NR_read, fd, buf, count );
-}
-
-__kernel_ssize_t linux_write ( int fd, const void *buf,
- __kernel_size_t count ) {
- return linux_syscall ( __NR_write, fd, buf, count );
-}
-
-int linux_fcntl ( int fd, int cmd, ... ) {
- long arg;
- va_list list;
-
- va_start ( list, cmd );
- arg = va_arg ( list, long );
- va_end ( list );
-
- return linux_syscall ( __NR_fcntl, fd, cmd, arg );
-}
-
-int linux_ioctl ( int fd, int request, ... ) {
- void *arg;
- va_list list;
-
- va_start ( list, request );
- arg = va_arg ( list, void * );
- va_end ( list );
-
- return linux_syscall ( __NR_ioctl, fd, request, arg );
-}
-
-int linux_poll ( struct pollfd *fds, nfds_t nfds, int timeout ) {
- return linux_syscall ( __NR_poll, fds, nfds, timeout );
-}
-
-int linux_nanosleep ( const struct timespec *req, struct timespec *rem ) {
- return linux_syscall ( __NR_nanosleep, req, rem );
-}
-
-int linux_usleep ( useconds_t usec ) {
- struct timespec ts = {
- .tv_sec = ( ( long ) ( usec / 1000000 ) ),
- .tv_nsec = ( ( long ) ( usec % 1000000 ) * 1000UL ),
- };
-
- return linux_nanosleep ( &ts, NULL );
-}
-
-int linux_gettimeofday ( struct timeval *tv, struct timezone *tz ) {
- return linux_syscall ( __NR_gettimeofday, tv, tz );
-}
-
-void * linux_mmap ( void *addr, __kernel_size_t length, int prot, int flags,
- int fd, __kernel_off_t offset ) {
- return ( void * ) linux_syscall ( __SYSCALL_mmap, addr, length, prot,
- flags, fd, offset );
-}
-
-void * linux_mremap ( void *old_address, __kernel_size_t old_size,
- __kernel_size_t new_size, int flags ) {
- return ( void * ) linux_syscall ( __NR_mremap, old_address, old_size,
- new_size, flags );
-}
-
-int linux_munmap ( void *addr, __kernel_size_t length ) {
- return linux_syscall ( __NR_munmap, addr, length );
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/linux/linux_strerror.c b/qemu/roms/ipxe/src/arch/x86/core/linux/linux_strerror.c
deleted file mode 100644
index 24c9b7738..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/linux/linux_strerror.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2010 Piotr Jaroszyński <p.jaroszynski@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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-FILE_LICENCE(GPL2_OR_LATER);
-
-/** @file
- *
- * linux_strerror implementation
- */
-
-#include <linux_api.h>
-#include <stdio.h>
-
-/** Error names from glibc */
-static const char *errors[] = {
- "Success",
- "Operation not permitted",
- "No such file or directory",
- "No such process",
- "Interrupted system call",
- "Input/output error",
- "No such device or address",
- "Argument list too long",
- "Exec format error",
- "Bad file descriptor",
- "No child processes",
- "Resource temporarily unavailable",
- "Cannot allocate memory",
- "Permission denied",
- "Bad address",
- "Block device required",
- "Device or resource busy",
- "File exists",
- "Invalid cross-device link",
- "No such device",
- "Not a directory",
- "Is a directory",
- "Invalid argument",
- "Too many open files in system",
- "Too many open files",
- "Inappropriate ioctl for device",
- "Text file busy",
- "File too large",
- "No space left on device",
- "Illegal seek",
- "Read-only file system",
- "Too many links",
- "Broken pipe",
- "Numerical argument out of domain",
- "Numerical result out of range",
- "Resource deadlock avoided",
- "File name too long",
- "No locks available",
- "Function not implemented",
- "Directory not empty",
- "Too many levels of symbolic links",
- "",
- "No message of desired type",
- "Identifier removed",
- "Channel number out of range",
- "Level 2 not synchronized",
- "Level 3 halted",
- "Level 3 reset",
- "Link number out of range",
- "Protocol driver not attached",
- "No CSI structure available",
- "Level 2 halted",
- "Invalid exchange",
- "Invalid request descriptor",
- "Exchange full",
- "No anode",
- "Invalid request code",
- "Invalid slot",
- "",
- "Bad font file format",
- "Device not a stream",
- "No data available",
- "Timer expired",
- "Out of streams resources",
- "Machine is not on the network",
- "Package not installed",
- "Object is remote",
- "Link has been severed",
- "Advertise error",
- "Srmount error",
- "Communication error on send",
- "Protocol error",
- "Multihop attempted",
- "RFS specific error",
- "Bad message",
- "Value too large for defined data type",
- "Name not unique on network",
- "File descriptor in bad state",
- "Remote address changed",
- "Can not access a needed shared library",
- "Accessing a corrupted shared library",
- ".lib section in a.out corrupted",
- "Attempting to link in too many shared libraries",
- "Cannot exec a shared library directly",
- "Invalid or incomplete multibyte or wide character",
- "Interrupted system call should be restarted",
- "Streams pipe error",
- "Too many users",
- "Socket operation on non-socket",
- "Destination address required",
- "Message too long",
- "Protocol wrong type for socket",
- "Protocol not available",
- "Protocol not supported",
- "Socket type not supported",
- "Operation not supported",
- "Protocol family not supported",
- "Address family not supported by protocol",
- "Address already in use",
- "Cannot assign requested address",
- "Network is down",
- "Network is unreachable",
- "Network dropped connection on reset",
- "Software caused connection abort",
- "Connection reset by peer",
- "No buffer space available",
- "Transport endpoint is already connected",
- "Transport endpoint is not connected",
- "Cannot send after transport endpoint shutdown",
- "Too many references: cannot splice",
- "Connection timed out",
- "Connection refused",
- "Host is down",
- "No route to host",
- "Operation already in progress",
- "Operation now in progress",
- "Stale NFS file handle",
- "Structure needs cleaning",
- "Not a XENIX named type file",
- "No XENIX semaphores available",
- "Is a named type file",
- "Remote I/O error",
- "Disk quota exceeded",
- "No medium found",
- "Wrong medium type",
-};
-
-const char *linux_strerror(int errnum)
-{
- static char errbuf[64];
- static int errors_size = sizeof(errors) / sizeof(*errors);
-
- if (errnum >= errors_size || errnum < 0) {
- snprintf(errbuf, sizeof(errbuf), "Error %#08x", errnum);
- return errbuf;
- } else {
- return errors[errnum];
- }
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/pcidirect.c b/qemu/roms/ipxe/src/arch/x86/core/pcidirect.c
deleted file mode 100644
index 9b8e6b1d9..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/pcidirect.c
+++ /dev/null
@@ -1,52 +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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/io.h>
-#include <ipxe/pci.h>
-
-/** @file
- *
- * PCI configuration space access via Type 1 accesses
- *
- */
-
-/**
- * Prepare for Type 1 PCI configuration space access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- */
-void pcidirect_prepare ( struct pci_device *pci, int where ) {
- outl ( ( 0x80000000 | ( pci->busdevfn << 8 ) | ( where & ~3 ) ),
- PCIDIRECT_CONFIG_ADDRESS );
-}
-
-PROVIDE_PCIAPI_INLINE ( direct, pci_num_bus );
-PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_byte );
-PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_word );
-PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_dword );
-PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_byte );
-PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_word );
-PROVIDE_PCIAPI_INLINE ( direct, pci_write_config_dword );
diff --git a/qemu/roms/ipxe/src/arch/x86/core/pic8259.c b/qemu/roms/ipxe/src/arch/x86/core/pic8259.c
deleted file mode 100644
index 0a9ea2e03..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/pic8259.c
+++ /dev/null
@@ -1,67 +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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <ipxe/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/qemu/roms/ipxe/src/arch/x86/core/pit8254.c b/qemu/roms/ipxe/src/arch/x86/core/pit8254.c
deleted file mode 100644
index da2099263..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/pit8254.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2015 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <assert.h>
-#include <ipxe/io.h>
-#include <ipxe/pit8254.h>
-
-/** @file
- *
- * 8254 Programmable Interval Timer
- *
- */
-
-/**
- * Delay for a fixed number of timer ticks using the speaker channel
- *
- * @v ticks Number of timer ticks for which to delay
- */
-void pit8254_speaker_delay ( unsigned int ticks ) {
- uint8_t spkr;
- uint8_t cmd;
- uint8_t low;
- uint8_t high;
-
- /* Sanity check */
- assert ( ticks <= 0xffff );
-
- /* Disable speaker, set speaker channel gate input high */
- spkr = inb ( PIT8254_SPKR );
- spkr &= ~PIT8254_SPKR_ENABLE;
- spkr |= PIT8254_SPKR_GATE;
- outb ( spkr, PIT8254_SPKR );
-
- /* Program speaker channel to "interrupt" on terminal count */
- cmd = ( PIT8254_CMD_CHANNEL ( PIT8254_CH_SPKR ) |
- PIT8254_CMD_ACCESS_LOHI | PIT8254_CMD_OP_TERMINAL |
- PIT8254_CMD_BINARY );
- low = ( ( ticks >> 0 ) & 0xff );
- high = ( ( ticks >> 8 ) & 0xff );
- outb ( cmd, PIT8254_CMD );
- outb ( low, PIT8254_DATA ( PIT8254_CH_SPKR ) );
- outb ( high, PIT8254_DATA ( PIT8254_CH_SPKR ) );
-
- /* Wait for channel to "interrupt" */
- do {
- spkr = inb ( PIT8254_SPKR );
- } while ( ! ( spkr & PIT8254_SPKR_OUT ) );
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/vram_settings.c b/qemu/roms/ipxe/src/arch/x86/core/vram_settings.c
deleted file mode 100644
index 9c169b40c..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/vram_settings.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2015 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/uaccess.h>
-#include <ipxe/settings.h>
-
-/** @file
- *
- * Video RAM dump
- *
- */
-
-/** Video RAM base address */
-#define VRAM_BASE 0xb8000
-
-/** Video RAM length */
-#define VRAM_LEN \
- ( 80 /* columns */ * 25 /* rows */ * 2 /* bytes per character */ )
-
-/**
- * Fetch video RAM setting
- *
- * @v data Buffer to fill with setting data
- * @v len Length of buffer
- * @ret len Length of setting data, or negative error
- */
-static int vram_fetch ( void *data, size_t len ) {
- userptr_t vram = phys_to_user ( VRAM_BASE );
-
- /* Copy video RAM */
- if ( len > VRAM_LEN )
- len = VRAM_LEN;
- copy_from_user ( data, vram, 0, len );
-
- return VRAM_LEN;
-}
-
-/** Video RAM setting */
-const struct setting vram_setting __setting ( SETTING_MISC, vram ) = {
- .name = "vram",
- .description = "Video RAM",
- .type = &setting_type_base64,
- .scope = &builtin_scope,
-};
-
-/** Video RAM built-in setting */
-struct builtin_setting vram_builtin_setting __builtin_setting = {
- .setting = &vram_setting,
- .fetch = vram_fetch,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/core/x86_bigint.c b/qemu/roms/ipxe/src/arch/x86/core/x86_bigint.c
deleted file mode 100644
index 6413b2fa8..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/x86_bigint.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <string.h>
-#include <ipxe/bigint.h>
-
-/** @file
- *
- * Big integer support
- */
-
-/**
- * Multiply big integers
- *
- * @v multiplicand0 Element 0 of big integer to be multiplied
- * @v multiplier0 Element 0 of big integer to be multiplied
- * @v result0 Element 0 of big integer to hold result
- * @v size Number of elements
- */
-void bigint_multiply_raw ( const uint32_t *multiplicand0,
- const uint32_t *multiplier0,
- uint32_t *result0, unsigned int size ) {
- const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
- ( ( const void * ) multiplicand0 );
- const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
- ( ( const void * ) multiplier0 );
- bigint_t ( size * 2 ) __attribute__ (( may_alias )) *result =
- ( ( void * ) result0 );
- unsigned int i;
- unsigned int j;
- uint32_t multiplicand_element;
- uint32_t multiplier_element;
- uint32_t *result_elements;
- uint32_t discard_a;
- uint32_t discard_d;
- long index;
-
- /* Zero result */
- memset ( result, 0, sizeof ( *result ) );
-
- /* Multiply integers one element at a time */
- for ( i = 0 ; i < size ; i++ ) {
- multiplicand_element = multiplicand->element[i];
- for ( j = 0 ; j < size ; j++ ) {
- multiplier_element = multiplier->element[j];
- result_elements = &result->element[ i + j ];
- /* Perform a single multiply, and add the
- * resulting double-element into the result,
- * carrying as necessary. The carry can
- * never overflow beyond the end of the
- * result, since:
- *
- * a < 2^{n}, b < 2^{n} => ab < 2^{2n}
- */
- __asm__ __volatile__ ( "mull %4\n\t"
- "addl %%eax, (%5,%2,4)\n\t"
- "adcl %%edx, 4(%5,%2,4)\n\t"
- "\n1:\n\t"
- "adcl $0, 8(%5,%2,4)\n\t"
- "inc %2\n\t"
- /* Does not affect CF */
- "jc 1b\n\t"
- : "=&a" ( discard_a ),
- "=&d" ( discard_d ),
- "=&r" ( index )
- : "0" ( multiplicand_element ),
- "g" ( multiplier_element ),
- "r" ( result_elements ),
- "2" ( 0 ) );
- }
- }
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/x86_io.c b/qemu/roms/ipxe/src/arch/x86/core/x86_io.c
deleted file mode 100644
index 3081fa8b9..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/x86_io.c
+++ /dev/null
@@ -1,106 +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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/io.h>
-#include <ipxe/x86_io.h>
-
-/** @file
- *
- * iPXE 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 __unused uint64_t i386_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 __unused void i386_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_INLINE ( x86, writeb );
-PROVIDE_IOAPI_INLINE ( x86, writew );
-PROVIDE_IOAPI_INLINE ( x86, writel );
-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 );
-#ifdef __x86_64__
-PROVIDE_IOAPI_INLINE ( x86, readq );
-PROVIDE_IOAPI_INLINE ( x86, writeq );
-#else
-PROVIDE_IOAPI ( x86, readq, i386_readq );
-PROVIDE_IOAPI ( x86, writeq, i386_writeq );
-#endif
diff --git a/qemu/roms/ipxe/src/arch/x86/core/x86_string.c b/qemu/roms/ipxe/src/arch/x86/core/x86_string.c
deleted file mode 100644
index 7d5e4a5f1..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/x86_string.c
+++ /dev/null
@@ -1,110 +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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-/** @file
- *
- * Optimised string operations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <string.h>
-
-/**
- * Copy memory area
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-void * __attribute__ (( noinline )) __memcpy ( void *dest, const void *src,
- size_t len ) {
- void *edi = dest;
- const void *esi = src;
- int discard_ecx;
-
- /* We often do large dword-aligned and dword-length block
- * moves. Using movsl rather than movsb speeds these up by
- * around 32%.
- */
- __asm__ __volatile__ ( "rep movsl"
- : "=&D" ( edi ), "=&S" ( esi ),
- "=&c" ( discard_ecx )
- : "0" ( edi ), "1" ( esi ), "2" ( len >> 2 )
- : "memory" );
- __asm__ __volatile__ ( "rep movsb"
- : "=&D" ( edi ), "=&S" ( esi ),
- "=&c" ( discard_ecx )
- : "0" ( edi ), "1" ( esi ), "2" ( len & 3 )
- : "memory" );
- return dest;
-}
-
-/**
- * Copy memory area backwards
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-void * __attribute__ (( noinline )) __memcpy_reverse ( void *dest,
- const void *src,
- size_t len ) {
- void *edi = ( dest + len - 1 );
- const void *esi = ( src + len - 1 );
- int discard_ecx;
-
- /* Assume memmove() is not performance-critical, and perform a
- * bytewise copy for simplicity.
- */
- __asm__ __volatile__ ( "std\n\t"
- "rep movsb\n\t"
- "cld\n\t"
- : "=&D" ( edi ), "=&S" ( esi ),
- "=&c" ( discard_ecx )
- : "0" ( edi ), "1" ( esi ),
- "2" ( len )
- : "memory" );
- return dest;
-}
-
-
-/**
- * Copy (possibly overlapping) memory area
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-void * __memmove ( void *dest, const void *src, size_t len ) {
-
- if ( dest <= src ) {
- return __memcpy ( dest, src, len );
- } else {
- return __memcpy_reverse ( dest, src, len );
- }
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/x86_tcpip.c b/qemu/roms/ipxe/src/arch/x86/core/x86_tcpip.c
deleted file mode 100644
index 88042f5f7..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/x86_tcpip.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2012 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** @file
- *
- * TCP/IP checksum
- *
- */
-
-#include <limits.h>
-#include <ipxe/tcpip.h>
-
-extern char x86_tcpip_loop_end[];
-
-/**
- * Calculate continued TCP/IP checkum
- *
- * @v partial Checksum of already-summed data, in network byte order
- * @v data Data buffer
- * @v len Length of data buffer
- * @ret cksum Updated checksum, in network byte order
- */
-uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
- const void *data, size_t len ) {
- unsigned long sum = ( ( ~partial ) & 0xffff );
- unsigned long initial_word_count;
- unsigned long loop_count;
- unsigned long loop_partial_count;
- unsigned long final_word_count;
- unsigned long final_byte;
- unsigned long discard_S;
- unsigned long discard_c;
- unsigned long discard_a;
- unsigned long discard_r1;
- unsigned long discard_r2;
-
- /* Calculate number of initial 16-bit words required to bring
- * the main loop into alignment. (We don't care about the
- * speed for data aligned to less than 16 bits, since this
- * situation won't occur in practice.)
- */
- if ( len >= sizeof ( sum ) ) {
- initial_word_count = ( ( -( ( intptr_t ) data ) &
- ( sizeof ( sum ) - 1 ) ) >> 1 );
- } else {
- initial_word_count = 0;
- }
- len -= ( initial_word_count * 2 );
-
- /* Calculate number of iterations of the main loop. This loop
- * processes native machine words (32-bit or 64-bit), and is
- * unrolled 16 times. We calculate an overall iteration
- * count, and a starting point for the first iteration.
- */
- loop_count = ( len / ( sizeof ( sum ) * 16 ) );
- loop_partial_count =
- ( ( len % ( sizeof ( sum ) * 16 ) ) / sizeof ( sum ) );
-
- /* Calculate number of 16-bit words remaining after the main
- * loop completes.
- */
- final_word_count = ( ( len % sizeof ( sum ) ) / 2 );
-
- /* Calculate whether or not a final byte remains at the end */
- final_byte = ( len & 1 );
-
- /* Calculate the checksum */
- __asm__ ( /* Calculate position at which to jump into the
- * unrolled loop.
- */
- "imul $( -x86_tcpip_loop_step_size ), %4\n\t"
- "add %5, %4\n\t"
-
- /* Clear carry flag before starting checksumming */
- "clc\n\t"
-
- /* Checksum initial words */
- "jmp 2f\n\t"
- "\n1:\n\t"
- "lodsw\n\t"
- "adcw %w2, %w0\n\t"
- "\n2:\n\t"
- "loop 1b\n\t"
-
- /* Main "lods;adc" loop, unrolled x16 */
- "mov %12, %3\n\t"
- "jmp *%4\n\t"
- "\nx86_tcpip_loop_start:\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "lods%z2\n\tadc %2, %0\n\t"
- "\nx86_tcpip_loop_end:\n\t"
- "loop x86_tcpip_loop_start\n\t"
- ".equ x86_tcpip_loop_step_size, "
- " ( ( x86_tcpip_loop_end - x86_tcpip_loop_start ) >> 4 )\n\t"
-
- /* Checksum remaining whole words */
- "mov %13, %3\n\t"
- "jmp 2f\n\t"
- "\n1:\n\t"
- "lodsw\n\t"
- "adcw %w2, %w0\n\t"
- "\n2:\n\t"
- "loop 1b\n\t"
-
- /* Checksum final byte if applicable */
- "mov %14, %3\n\t"
- "loop 1f\n\t"
- "adcb (%1), %b0\n\t"
- "adcb $0, %h0\n\t"
- "\n1:\n\t"
-
- /* Fold down to a uint16_t */
- "push %0\n\t"
- "popw %w0\n\t"
- "popw %w2\n\t"
- "adcw %w2, %w0\n\t"
-#if ULONG_MAX > 0xffffffffUL /* 64-bit only */
- "popw %w2\n\t"
- "adcw %w2, %w0\n\t"
- "popw %w2\n\t"
- "adcw %w2, %w0\n\t"
-#endif /* 64-bit only */
-
- /* Consume CF */
- "adcw $0, %w0\n\t"
- "adcw $0, %w0\n\t"
-
- : "=&Q" ( sum ), "=&S" ( discard_S ), "=&a" ( discard_a ),
- "=&c" ( discard_c ), "=&r" ( discard_r1 ),
- "=&r" ( discard_r2 )
- : "0" ( sum ), "1" ( data ), "2" ( 0 ),
- "3" ( initial_word_count + 1 ), "4" ( loop_partial_count ),
- "5" ( x86_tcpip_loop_end ), "g" ( loop_count + 1 ),
- "g" ( final_word_count + 1 ), "g" ( final_byte ) );
-
- return ( ~sum & 0xffff );
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/core/x86_uart.c b/qemu/roms/ipxe/src/arch/x86/core/x86_uart.c
deleted file mode 100644
index e455775bf..000000000
--- a/qemu/roms/ipxe/src/arch/x86/core/x86_uart.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2014 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** @file
- *
- * 16550-compatible UART
- *
- */
-
-#include <errno.h>
-#include <ipxe/uart.h>
-
-/** UART port bases */
-static uint16_t uart_base[] = {
- [COM1] = 0x3f8,
- [COM2] = 0x2f8,
- [COM3] = 0x3e8,
- [COM4] = 0x2e8,
-};
-
-/**
- * Select UART port
- *
- * @v uart UART
- * @v port Port number, or 0 to disable
- * @ret rc Return status code
- */
-int uart_select ( struct uart *uart, unsigned int port ) {
- int rc;
-
- /* Set new UART base */
- if ( port >= ( sizeof ( uart_base ) / sizeof ( uart_base[0] ) ) ) {
- rc = -ENODEV;
- goto err;
- }
- uart->base = ( ( void * ) ( intptr_t ) uart_base[port] );
-
- /* Check that UART exists */
- if ( ( rc = uart_exists ( uart ) ) != 0 )
- goto err;
-
- return 0;
-
- err:
- uart->base = NULL;
- return rc;
-}
diff --git a/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.c b/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.c
deleted file mode 100644
index f73829bd5..000000000
--- a/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- * Copyright (C) 2014 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** @file
- *
- * Hyper-V driver
- *
- */
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <byteswap.h>
-#include <pic8259.h>
-#include <ipxe/malloc.h>
-#include <ipxe/device.h>
-#include <ipxe/cpuid.h>
-#include <ipxe/msr.h>
-#include <ipxe/hyperv.h>
-#include <ipxe/vmbus.h>
-#include "hyperv.h"
-
-/** Maximum time to wait for a message response
- *
- * This is a policy decision.
- */
-#define HV_MESSAGE_MAX_WAIT_MS 1000
-
-/**
- * Convert a Hyper-V status code to an iPXE status code
- *
- * @v status Hyper-V status code
- * @ret rc iPXE status code (before negation)
- */
-#define EHV( status ) EPLATFORM ( EINFO_EPLATFORM, (status) )
-
-/**
- * Allocate zeroed pages
- *
- * @v hv Hyper-V hypervisor
- * @v ... Page addresses to fill in, terminated by NULL
- * @ret rc Return status code
- */
-__attribute__ (( sentinel )) int
-hv_alloc_pages ( struct hv_hypervisor *hv, ... ) {
- va_list args;
- void **page;
- int i;
-
- /* Allocate and zero pages */
- va_start ( args, hv );
- for ( i = 0 ; ( ( page = va_arg ( args, void ** ) ) != NULL ); i++ ) {
- *page = malloc_dma ( PAGE_SIZE, PAGE_SIZE );
- if ( ! *page )
- goto err_alloc;
- memset ( *page, 0, PAGE_SIZE );
- }
- va_end ( args );
-
- return 0;
-
- err_alloc:
- va_end ( args );
- va_start ( args, hv );
- for ( ; i >= 0 ; i-- ) {
- page = va_arg ( args, void ** );
- free_dma ( *page, PAGE_SIZE );
- }
- va_end ( args );
- return -ENOMEM;
-}
-
-/**
- * Free pages
- *
- * @v hv Hyper-V hypervisor
- * @v ... Page addresses, terminated by NULL
- */
-__attribute__ (( sentinel )) void
-hv_free_pages ( struct hv_hypervisor *hv, ... ) {
- va_list args;
- void *page;
-
- va_start ( args, hv );
- while ( ( page = va_arg ( args, void * ) ) != NULL )
- free_dma ( page, PAGE_SIZE );
- va_end ( args );
-}
-
-/**
- * Allocate message buffer
- *
- * @v hv Hyper-V hypervisor
- * @ret rc Return status code
- */
-static int hv_alloc_message ( struct hv_hypervisor *hv ) {
-
- /* Allocate buffer. Must be aligned to at least 8 bytes and
- * must not cross a page boundary, so align on its own size.
- */
- hv->message = malloc_dma ( sizeof ( *hv->message ),
- sizeof ( *hv->message ) );
- if ( ! hv->message )
- return -ENOMEM;
-
- return 0;
-}
-
-/**
- * Free message buffer
- *
- * @v hv Hyper-V hypervisor
- */
-static void hv_free_message ( struct hv_hypervisor *hv ) {
-
- /* Free buffer */
- free_dma ( hv->message, sizeof ( *hv->message ) );
-}
-
-/**
- * Check whether or not we are running in Hyper-V
- *
- * @v hv Hyper-V hypervisor
- * @ret rc Return status code
- */
-static int hv_check_hv ( struct hv_hypervisor *hv ) {
- struct x86_features features;
- uint32_t interface_id;
- uint32_t discard_ebx;
- uint32_t discard_ecx;
- uint32_t discard_edx;
- uint32_t available;
- uint32_t permissions;
-
- /* Check for presence of a hypervisor (not necessarily Hyper-V) */
- x86_features ( &features );
- if ( ! ( features.intel.ecx & CPUID_FEATURES_INTEL_ECX_HYPERVISOR ) ) {
- DBGC ( hv, "HV %p not running in a hypervisor\n", hv );
- return -ENODEV;
- }
-
- /* Check that hypervisor is Hyper-V */
- cpuid ( HV_CPUID_INTERFACE_ID, &interface_id, &discard_ebx,
- &discard_ecx, &discard_edx );
- if ( interface_id != HV_INTERFACE_ID ) {
- DBGC ( hv, "HV %p not running in Hyper-V (interface ID "
- "%#08x)\n", hv, interface_id );
- return -ENODEV;
- }
-
- /* Check that required features and privileges are available */
- cpuid ( HV_CPUID_FEATURES, &available, &permissions, &discard_ecx,
- &discard_edx );
- if ( ! ( available & HV_FEATURES_AVAIL_HYPERCALL_MSR ) ) {
- DBGC ( hv, "HV %p has no hypercall MSRs (features %08x:%08x)\n",
- hv, available, permissions );
- return -ENODEV;
- }
- if ( ! ( available & HV_FEATURES_AVAIL_SYNIC_MSR ) ) {
- DBGC ( hv, "HV %p has no SynIC MSRs (features %08x:%08x)\n",
- hv, available, permissions );
- return -ENODEV;
- }
- if ( ! ( permissions & HV_FEATURES_PERM_POST_MESSAGES ) ) {
- DBGC ( hv, "HV %p cannot post messages (features %08x:%08x)\n",
- hv, available, permissions );
- return -EACCES;
- }
- if ( ! ( permissions & HV_FEATURES_PERM_SIGNAL_EVENTS ) ) {
- DBGC ( hv, "HV %p cannot signal events (features %08x:%08x)",
- hv, available, permissions );
- return -EACCES;
- }
-
- return 0;
-}
-
-/**
- * Map hypercall page
- *
- * @v hv Hyper-V hypervisor
- * @ret rc Return status code
- */
-static int hv_map_hypercall ( struct hv_hypervisor *hv ) {
- union {
- struct {
- uint32_t ebx;
- uint32_t ecx;
- uint32_t edx;
- } __attribute__ (( packed ));
- char text[ 13 /* "bbbbccccdddd" + NUL */ ];
- } vendor_id;
- uint32_t build;
- uint32_t version;
- uint32_t discard_eax;
- uint32_t discard_ecx;
- uint32_t discard_edx;
- uint64_t guest_os_id;
- uint64_t hypercall;
-
- /* Report guest OS identity */
- guest_os_id = rdmsr ( HV_X64_MSR_GUEST_OS_ID );
- if ( guest_os_id != 0 ) {
- DBGC ( hv, "HV %p guest OS ID MSR already set to %#08llx\n",
- hv, guest_os_id );
- return -EBUSY;
- }
- guest_os_id = HV_GUEST_OS_ID_IPXE;
- DBGC2 ( hv, "HV %p guest OS ID MSR is %#08llx\n", hv, guest_os_id );
- wrmsr ( HV_X64_MSR_GUEST_OS_ID, guest_os_id );
-
- /* Get hypervisor system identity (for debugging) */
- cpuid ( HV_CPUID_VENDOR_ID, &discard_eax, &vendor_id.ebx,
- &vendor_id.ecx, &vendor_id.edx );
- vendor_id.text[ sizeof ( vendor_id.text ) - 1 ] = '\0';
- cpuid ( HV_CPUID_HYPERVISOR_ID, &build, &version, &discard_ecx,
- &discard_edx );
- DBGC ( hv, "HV %p detected \"%s\" version %d.%d build %d\n", hv,
- vendor_id.text, ( version >> 16 ), ( version & 0xffff ), build );
-
- /* Map hypercall page */
- hypercall = rdmsr ( HV_X64_MSR_HYPERCALL );
- hypercall &= ( PAGE_SIZE - 1 );
- hypercall |= ( virt_to_phys ( hv->hypercall ) | HV_HYPERCALL_ENABLE );
- DBGC2 ( hv, "HV %p hypercall MSR is %#08llx\n", hv, hypercall );
- wrmsr ( HV_X64_MSR_HYPERCALL, hypercall );
-
- return 0;
-}
-
-/**
- * Unmap hypercall page
- *
- * @v hv Hyper-V hypervisor
- */
-static void hv_unmap_hypercall ( struct hv_hypervisor *hv ) {
- uint64_t hypercall;
- uint64_t guest_os_id;
-
- /* Unmap the hypercall page */
- hypercall = rdmsr ( HV_X64_MSR_HYPERCALL );
- hypercall &= ( ( PAGE_SIZE - 1 ) & ~HV_HYPERCALL_ENABLE );
- DBGC2 ( hv, "HV %p hypercall MSR is %#08llx\n", hv, hypercall );
- wrmsr ( HV_X64_MSR_HYPERCALL, hypercall );
-
- /* Reset the guest OS identity */
- guest_os_id = 0;
- DBGC2 ( hv, "HV %p guest OS ID MSR is %#08llx\n", hv, guest_os_id );
- wrmsr ( HV_X64_MSR_GUEST_OS_ID, guest_os_id );
-}
-
-/**
- * Map synthetic interrupt controller
- *
- * @v hv Hyper-V hypervisor
- * @ret rc Return status code
- */
-static int hv_map_synic ( struct hv_hypervisor *hv ) {
- uint64_t simp;
- uint64_t siefp;
- uint64_t scontrol;
-
- /* Map SynIC message page */
- simp = rdmsr ( HV_X64_MSR_SIMP );
- simp &= ( PAGE_SIZE - 1 );
- simp |= ( virt_to_phys ( hv->synic.message ) | HV_SIMP_ENABLE );
- DBGC2 ( hv, "HV %p SIMP MSR is %#08llx\n", hv, simp );
- wrmsr ( HV_X64_MSR_SIMP, simp );
-
- /* Map SynIC event page */
- siefp = rdmsr ( HV_X64_MSR_SIEFP );
- siefp &= ( PAGE_SIZE - 1 );
- siefp |= ( virt_to_phys ( hv->synic.event ) | HV_SIEFP_ENABLE );
- DBGC2 ( hv, "HV %p SIEFP MSR is %#08llx\n", hv, siefp );
- wrmsr ( HV_X64_MSR_SIEFP, siefp );
-
- /* Enable SynIC */
- scontrol = rdmsr ( HV_X64_MSR_SCONTROL );
- scontrol |= HV_SCONTROL_ENABLE;
- DBGC2 ( hv, "HV %p SCONTROL MSR is %#08llx\n", hv, scontrol );
- wrmsr ( HV_X64_MSR_SCONTROL, scontrol );
-
- return 0;
-}
-
-/**
- * Unmap synthetic interrupt controller
- *
- * @v hv Hyper-V hypervisor
- */
-static void hv_unmap_synic ( struct hv_hypervisor *hv ) {
- uint64_t scontrol;
- uint64_t siefp;
- uint64_t simp;
-
- /* Disable SynIC */
- scontrol = rdmsr ( HV_X64_MSR_SCONTROL );
- scontrol &= ~HV_SCONTROL_ENABLE;
- DBGC2 ( hv, "HV %p SCONTROL MSR is %#08llx\n", hv, scontrol );
- wrmsr ( HV_X64_MSR_SCONTROL, scontrol );
-
- /* Unmap SynIC event page */
- siefp = rdmsr ( HV_X64_MSR_SIEFP );
- siefp &= ( ( PAGE_SIZE - 1 ) & ~HV_SIEFP_ENABLE );
- DBGC2 ( hv, "HV %p SIEFP MSR is %#08llx\n", hv, siefp );
- wrmsr ( HV_X64_MSR_SIEFP, siefp );
-
- /* Unmap SynIC message page */
- simp = rdmsr ( HV_X64_MSR_SIMP );
- simp &= ( ( PAGE_SIZE - 1 ) & ~HV_SIMP_ENABLE );
- DBGC2 ( hv, "HV %p SIMP MSR is %#08llx\n", hv, simp );
- wrmsr ( HV_X64_MSR_SIMP, simp );
-}
-
-/**
- * Enable synthetic interrupt
- *
- * @v hv Hyper-V hypervisor
- * @v sintx Synthetic interrupt number
- */
-void hv_enable_sint ( struct hv_hypervisor *hv, unsigned int sintx ) {
- unsigned long msr = HV_X64_MSR_SINT ( sintx );
- uint64_t sint;
-
- /* Enable synthetic interrupt
- *
- * We have to enable the interrupt, otherwise messages will
- * not be delivered (even though the documentation implies
- * that polling for messages is possible). We enable AutoEOI
- * and hook the interrupt to the obsolete IRQ13 (FPU
- * exception) vector, which will be implemented as a no-op.
- */
- sint = rdmsr ( msr );
- sint &= ~( HV_SINT_MASKED | HV_SINT_VECTOR_MASK );
- sint |= ( HV_SINT_AUTO_EOI |
- HV_SINT_VECTOR ( IRQ_INT ( 13 /* See comment above */ ) ) );
- DBGC2 ( hv, "HV %p SINT%d MSR is %#08llx\n", hv, sintx, sint );
- wrmsr ( msr, sint );
-}
-
-/**
- * Disable synthetic interrupt
- *
- * @v hv Hyper-V hypervisor
- * @v sintx Synthetic interrupt number
- */
-void hv_disable_sint ( struct hv_hypervisor *hv, unsigned int sintx ) {
- unsigned long msr = HV_X64_MSR_SINT ( sintx );
- uint64_t sint;
-
- /* Disable synthetic interrupt */
- sint = rdmsr ( msr );
- sint &= ~HV_SINT_AUTO_EOI;
- sint |= HV_SINT_MASKED;
- DBGC2 ( hv, "HV %p SINT%d MSR is %#08llx\n", hv, sintx, sint );
- wrmsr ( msr, sint );
-}
-
-/**
- * Post message
- *
- * @v hv Hyper-V hypervisor
- * @v id Connection ID
- * @v type Message type
- * @v data Message
- * @v len Length of message
- * @ret rc Return status code
- */
-int hv_post_message ( struct hv_hypervisor *hv, unsigned int id,
- unsigned int type, const void *data, size_t len ) {
- struct hv_post_message *msg = &hv->message->posted;
- int status;
- int rc;
-
- /* Sanity check */
- assert ( len <= sizeof ( msg->data ) );
-
- /* Construct message */
- memset ( msg, 0, sizeof ( *msg ) );
- msg->id = cpu_to_le32 ( id );
- msg->type = cpu_to_le32 ( type );
- msg->len = cpu_to_le32 ( len );
- memcpy ( msg->data, data, len );
- DBGC2 ( hv, "HV %p connection %d posting message type %#08x:\n",
- hv, id, type );
- DBGC2_HDA ( hv, 0, msg->data, len );
-
- /* Post message */
- if ( ( status = hv_call ( hv, HV_POST_MESSAGE, msg, NULL ) ) != 0 ) {
- rc = -EHV ( status );
- DBGC ( hv, "HV %p could not post message to %#08x: %s\n",
- hv, id, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Wait for received message
- *
- * @v hv Hyper-V hypervisor
- * @v sintx Synthetic interrupt number
- * @ret rc Return status code
- */
-int hv_wait_for_message ( struct hv_hypervisor *hv, unsigned int sintx ) {
- struct hv_message *msg = &hv->message->received;
- struct hv_message *src = &hv->synic.message[sintx];
- unsigned int retries;
- size_t len;
-
- /* Wait for message to arrive */
- for ( retries = 0 ; retries < HV_MESSAGE_MAX_WAIT_MS ; retries++ ) {
-
- /* Check for message */
- if ( src->type ) {
-
- /* Copy message */
- memset ( msg, 0, sizeof ( *msg ) );
- len = src->len;
- assert ( len <= sizeof ( *msg ) );
- memcpy ( msg, src,
- ( offsetof ( typeof ( *msg ), data ) + len ) );
- DBGC2 ( hv, "HV %p SINT%d received message type "
- "%#08x:\n", hv, sintx,
- le32_to_cpu ( msg->type ) );
- DBGC2_HDA ( hv, 0, msg->data, len );
-
- /* Consume message */
- src->type = 0;
-
- return 0;
- }
-
- /* Trigger message delivery */
- wrmsr ( HV_X64_MSR_EOM, 0 );
-
- /* Delay */
- mdelay ( 1 );
- }
-
- DBGC ( hv, "HV %p SINT%d timed out waiting for message\n",
- hv, sintx );
- return -ETIMEDOUT;
-}
-
-/**
- * Signal event
- *
- * @v hv Hyper-V hypervisor
- * @v id Connection ID
- * @v flag Flag number
- * @ret rc Return status code
- */
-int hv_signal_event ( struct hv_hypervisor *hv, unsigned int id,
- unsigned int flag ) {
- struct hv_signal_event *event = &hv->message->signalled;
- int status;
- int rc;
-
- /* Construct event */
- memset ( event, 0, sizeof ( *event ) );
- event->id = cpu_to_le32 ( id );
- event->flag = cpu_to_le16 ( flag );
-
- /* Signal event */
- if ( ( status = hv_call ( hv, HV_SIGNAL_EVENT, event, NULL ) ) != 0 ) {
- rc = -EHV ( status );
- DBGC ( hv, "HV %p could not signal event to %#08x: %s\n",
- hv, id, strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Probe root device
- *
- * @v rootdev Root device
- * @ret rc Return status code
- */
-static int hv_probe ( struct root_device *rootdev ) {
- struct hv_hypervisor *hv;
- int rc;
-
- /* Allocate and initialise structure */
- hv = zalloc ( sizeof ( *hv ) );
- if ( ! hv ) {
- rc = -ENOMEM;
- goto err_alloc;
- }
-
- /* Check we are running in Hyper-V */
- if ( ( rc = hv_check_hv ( hv ) ) != 0 )
- goto err_check_hv;
-
- /* Allocate pages */
- if ( ( rc = hv_alloc_pages ( hv, &hv->hypercall, &hv->synic.message,
- &hv->synic.event, NULL ) ) != 0 )
- goto err_alloc_pages;
-
- /* Allocate message buffer */
- if ( ( rc = hv_alloc_message ( hv ) ) != 0 )
- goto err_alloc_message;
-
- /* Map hypercall page */
- if ( ( rc = hv_map_hypercall ( hv ) ) != 0 )
- goto err_map_hypercall;
-
- /* Map synthetic interrupt controller */
- if ( ( rc = hv_map_synic ( hv ) ) != 0 )
- goto err_map_synic;
-
- /* Probe Hyper-V devices */
- if ( ( rc = vmbus_probe ( hv, &rootdev->dev ) ) != 0 )
- goto err_vmbus_probe;
-
- rootdev_set_drvdata ( rootdev, hv );
- return 0;
-
- vmbus_remove ( hv, &rootdev->dev );
- err_vmbus_probe:
- hv_unmap_synic ( hv );
- err_map_synic:
- hv_unmap_hypercall ( hv );
- err_map_hypercall:
- hv_free_message ( hv );
- err_alloc_message:
- hv_free_pages ( hv, hv->hypercall, hv->synic.message, hv->synic.event,
- NULL );
- err_alloc_pages:
- err_check_hv:
- free ( hv );
- err_alloc:
- return rc;
-}
-
-/**
- * Remove root device
- *
- * @v rootdev Root device
- */
-static void hv_remove ( struct root_device *rootdev ) {
- struct hv_hypervisor *hv = rootdev_get_drvdata ( rootdev );
-
- vmbus_remove ( hv, &rootdev->dev );
- hv_unmap_synic ( hv );
- hv_unmap_hypercall ( hv );
- hv_free_message ( hv );
- hv_free_pages ( hv, hv->hypercall, hv->synic.message, hv->synic.event,
- NULL );
- free ( hv );
-}
-
-/** Hyper-V root device driver */
-static struct root_driver hv_root_driver = {
- .probe = hv_probe,
- .remove = hv_remove,
-};
-
-/** Hyper-V root device */
-struct root_device hv_root_device __root_device = {
- .dev = { .name = "Hyper-V" },
- .driver = &hv_root_driver,
-};
-
-/* Drag in objects via hv_root_device */
-REQUIRING_SYMBOL ( hv_root_device );
-
-/* Drag in netvsc driver */
-REQUIRE_OBJECT ( netvsc );
diff --git a/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.h b/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.h
deleted file mode 100644
index 0d09beb44..000000000
--- a/qemu/roms/ipxe/src/arch/x86/drivers/hyperv/hyperv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _HYPERV_H
-#define _HYPERV_H
-
-/** @file
- *
- * Hyper-V driver
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** Get vendor identification */
-#define HV_CPUID_VENDOR_ID 0x40000000UL
-
-/** Get interface identification */
-#define HV_CPUID_INTERFACE_ID 0x40000001UL
-
-/** Get hypervisor identification */
-#define HV_CPUID_HYPERVISOR_ID 0x40000002UL
-
-/** Get hypervisor features */
-#define HV_CPUID_FEATURES 0x40000003UL
-
-/** SynIC MSRs are available */
-#define HV_FEATURES_AVAIL_SYNIC_MSR 0x00000004UL
-
-/** Hypercall MSRs are available */
-#define HV_FEATURES_AVAIL_HYPERCALL_MSR 0x00000020UL
-
-/** Guest may post messages */
-#define HV_FEATURES_PERM_POST_MESSAGES 0x00000010UL
-
-/** Guest may signal events */
-#define HV_FEATURES_PERM_SIGNAL_EVENTS 0x00000020UL
-
-/** Guest OS identity MSR */
-#define HV_X64_MSR_GUEST_OS_ID 0x40000000UL
-
-/** Hypercall page MSR */
-#define HV_X64_MSR_HYPERCALL 0x40000001UL
-
-/** SynIC control MSR */
-#define HV_X64_MSR_SCONTROL 0x40000080UL
-
-/** SynIC event flags page MSR */
-#define HV_X64_MSR_SIEFP 0x40000082UL
-
-/** SynIC message page MSR */
-#define HV_X64_MSR_SIMP 0x40000083UL
-
-/** SynIC end of message MSR */
-#define HV_X64_MSR_EOM 0x40000084UL
-
-/** SynIC interrupt source MSRs */
-#define HV_X64_MSR_SINT(x) ( 0x40000090UL + (x) )
-
-#endif /* _HYPERV_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.c b/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.c
deleted file mode 100644
index 7ac32d54c..000000000
--- a/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * Copyright (C) 2014 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ipxe/malloc.h>
-#include <ipxe/pci.h>
-#include <ipxe/cpuid.h>
-#include <ipxe/msr.h>
-#include <ipxe/xen.h>
-#include <ipxe/xenver.h>
-#include <ipxe/xenmem.h>
-#include <ipxe/xenstore.h>
-#include <ipxe/xenbus.h>
-#include <ipxe/xengrant.h>
-#include "hvm.h"
-
-/** @file
- *
- * Xen HVM driver
- *
- */
-
-/**
- * Get CPUID base
- *
- * @v hvm HVM device
- * @ret rc Return status code
- */
-static int hvm_cpuid_base ( struct hvm_device *hvm ) {
- struct {
- uint32_t ebx;
- uint32_t ecx;
- uint32_t edx;
- } __attribute__ (( packed )) signature;
- uint32_t base;
- uint32_t version;
- uint32_t discard_eax;
- uint32_t discard_ebx;
- uint32_t discard_ecx;
- uint32_t discard_edx;
-
- /* Scan for magic signature */
- for ( base = HVM_CPUID_MIN ; base <= HVM_CPUID_MAX ;
- base += HVM_CPUID_STEP ) {
- cpuid ( base, &discard_eax, &signature.ebx, &signature.ecx,
- &signature.edx );
- if ( memcmp ( &signature, HVM_CPUID_MAGIC,
- sizeof ( signature ) ) == 0 ) {
- hvm->cpuid_base = base;
- cpuid ( ( base + HVM_CPUID_VERSION ), &version,
- &discard_ebx, &discard_ecx, &discard_edx );
- DBGC2 ( hvm, "HVM using CPUID base %#08x (v%d.%d)\n",
- base, ( version >> 16 ), ( version & 0xffff ) );
- return 0;
- }
- }
-
- DBGC ( hvm, "HVM could not find hypervisor\n" );
- return -ENODEV;
-}
-
-/**
- * Map hypercall page(s)
- *
- * @v hvm HVM device
- * @ret rc Return status code
- */
-static int hvm_map_hypercall ( struct hvm_device *hvm ) {
- uint32_t pages;
- uint32_t msr;
- uint32_t discard_ecx;
- uint32_t discard_edx;
- physaddr_t hypercall_phys;
- uint32_t version;
- static xen_extraversion_t extraversion;
- int xenrc;
- int rc;
-
- /* Get number of hypercall pages and MSR to use */
- cpuid ( ( hvm->cpuid_base + HVM_CPUID_PAGES ), &pages, &msr,
- &discard_ecx, &discard_edx );
-
- /* Allocate pages */
- hvm->hypercall_len = ( pages * PAGE_SIZE );
- hvm->xen.hypercall = malloc_dma ( hvm->hypercall_len, PAGE_SIZE );
- if ( ! hvm->xen.hypercall ) {
- DBGC ( hvm, "HVM could not allocate %d hypercall page(s)\n",
- pages );
- return -ENOMEM;
- }
- hypercall_phys = virt_to_phys ( hvm->xen.hypercall );
- DBGC2 ( hvm, "HVM hypercall page(s) at [%#08lx,%#08lx) via MSR %#08x\n",
- hypercall_phys, ( hypercall_phys + hvm->hypercall_len ), msr );
-
- /* Write to MSR */
- wrmsr ( msr, hypercall_phys );
-
- /* Check that hypercall mechanism is working */
- version = xenver_version ( &hvm->xen );
- if ( ( xenrc = xenver_extraversion ( &hvm->xen, &extraversion ) ) != 0){
- rc = -EXEN ( xenrc );
- DBGC ( hvm, "HVM could not get extraversion: %s\n",
- strerror ( rc ) );
- return rc;
- }
- DBGC2 ( hvm, "HVM found Xen version %d.%d%s\n",
- ( version >> 16 ), ( version & 0xffff ) , extraversion );
-
- return 0;
-}
-
-/**
- * Unmap hypercall page(s)
- *
- * @v hvm HVM device
- */
-static void hvm_unmap_hypercall ( struct hvm_device *hvm ) {
-
- /* Free pages */
- free_dma ( hvm->xen.hypercall, hvm->hypercall_len );
-}
-
-/**
- * Allocate and map MMIO space
- *
- * @v hvm HVM device
- * @v space Source mapping space
- * @v len Length (must be a multiple of PAGE_SIZE)
- * @ret mmio MMIO space address, or NULL on error
- */
-static void * hvm_ioremap ( struct hvm_device *hvm, unsigned int space,
- size_t len ) {
- struct xen_add_to_physmap add;
- struct xen_remove_from_physmap remove;
- unsigned int pages = ( len / PAGE_SIZE );
- physaddr_t mmio_phys;
- unsigned int i;
- void *mmio;
- int xenrc;
- int rc;
-
- /* Sanity check */
- assert ( ( len % PAGE_SIZE ) == 0 );
-
- /* Check for available space */
- if ( ( hvm->mmio_offset + len ) > hvm->mmio_len ) {
- DBGC ( hvm, "HVM could not allocate %zd bytes of MMIO space "
- "(%zd of %zd remaining)\n", len,
- ( hvm->mmio_len - hvm->mmio_offset ), hvm->mmio_len );
- goto err_no_space;
- }
-
- /* Map this space */
- mmio = ioremap ( ( hvm->mmio + hvm->mmio_offset ), len );
- if ( ! mmio ) {
- DBGC ( hvm, "HVM could not map MMIO space [%08lx,%08lx)\n",
- ( hvm->mmio + hvm->mmio_offset ),
- ( hvm->mmio + hvm->mmio_offset + len ) );
- goto err_ioremap;
- }
- mmio_phys = virt_to_phys ( mmio );
-
- /* Add to physical address space */
- for ( i = 0 ; i < pages ; i++ ) {
- add.domid = DOMID_SELF;
- add.idx = i;
- add.space = space;
- add.gpfn = ( ( mmio_phys / PAGE_SIZE ) + i );
- if ( ( xenrc = xenmem_add_to_physmap ( &hvm->xen, &add ) ) !=0){
- rc = -EXEN ( xenrc );
- DBGC ( hvm, "HVM could not add space %d idx %d at "
- "[%08lx,%08lx): %s\n", space, i,
- ( mmio_phys + ( i * PAGE_SIZE ) ),
- ( mmio_phys + ( ( i + 1 ) * PAGE_SIZE ) ),
- strerror ( rc ) );
- goto err_add_to_physmap;
- }
- }
-
- /* Update offset */
- hvm->mmio_offset += len;
-
- return mmio;
-
- i = pages;
- err_add_to_physmap:
- for ( i-- ; ( signed int ) i >= 0 ; i-- ) {
- remove.domid = DOMID_SELF;
- add.gpfn = ( ( mmio_phys / PAGE_SIZE ) + i );
- xenmem_remove_from_physmap ( &hvm->xen, &remove );
- }
- iounmap ( mmio );
- err_ioremap:
- err_no_space:
- return NULL;
-}
-
-/**
- * Unmap MMIO space
- *
- * @v hvm HVM device
- * @v mmio MMIO space address
- * @v len Length (must be a multiple of PAGE_SIZE)
- */
-static void hvm_iounmap ( struct hvm_device *hvm, void *mmio, size_t len ) {
- struct xen_remove_from_physmap remove;
- physaddr_t mmio_phys = virt_to_phys ( mmio );
- unsigned int pages = ( len / PAGE_SIZE );
- unsigned int i;
- int xenrc;
- int rc;
-
- /* Unmap this space */
- iounmap ( mmio );
-
- /* Remove from physical address space */
- for ( i = 0 ; i < pages ; i++ ) {
- remove.domid = DOMID_SELF;
- remove.gpfn = ( ( mmio_phys / PAGE_SIZE ) + i );
- if ( ( xenrc = xenmem_remove_from_physmap ( &hvm->xen,
- &remove ) ) != 0 ) {
- rc = -EXEN ( xenrc );
- DBGC ( hvm, "HVM could not remove space [%08lx,%08lx): "
- "%s\n", ( mmio_phys + ( i * PAGE_SIZE ) ),
- ( mmio_phys + ( ( i + 1 ) * PAGE_SIZE ) ),
- strerror ( rc ) );
- /* Nothing we can do about this */
- }
- }
-}
-
-/**
- * Map shared info page
- *
- * @v hvm HVM device
- * @ret rc Return status code
- */
-static int hvm_map_shared_info ( struct hvm_device *hvm ) {
- physaddr_t shared_info_phys;
- int rc;
-
- /* Map shared info page */
- hvm->xen.shared = hvm_ioremap ( hvm, XENMAPSPACE_shared_info,
- PAGE_SIZE );
- if ( ! hvm->xen.shared ) {
- rc = -ENOMEM;
- goto err_alloc;
- }
- shared_info_phys = virt_to_phys ( hvm->xen.shared );
- DBGC2 ( hvm, "HVM shared info page at [%#08lx,%#08lx)\n",
- shared_info_phys, ( shared_info_phys + PAGE_SIZE ) );
-
- /* Sanity check */
- DBGC2 ( hvm, "HVM wallclock time is %d\n",
- readl ( &hvm->xen.shared->wc_sec ) );
-
- return 0;
-
- hvm_iounmap ( hvm, hvm->xen.shared, PAGE_SIZE );
- err_alloc:
- return rc;
-}
-
-/**
- * Unmap shared info page
- *
- * @v hvm HVM device
- */
-static void hvm_unmap_shared_info ( struct hvm_device *hvm ) {
-
- /* Unmap shared info page */
- hvm_iounmap ( hvm, hvm->xen.shared, PAGE_SIZE );
-}
-
-/**
- * Map grant table
- *
- * @v hvm HVM device
- * @ret rc Return status code
- */
-static int hvm_map_grant ( struct hvm_device *hvm ) {
- physaddr_t grant_phys;
- int rc;
-
- /* Initialise grant table */
- if ( ( rc = xengrant_init ( &hvm->xen ) ) != 0 ) {
- DBGC ( hvm, "HVM could not initialise grant table: %s\n",
- strerror ( rc ) );
- return rc;
- }
-
- /* Map grant table */
- hvm->xen.grant.table = hvm_ioremap ( hvm, XENMAPSPACE_grant_table,
- hvm->xen.grant.len );
- if ( ! hvm->xen.grant.table )
- return -ENODEV;
-
- grant_phys = virt_to_phys ( hvm->xen.grant.table );
- DBGC2 ( hvm, "HVM mapped grant table at [%08lx,%08lx)\n",
- grant_phys, ( grant_phys + hvm->xen.grant.len ) );
- return 0;
-}
-
-/**
- * Unmap grant table
- *
- * @v hvm HVM device
- */
-static void hvm_unmap_grant ( struct hvm_device *hvm ) {
-
- /* Unmap grant table */
- hvm_iounmap ( hvm, hvm->xen.grant.table, hvm->xen.grant.len );
-}
-
-/**
- * Map XenStore
- *
- * @v hvm HVM device
- * @ret rc Return status code
- */
-static int hvm_map_xenstore ( struct hvm_device *hvm ) {
- uint64_t xenstore_evtchn;
- uint64_t xenstore_pfn;
- physaddr_t xenstore_phys;
- char *name;
- int xenrc;
- int rc;
-
- /* Get XenStore event channel */
- if ( ( xenrc = xen_hvm_get_param ( &hvm->xen, HVM_PARAM_STORE_EVTCHN,
- &xenstore_evtchn ) ) != 0 ) {
- rc = -EXEN ( xenrc );
- DBGC ( hvm, "HVM could not get XenStore event channel: %s\n",
- strerror ( rc ) );
- return rc;
- }
- hvm->xen.store.port = xenstore_evtchn;
-
- /* Get XenStore PFN */
- if ( ( xenrc = xen_hvm_get_param ( &hvm->xen, HVM_PARAM_STORE_PFN,
- &xenstore_pfn ) ) != 0 ) {
- rc = -EXEN ( xenrc );
- DBGC ( hvm, "HVM could not get XenStore PFN: %s\n",
- strerror ( rc ) );
- return rc;
- }
- xenstore_phys = ( xenstore_pfn * PAGE_SIZE );
-
- /* Map XenStore */
- hvm->xen.store.intf = ioremap ( xenstore_phys, PAGE_SIZE );
- if ( ! hvm->xen.store.intf ) {
- DBGC ( hvm, "HVM could not map XenStore at [%08lx,%08lx)\n",
- xenstore_phys, ( xenstore_phys + PAGE_SIZE ) );
- return -ENODEV;
- }
- DBGC2 ( hvm, "HVM mapped XenStore at [%08lx,%08lx) with event port "
- "%d\n", xenstore_phys, ( xenstore_phys + PAGE_SIZE ),
- hvm->xen.store.port );
-
- /* Check that XenStore is working */
- if ( ( rc = xenstore_read ( &hvm->xen, &name, "name", NULL ) ) != 0 ) {
- DBGC ( hvm, "HVM could not read domain name: %s\n",
- strerror ( rc ) );
- return rc;
- }
- DBGC2 ( hvm, "HVM running in domain \"%s\"\n", name );
- free ( name );
-
- return 0;
-}
-
-/**
- * Unmap XenStore
- *
- * @v hvm HVM device
- */
-static void hvm_unmap_xenstore ( struct hvm_device *hvm ) {
-
- /* Unmap XenStore */
- iounmap ( hvm->xen.store.intf );
-}
-
-/**
- * Probe PCI device
- *
- * @v pci PCI device
- * @ret rc Return status code
- */
-static int hvm_probe ( struct pci_device *pci ) {
- struct hvm_device *hvm;
- int rc;
-
- /* Allocate and initialise structure */
- hvm = zalloc ( sizeof ( *hvm ) );
- if ( ! hvm ) {
- rc = -ENOMEM;
- goto err_alloc;
- }
- hvm->mmio = pci_bar_start ( pci, HVM_MMIO_BAR );
- hvm->mmio_len = pci_bar_size ( pci, HVM_MMIO_BAR );
- DBGC2 ( hvm, "HVM has MMIO space [%08lx,%08lx)\n",
- hvm->mmio, ( hvm->mmio + hvm->mmio_len ) );
-
- /* Fix up PCI device */
- adjust_pci_device ( pci );
-
- /* Attach to hypervisor */
- if ( ( rc = hvm_cpuid_base ( hvm ) ) != 0 )
- goto err_cpuid_base;
- if ( ( rc = hvm_map_hypercall ( hvm ) ) != 0 )
- goto err_map_hypercall;
- if ( ( rc = hvm_map_shared_info ( hvm ) ) != 0 )
- goto err_map_shared_info;
- if ( ( rc = hvm_map_grant ( hvm ) ) != 0 )
- goto err_map_grant;
- if ( ( rc = hvm_map_xenstore ( hvm ) ) != 0 )
- goto err_map_xenstore;
-
- /* Probe Xen devices */
- if ( ( rc = xenbus_probe ( &hvm->xen, &pci->dev ) ) != 0 ) {
- DBGC ( hvm, "HVM could not probe Xen bus: %s\n",
- strerror ( rc ) );
- goto err_xenbus_probe;
- }
-
- pci_set_drvdata ( pci, hvm );
- return 0;
-
- xenbus_remove ( &hvm->xen, &pci->dev );
- err_xenbus_probe:
- hvm_unmap_xenstore ( hvm );
- err_map_xenstore:
- hvm_unmap_grant ( hvm );
- err_map_grant:
- hvm_unmap_shared_info ( hvm );
- err_map_shared_info:
- hvm_unmap_hypercall ( hvm );
- err_map_hypercall:
- err_cpuid_base:
- free ( hvm );
- err_alloc:
- return rc;
-}
-
-/**
- * Remove PCI device
- *
- * @v pci PCI device
- */
-static void hvm_remove ( struct pci_device *pci ) {
- struct hvm_device *hvm = pci_get_drvdata ( pci );
-
- xenbus_remove ( &hvm->xen, &pci->dev );
- hvm_unmap_xenstore ( hvm );
- hvm_unmap_grant ( hvm );
- hvm_unmap_shared_info ( hvm );
- hvm_unmap_hypercall ( hvm );
- free ( hvm );
-}
-
-/** PCI device IDs */
-static struct pci_device_id hvm_ids[] = {
- PCI_ROM ( 0x5853, 0x0001, "hvm", "hvm", 0 ),
- PCI_ROM ( 0x5853, 0x0002, "hvm2", "hvm2", 0 ),
-};
-
-/** PCI driver */
-struct pci_driver hvm_driver __pci_driver = {
- .ids = hvm_ids,
- .id_count = ( sizeof ( hvm_ids ) / sizeof ( hvm_ids[0] ) ),
- .probe = hvm_probe,
- .remove = hvm_remove,
-};
-
-/* Drag in objects via hvm_driver */
-REQUIRING_SYMBOL ( hvm_driver );
-
-/* Drag in netfront driver */
-REQUIRE_OBJECT ( netfront );
diff --git a/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.h b/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.h
deleted file mode 100644
index 72ed94f6d..000000000
--- a/qemu/roms/ipxe/src/arch/x86/drivers/xen/hvm.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _HVM_H
-#define _HVM_H
-
-/** @file
- *
- * Xen HVM driver
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <ipxe/xen.h>
-#include <xen/hvm/hvm_op.h>
-#include <xen/hvm/params.h>
-
-/** Minimum CPUID base */
-#define HVM_CPUID_MIN 0x40000000UL
-
-/** Maximum CPUID base */
-#define HVM_CPUID_MAX 0x4000ff00UL
-
-/** Increment between CPUID bases */
-#define HVM_CPUID_STEP 0x00000100UL
-
-/** Magic signature */
-#define HVM_CPUID_MAGIC "XenVMMXenVMM"
-
-/** Get Xen version */
-#define HVM_CPUID_VERSION 1
-
-/** Get number of hypercall pages */
-#define HVM_CPUID_PAGES 2
-
-/** PCI MMIO BAR */
-#define HVM_MMIO_BAR PCI_BASE_ADDRESS_1
-
-/** A Xen HVM device */
-struct hvm_device {
- /** Xen hypervisor */
- struct xen_hypervisor xen;
- /** CPUID base */
- uint32_t cpuid_base;
- /** Length of hypercall table */
- size_t hypercall_len;
- /** MMIO base address */
- unsigned long mmio;
- /** Current offset within MMIO address space */
- size_t mmio_offset;
- /** Length of MMIO address space */
- size_t mmio_len;
-};
-
-/**
- * Get HVM parameter value
- *
- * @v xen Xen hypervisor
- * @v index Parameter index
- * @v value Value to fill in
- * @ret xenrc Xen status code
- */
-static inline int xen_hvm_get_param ( struct xen_hypervisor *xen,
- unsigned int index, uint64_t *value ) {
- struct xen_hvm_param param;
- int xenrc;
-
- param.domid = DOMID_SELF;
- param.index = index;
- xenrc = xen_hypercall_2 ( xen, __HYPERVISOR_hvm_op, HVMOP_get_param,
- virt_to_phys ( &param ) );
- *value = param.value;
- return xenrc;
-}
-
-#endif /* _HVM_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/hci/commands/cpuid_cmd.c b/qemu/roms/ipxe/src/arch/x86/hci/commands/cpuid_cmd.c
deleted file mode 100644
index d73ce2a3e..000000000
--- a/qemu/roms/ipxe/src/arch/x86/hci/commands/cpuid_cmd.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2012 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <stdio.h>
-#include <errno.h>
-#include <getopt.h>
-#include <ipxe/cpuid.h>
-#include <ipxe/command.h>
-#include <ipxe/parseopt.h>
-
-/** @file
- *
- * x86 CPU feature detection command
- *
- */
-
-/** "cpuid" options */
-struct cpuid_options {
- /** Check AMD-defined features (%eax=0x80000001) */
- int amd;
- /** Check features defined via %ecx */
- int ecx;
-};
-
-/** "cpuid" option list */
-static struct option_descriptor cpuid_opts[] = {
- OPTION_DESC ( "ext", 'e', no_argument,
- struct cpuid_options, amd, parse_flag ),
- /* "--amd" retained for backwards compatibility */
- OPTION_DESC ( "amd", 'a', no_argument,
- struct cpuid_options, amd, parse_flag ),
- OPTION_DESC ( "ecx", 'c', no_argument,
- struct cpuid_options, ecx, parse_flag ),
-};
-
-/** "cpuid" command descriptor */
-static struct command_descriptor cpuid_cmd =
- COMMAND_DESC ( struct cpuid_options, cpuid_opts, 1, 1, "<bit>" );
-
-/**
- * The "cpuid" command
- *
- * @v argc Argument count
- * @v argv Argument list
- * @ret rc Return status code
- */
-static int cpuid_exec ( int argc, char **argv ) {
- struct cpuid_options opts;
- struct x86_features features;
- struct x86_feature_registers *feature_regs;
- uint32_t feature_reg;
- unsigned int bit;
- int rc;
-
- /* Parse options */
- if ( ( rc = parse_options ( argc, argv, &cpuid_cmd, &opts ) ) != 0 )
- return rc;
-
- /* Parse bit number */
- if ( ( rc = parse_integer ( argv[optind], &bit ) ) != 0 )
- return rc;
-
- /* Get CPU features */
- x86_features ( &features );
-
- /* Extract relevant feature register */
- feature_regs = ( opts.amd ? &features.amd : &features.intel );
- feature_reg = ( opts.ecx ? feature_regs->ecx : feature_regs->edx );
-
- /* Check presence of specified feature */
- return ( ( feature_reg & ( 1 << bit ) ) ? 0 : -ENOENT );
-}
-
-/** x86 CPU feature detection command */
-struct command cpuid_command __command = {
- .name = "cpuid",
- .exec = cpuid_exec,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/bigint.h b/qemu/roms/ipxe/src/arch/x86/include/bits/bigint.h
deleted file mode 100644
index c9bb6ea45..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/bigint.h
+++ /dev/null
@@ -1,318 +0,0 @@
-#ifndef _BITS_BIGINT_H
-#define _BITS_BIGINT_H
-
-/** @file
- *
- * Big integer support
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <string.h>
-
-/** Element of a big integer */
-typedef uint32_t bigint_element_t;
-
-/**
- * Initialise big integer
- *
- * @v value0 Element 0 of big integer to initialise
- * @v size Number of elements
- * @v data Raw data
- * @v len Length of raw data
- */
-static inline __attribute__ (( always_inline )) void
-bigint_init_raw ( uint32_t *value0, unsigned int size,
- const void *data, size_t len ) {
- long pad_len = ( sizeof ( bigint_t ( size ) ) - len );
- void *discard_D;
- long discard_c;
-
- /* Copy raw data in reverse order, padding with zeros */
- __asm__ __volatile__ ( "\n1:\n\t"
- "movb -1(%2,%1), %%al\n\t"
- "stosb\n\t"
- "loop 1b\n\t"
- "xorl %%eax, %%eax\n\t"
- "mov %3, %1\n\t"
- "rep stosb\n\t"
- : "=&D" ( discard_D ), "=&c" ( discard_c )
- : "r" ( data ), "g" ( pad_len ), "0" ( value0 ),
- "1" ( len )
- : "eax" );
-}
-
-/**
- * Add big integers
- *
- * @v addend0 Element 0 of big integer to add
- * @v value0 Element 0 of big integer to be added to
- * @v size Number of elements
- */
-static inline __attribute__ (( always_inline )) void
-bigint_add_raw ( const uint32_t *addend0, uint32_t *value0,
- unsigned int size ) {
- long index;
- void *discard_S;
- long discard_c;
-
- __asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
- "\n1:\n\t"
- "lodsl\n\t"
- "adcl %%eax, (%3,%0,4)\n\t"
- "inc %0\n\t" /* Does not affect CF */
- "loop 1b\n\t"
- : "=&r" ( index ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
- : "r" ( value0 ), "1" ( addend0 ), "2" ( size )
- : "eax" );
-}
-
-/**
- * Subtract big integers
- *
- * @v subtrahend0 Element 0 of big integer to subtract
- * @v value0 Element 0 of big integer to be subtracted from
- * @v size Number of elements
- */
-static inline __attribute__ (( always_inline )) void
-bigint_subtract_raw ( const uint32_t *subtrahend0, uint32_t *value0,
- unsigned int size ) {
- long index;
- void *discard_S;
- long discard_c;
-
- __asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
- "\n1:\n\t"
- "lodsl\n\t"
- "sbbl %%eax, (%3,%0,4)\n\t"
- "inc %0\n\t" /* Does not affect CF */
- "loop 1b\n\t"
- : "=&r" ( index ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
- : "r" ( value0 ), "1" ( subtrahend0 ),
- "2" ( size )
- : "eax" );
-}
-
-/**
- * Rotate big integer left
- *
- * @v value0 Element 0 of big integer
- * @v size Number of elements
- */
-static inline __attribute__ (( always_inline )) void
-bigint_rol_raw ( uint32_t *value0, unsigned int size ) {
- long index;
- long discard_c;
-
- __asm__ __volatile__ ( "xor %0, %0\n\t" /* Zero %0 and clear CF */
- "\n1:\n\t"
- "rcll $1, (%2,%0,4)\n\t"
- "inc %0\n\t" /* Does not affect CF */
- "loop 1b\n\t"
- : "=&r" ( index ), "=&c" ( discard_c )
- : "r" ( value0 ), "1" ( size ) );
-}
-
-/**
- * Rotate big integer right
- *
- * @v value0 Element 0 of big integer
- * @v size Number of elements
- */
-static inline __attribute__ (( always_inline )) void
-bigint_ror_raw ( uint32_t *value0, unsigned int size ) {
- long discard_c;
-
- __asm__ __volatile__ ( "clc\n\t"
- "\n1:\n\t"
- "rcrl $1, -4(%1,%0,4)\n\t"
- "loop 1b\n\t"
- : "=&c" ( discard_c )
- : "r" ( value0 ), "0" ( size ) );
-}
-
-/**
- * Test if big integer is equal to zero
- *
- * @v value0 Element 0 of big integer
- * @v size Number of elements
- * @ret is_zero Big integer is equal to zero
- */
-static inline __attribute__ (( always_inline, pure )) int
-bigint_is_zero_raw ( const uint32_t *value0, unsigned int size ) {
- void *discard_D;
- long discard_c;
- int result;
-
- __asm__ __volatile__ ( "xor %0, %0\n\t" /* Set ZF */
- "repe scasl\n\t"
- "sete %b0\n\t"
- : "=&a" ( result ), "=&D" ( discard_D ),
- "=&c" ( discard_c )
- : "1" ( value0 ), "2" ( size ) );
- return result;
-}
-
-/**
- * Compare big integers
- *
- * @v value0 Element 0 of big integer
- * @v reference0 Element 0 of reference big integer
- * @v size Number of elements
- * @ret geq Big integer is greater than or equal to the reference
- */
-static inline __attribute__ (( always_inline, pure )) int
-bigint_is_geq_raw ( const uint32_t *value0, const uint32_t *reference0,
- unsigned int size ) {
- const bigint_t ( size ) __attribute__ (( may_alias )) *value =
- ( ( const void * ) value0 );
- const bigint_t ( size ) __attribute__ (( may_alias )) *reference =
- ( ( const void * ) reference0 );
- void *discard_S;
- void *discard_D;
- long discard_c;
- int result;
-
- __asm__ __volatile__ ( "std\n\t"
- "\n1:\n\t"
- "lodsl\n\t"
- "scasl\n\t"
- "loope 1b\n\t"
- "setae %b0\n\t"
- "cld\n\t"
- : "=q" ( result ), "=&S" ( discard_S ),
- "=&D" ( discard_D ), "=&c" ( discard_c )
- : "0" ( 0 ), "1" ( &value->element[ size - 1 ] ),
- "2" ( &reference->element[ size - 1 ] ),
- "3" ( size )
- : "eax" );
- return result;
-}
-
-/**
- * Test if bit is set in big integer
- *
- * @v value0 Element 0 of big integer
- * @v size Number of elements
- * @v bit Bit to test
- * @ret is_set Bit is set
- */
-static inline __attribute__ (( always_inline )) int
-bigint_bit_is_set_raw ( const uint32_t *value0, unsigned int size,
- unsigned int bit ) {
- const bigint_t ( size ) __attribute__ (( may_alias )) *value =
- ( ( const void * ) value0 );
- unsigned int index = ( bit / ( 8 * sizeof ( value->element[0] ) ) );
- unsigned int subindex = ( bit % ( 8 * sizeof ( value->element[0] ) ) );
-
- return ( value->element[index] & ( 1 << subindex ) );
-}
-
-/**
- * Find highest bit set in big integer
- *
- * @v value0 Element 0 of big integer
- * @v size Number of elements
- * @ret max_bit Highest bit set + 1 (or 0 if no bits set)
- */
-static inline __attribute__ (( always_inline )) int
-bigint_max_set_bit_raw ( const uint32_t *value0, unsigned int size ) {
- long discard_c;
- int result;
-
- __asm__ __volatile__ ( "\n1:\n\t"
- "bsrl -4(%2,%1,4), %0\n\t"
- "loopz 1b\n\t"
- "rol %1\n\t" /* Does not affect ZF */
- "rol %1\n\t"
- "leal 1(%k0,%k1,8), %k0\n\t"
- "jnz 2f\n\t"
- "xor %0, %0\n\t"
- "\n2:\n\t"
- : "=&r" ( result ), "=&c" ( discard_c )
- : "r" ( value0 ), "1" ( size ) );
- return result;
-}
-
-/**
- * Grow big integer
- *
- * @v source0 Element 0 of source big integer
- * @v source_size Number of elements in source big integer
- * @v dest0 Element 0 of destination big integer
- * @v dest_size Number of elements in destination big integer
- */
-static inline __attribute__ (( always_inline )) void
-bigint_grow_raw ( const uint32_t *source0, unsigned int source_size,
- uint32_t *dest0, unsigned int dest_size ) {
- long pad_size = ( dest_size - source_size );
- void *discard_D;
- void *discard_S;
- long discard_c;
-
- __asm__ __volatile__ ( "rep movsl\n\t"
- "xorl %%eax, %%eax\n\t"
- "mov %3, %2\n\t"
- "rep stosl\n\t"
- : "=&D" ( discard_D ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
- : "g" ( pad_size ), "0" ( dest0 ),
- "1" ( source0 ), "2" ( source_size )
- : "eax" );
-}
-
-/**
- * Shrink big integer
- *
- * @v source0 Element 0 of source big integer
- * @v source_size Number of elements in source big integer
- * @v dest0 Element 0 of destination big integer
- * @v dest_size Number of elements in destination big integer
- */
-static inline __attribute__ (( always_inline )) void
-bigint_shrink_raw ( const uint32_t *source0, unsigned int source_size __unused,
- uint32_t *dest0, unsigned int dest_size ) {
- void *discard_D;
- void *discard_S;
- long discard_c;
-
- __asm__ __volatile__ ( "rep movsl\n\t"
- : "=&D" ( discard_D ), "=&S" ( discard_S ),
- "=&c" ( discard_c )
- : "0" ( dest0 ), "1" ( source0 ),
- "2" ( dest_size )
- : "eax" );
-}
-
-/**
- * Finalise big integer
- *
- * @v value0 Element 0 of big integer to finalise
- * @v size Number of elements
- * @v out Output buffer
- * @v len Length of output buffer
- */
-static inline __attribute__ (( always_inline )) void
-bigint_done_raw ( const uint32_t *value0, unsigned int size __unused,
- void *out, size_t len ) {
- void *discard_D;
- long discard_c;
-
- /* Copy raw data in reverse order */
- __asm__ __volatile__ ( "\n1:\n\t"
- "movb -1(%2,%1), %%al\n\t"
- "stosb\n\t"
- "loop 1b\n\t"
- : "=&D" ( discard_D ), "=&c" ( discard_c )
- : "r" ( value0 ), "0" ( out ), "1" ( len )
- : "eax" );
-}
-
-extern void bigint_multiply_raw ( const uint32_t *multiplicand0,
- const uint32_t *multiplier0,
- uint32_t *value0, unsigned int size );
-
-#endif /* _BITS_BIGINT_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/endian.h b/qemu/roms/ipxe/src/arch/x86/include/bits/endian.h
deleted file mode 100644
index 85718cfdd..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/endian.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _BITS_ENDIAN_H
-#define _BITS_ENDIAN_H
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#define __BYTE_ORDER __LITTLE_ENDIAN
-
-#endif /* _BITS_ENDIAN_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/errfile.h b/qemu/roms/ipxe/src/arch/x86/include/bits/errfile.h
deleted file mode 100644
index 0d1617d20..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/errfile.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _BITS_ERRFILE_H
-#define _BITS_ERRFILE_H
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/**
- * @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_runtime ( ERRFILE_ARCH | ERRFILE_CORE | 0x00070000 )
-#define ERRFILE_vmware ( ERRFILE_ARCH | ERRFILE_CORE | 0x00080000 )
-#define ERRFILE_guestrpc ( ERRFILE_ARCH | ERRFILE_CORE | 0x00090000 )
-#define ERRFILE_guestinfo ( ERRFILE_ARCH | ERRFILE_CORE | 0x000a0000 )
-#define ERRFILE_apm ( ERRFILE_ARCH | ERRFILE_CORE | 0x000b0000 )
-#define ERRFILE_vesafb ( ERRFILE_ARCH | ERRFILE_CORE | 0x000c0000 )
-#define ERRFILE_int13con ( ERRFILE_ARCH | ERRFILE_CORE | 0x000d0000 )
-
-#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_sdi ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000b0000 )
-#define ERRFILE_initrd ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000c0000 )
-#define ERRFILE_pxe_call ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x000d0000 )
-
-#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 )
-#define ERRFILE_hvm ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00020000 )
-#define ERRFILE_hyperv ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00030000 )
-#define ERRFILE_x86_uart ( ERRFILE_ARCH | ERRFILE_DRIVER | 0x00040000 )
-
-#define ERRFILE_cpuid_cmd ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00000000 )
-#define ERRFILE_cpuid_settings ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00010000 )
-#define ERRFILE_efi_entropy ( ERRFILE_ARCH | ERRFILE_OTHER | 0x00020000 )
-
-/** @} */
-
-#endif /* _BITS_ERRFILE_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/io.h b/qemu/roms/ipxe/src/arch/x86/include/bits/io.h
deleted file mode 100644
index 60c2e3edf..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/io.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BITS_IO_H
-#define _BITS_IO_H
-
-/** @file
- *
- * x86-specific I/O API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/x86_io.h>
-
-#endif /* _BITS_IO_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/linux_api_platform.h b/qemu/roms/ipxe/src/arch/x86/include/bits/linux_api_platform.h
deleted file mode 100644
index 4a9ced5e2..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/linux_api_platform.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _LINUX_API_PLATFORM_H
-#define _LINUX_API_PLATFORM_H
-
-extern int linux_errno;
-
-#endif /* _LINUX_API_PLATFORM_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/pci_io.h b/qemu/roms/ipxe/src/arch/x86/include/bits/pci_io.h
deleted file mode 100644
index b41e562ee..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/pci_io.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _BITS_PCI_IO_H
-#define _BITS_PCI_IO_H
-
-/** @file
- *
- * i386-specific PCI I/O API implementations
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/pcibios.h>
-#include <ipxe/pcidirect.h>
-
-#endif /* _BITS_PCI_IO_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/string.h b/qemu/roms/ipxe/src/arch/x86/include/bits/string.h
deleted file mode 100644
index c26fe30d5..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/string.h
+++ /dev/null
@@ -1,344 +0,0 @@
-#ifndef X86_BITS_STRING_H
-#define X86_BITS_STRING_H
-
-/*
- * 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** @file
- *
- * Optimised string operations
- *
- */
-
-extern void * __memcpy ( void *dest, const void *src, size_t len );
-extern void * __memcpy_reverse ( void *dest, const void *src, size_t len );
-
-/**
- * Copy memory area (where length is a compile-time constant)
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-__constant_memcpy ( void *dest, const void *src, size_t len ) {
- union {
- uint32_t u32[2];
- uint16_t u16[4];
- uint8_t u8[8];
- } __attribute__ (( __may_alias__ )) *dest_u = dest;
- const union {
- uint32_t u32[2];
- uint16_t u16[4];
- uint8_t u8[8];
- } __attribute__ (( __may_alias__ )) *src_u = src;
- const void *esi;
- void *edi;
-
- switch ( len ) {
- case 0 : /* 0 bytes */
- return dest;
- /*
- * Single-register moves; these are always better than a
- * string operation. We can clobber an arbitrary two
- * registers (data, source, dest can re-use source register)
- * instead of being restricted to esi and edi. There's also a
- * much greater potential for optimising with nearby code.
- *
- */
- case 1 : /* 4 bytes */
- dest_u->u8[0] = src_u->u8[0];
- return dest;
- case 2 : /* 6 bytes */
- dest_u->u16[0] = src_u->u16[0];
- return dest;
- case 4 : /* 4 bytes */
- dest_u->u32[0] = src_u->u32[0];
- return dest;
- /*
- * Double-register moves; these are probably still a win.
- *
- */
- case 3 : /* 12 bytes */
- dest_u->u16[0] = src_u->u16[0];
- dest_u->u8[2] = src_u->u8[2];
- return dest;
- case 5 : /* 10 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u8[4] = src_u->u8[4];
- return dest;
- case 6 : /* 12 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u16[2] = src_u->u16[2];
- return dest;
- case 8 : /* 10 bytes */
- dest_u->u32[0] = src_u->u32[0];
- dest_u->u32[1] = src_u->u32[1];
- return dest;
- }
-
- /* Even if we have to load up esi and edi ready for a string
- * operation, we can sometimes save space by using multiple
- * single-byte "movs" operations instead of loading up ecx and
- * using "rep movsb".
- *
- * "load ecx, rep movsb" is 7 bytes, plus an average of 1 byte
- * to allow for saving/restoring ecx 50% of the time.
- *
- * "movsl" and "movsb" are 1 byte each, "movsw" is two bytes.
- * (In 16-bit mode, "movsl" is 2 bytes and "movsw" is 1 byte,
- * but "movsl" moves twice as much data, so it balances out).
- *
- * The cutoff point therefore occurs around 26 bytes; the byte
- * requirements for each method are:
- *
- * len 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
- * #bytes (ecx) 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8
- * #bytes (no ecx) 4 5 6 7 5 6 7 8 6 7 8 9 7 8 9 10
- */
-
- esi = src;
- edi = dest;
-
- if ( len >= 26 )
- return __memcpy ( dest, src, len );
-
- if ( len >= 6*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 5*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 4*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 3*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 2*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( len >= 1*4 )
- __asm__ __volatile__ ( "movsl" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( ( len % 4 ) >= 2 )
- __asm__ __volatile__ ( "movsw" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
- if ( ( len % 2 ) >= 1 )
- __asm__ __volatile__ ( "movsb" : "=&D" ( edi ), "=&S" ( esi )
- : "0" ( edi ), "1" ( esi ) : "memory" );
-
- return dest;
-}
-
-/**
- * Copy memory area
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-memcpy ( void *dest, const void *src, size_t len ) {
- if ( __builtin_constant_p ( len ) ) {
- return __constant_memcpy ( dest, src, len );
- } else {
- return __memcpy ( dest, src, len );
- }
-}
-
-extern void * __memmove ( void *dest, const void *src, size_t len );
-
-/**
- * Copy (possibly overlapping) memory area
- *
- * @v dest Destination address
- * @v src Source address
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-memmove ( void *dest, const void *src, size_t len ) {
- ssize_t offset = ( dest - src );
-
- if ( __builtin_constant_p ( offset ) ) {
- if ( offset <= 0 ) {
- return memcpy ( dest, src, len );
- } else {
- return __memcpy_reverse ( dest, src, len );
- }
- } else {
- return __memmove ( dest, src, len );
- }
-}
-
-/**
- * Fill memory region
- *
- * @v dest Destination address
- * @v fill Fill pattern
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-__memset ( void *dest, int fill, size_t len ) {
- void *discard_D;
- size_t discard_c;
-
- __asm__ __volatile__ ( "rep stosb"
- : "=&D" ( discard_D ), "=&c" ( discard_c )
- : "0" ( dest ), "1" ( len ), "a" ( fill )
- : "memory" );
- return dest;
-}
-
-/**
- * Fill memory region with zero (where length is a compile-time constant)
- *
- * @v dest Destination address
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-__constant_memset_zero ( void *dest, size_t len ) {
- union {
- uint32_t u32[2];
- uint16_t u16[4];
- uint8_t u8[8];
- } __attribute__ (( __may_alias__ )) *dest_u = dest;
- void *edi;
- uint32_t eax;
-
- switch ( len ) {
- case 0 : /* 0 bytes */
- return dest;
-
- /* Single-register moves. Almost certainly better than a
- * string operation. We can avoid clobbering any registers,
- * we can reuse a zero that happens to already be in a
- * register, and we can optimise away the code entirely if the
- * memset() is used to clear a region which then gets
- * immediately overwritten.
- */
- case 1 : /* 3 bytes */
- dest_u->u8[0] = 0;
- return dest;
- case 2: /* 5 bytes */
- dest_u->u16[0] = 0;
- return dest;
- case 4: /* 6 bytes */
- dest_u->u32[0] = 0;
- return dest;
-
- /* Double-register moves. Very probably better than a string
- * operation.
- */
- case 3 : /* 9 bytes */
- dest_u->u16[0] = 0;
- dest_u->u8[2] = 0;
- return dest;
- case 5 : /* 10 bytes */
- dest_u->u32[0] = 0;
- dest_u->u8[4] = 0;
- return dest;
- case 6 : /* 12 bytes */
- dest_u->u32[0] = 0;
- dest_u->u16[2] = 0;
- return dest;
- case 8 : /* 13 bytes */
- dest_u->u32[0] = 0;
- dest_u->u32[1] = 0;
- return dest;
- }
-
- /* As with memcpy(), we can potentially save space by using
- * multiple single-byte "stos" instructions instead of loading
- * up ecx and using "rep stosb".
- *
- * "load ecx, rep movsb" is 7 bytes, plus an average of 1 byte
- * to allow for saving/restoring ecx 50% of the time.
- *
- * "stosl" and "stosb" are 1 byte each, "stosw" is two bytes.
- *
- * The calculations are therefore the same as for memcpy(),
- * giving a cutoff point of around 26 bytes.
- */
-
- edi = dest;
- eax = 0;
-
- if ( len >= 26 )
- return __memset ( dest, 0, len );
-
- if ( len >= 6*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( len >= 5*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( len >= 4*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( len >= 3*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( len >= 2*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( len >= 1*4 )
- __asm__ __volatile__ ( "stosl" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( ( len % 4 ) >= 2 )
- __asm__ __volatile__ ( "stosw" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
- if ( ( len % 2 ) >= 1 )
- __asm__ __volatile__ ( "stosb" : "=&D" ( edi ), "=&a" ( eax )
- : "0" ( edi ), "1" ( eax ) : "memory" );
-
- return dest;
-}
-
-/**
- * Fill memory region
- *
- * @v dest Destination address
- * @v fill Fill pattern
- * @v len Length
- * @ret dest Destination address
- */
-static inline __attribute__ (( always_inline )) void *
-memset ( void *dest, int fill, size_t len ) {
-
- if ( __builtin_constant_p ( fill ) && ( fill == 0 ) &&
- __builtin_constant_p ( len ) ) {
- return __constant_memset_zero ( dest, len );
- } else {
- return __memset ( dest, fill, len );
- }
-}
-
-#endif /* X86_BITS_STRING_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/tcpip.h b/qemu/roms/ipxe/src/arch/x86/include/bits/tcpip.h
deleted file mode 100644
index 5c2baffcf..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/tcpip.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _BITS_TCPIP_H
-#define _BITS_TCPIP_H
-
-/** @file
- *
- * Transport-network layer interface
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-extern uint16_t x86_tcpip_continue_chksum ( uint16_t partial,
- const void *data, size_t len );
-
-#define tcpip_continue_chksum x86_tcpip_continue_chksum
-
-#endif /* _BITS_TCPIP_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/uart.h b/qemu/roms/ipxe/src/arch/x86/include/bits/uart.h
deleted file mode 100644
index e09cd3f4c..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/uart.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _BITS_UART_H
-#define _BITS_UART_H
-
-/** @file
- *
- * 16550-compatible UART
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <ipxe/io.h>
-
-/**
- * Write to UART register
- *
- * @v uart UART
- * @v addr Register address
- * @v data Data
- */
-static inline __attribute__ (( always_inline )) void
-uart_write ( struct uart *uart, unsigned int addr, uint8_t data ) {
- outb ( data, ( uart->base + addr ) );
-}
-
-/**
- * Read from UART register
- *
- * @v uart UART
- * @v addr Register address
- * @ret data Data
- */
-static inline __attribute__ (( always_inline )) uint8_t
-uart_read ( struct uart *uart, unsigned int addr ) {
- return inb ( uart->base + addr );
-}
-
-extern int uart_select ( struct uart *uart, unsigned int port );
-
-#endif /* _BITS_UART_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/bits/xen.h b/qemu/roms/ipxe/src/arch/x86/include/bits/xen.h
deleted file mode 100644
index fc065ea38..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/bits/xen.h
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef _BITS_XEN_H
-#define _BITS_XEN_H
-
-/** @file
- *
- * Xen interface
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/* Hypercall registers */
-#ifdef __x86_64__
-#define XEN_REG1 "rdi"
-#define XEN_REG2 "rsi"
-#define XEN_REG3 "rdx"
-#define XEN_REG4 "r10"
-#define XEN_REG5 "r8"
-#else
-#define XEN_REG1 "ebx"
-#define XEN_REG2 "ecx"
-#define XEN_REG3 "edx"
-#define XEN_REG4 "esi"
-#define XEN_REG5 "edi"
-#endif
-
-/** A hypercall entry point */
-struct xen_hypercall {
- /** Code generated by hypervisor */
- uint8_t code[32];
-} __attribute__ (( packed ));
-
-/**
- * Issue hypercall with one argument
- *
- * @v xen Xen hypervisor
- * @v hypercall Hypercall number
- * @v arg1 First argument
- * @ret retval Return value
- */
-static inline __attribute__ (( always_inline )) unsigned long
-xen_hypercall_1 ( struct xen_hypervisor *xen, unsigned int hypercall,
- unsigned long arg1 ) {
- register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
- unsigned long retval;
-
- __asm__ __volatile__ ( "call *%2"
- : "=a" ( retval ), "+r" ( reg1 )
- : "r" ( &xen->hypercall[hypercall] )
- : XEN_REG2, XEN_REG3, XEN_REG4, XEN_REG5,
- "memory" );
- return retval;
-}
-
-/**
- * Issue hypercall with two arguments
- *
- * @v xen Xen hypervisor
- * @v hypercall Hypercall number
- * @v arg1 First argument
- * @v arg2 Second argument
- * @ret retval Return value
- */
-static inline __attribute__ (( always_inline )) unsigned long
-xen_hypercall_2 ( struct xen_hypervisor *xen, unsigned int hypercall,
- unsigned long arg1, unsigned long arg2 ) {
- register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
- register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
- unsigned long retval;
-
- __asm__ __volatile__ ( "call *%3"
- : "=a" ( retval ), "+r" ( reg1 ), "+r" ( reg2 )
- : "r" ( &xen->hypercall[hypercall] )
- : XEN_REG3, XEN_REG4, XEN_REG5, "memory" );
- return retval;
-}
-
-/**
- * Issue hypercall with three arguments
- *
- * @v xen Xen hypervisor
- * @v hypercall Hypercall number
- * @v arg1 First argument
- * @v arg2 Second argument
- * @v arg3 Third argument
- * @ret retval Return value
- */
-static inline __attribute__ (( always_inline )) unsigned long
-xen_hypercall_3 ( struct xen_hypervisor *xen, unsigned int hypercall,
- unsigned long arg1, unsigned long arg2, unsigned long arg3 ) {
- register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
- register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
- register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
- unsigned long retval;
-
- __asm__ __volatile__ ( "call *%4"
- : "=a" ( retval ), "+r" ( reg1 ), "+r" ( reg2 ),
- "+r" ( reg3 )
- : "r" ( &xen->hypercall[hypercall] )
- : XEN_REG4, XEN_REG5, "memory" );
- return retval;
-}
-
-/**
- * Issue hypercall with four arguments
- *
- * @v xen Xen hypervisor
- * @v hypercall Hypercall number
- * @v arg1 First argument
- * @v arg2 Second argument
- * @v arg3 Third argument
- * @v arg4 Fourth argument
- * @ret retval Return value
- */
-static inline __attribute__ (( always_inline )) unsigned long
-xen_hypercall_4 ( struct xen_hypervisor *xen, unsigned int hypercall,
- unsigned long arg1, unsigned long arg2, unsigned long arg3,
- unsigned long arg4 ) {
- register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
- register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
- register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
- register unsigned long reg4 asm ( XEN_REG4 ) = arg4;
- unsigned long retval;
-
- __asm__ __volatile__ ( "call *%5"
- : "=a" ( retval ), "+r" ( reg1 ), "+r" ( reg2 ),
- "+r" ( reg3 ), "+r" ( reg4 )
- : "r" ( &xen->hypercall[hypercall] )
- : XEN_REG5, "memory" );
- return retval;
-}
-
-/**
- * Issue hypercall with five arguments
- *
- * @v xen Xen hypervisor
- * @v hypercall Hypercall number
- * @v arg1 First argument
- * @v arg2 Second argument
- * @v arg3 Third argument
- * @v arg4 Fourth argument
- * @v arg5 Fifth argument
- * @ret retval Return value
- */
-static inline __attribute__ (( always_inline )) unsigned long
-xen_hypercall_5 ( struct xen_hypervisor *xen, unsigned int hypercall,
- unsigned long arg1, unsigned long arg2, unsigned long arg3,
- unsigned long arg4, unsigned long arg5 ) {
- register unsigned long reg1 asm ( XEN_REG1 ) = arg1;
- register unsigned long reg2 asm ( XEN_REG2 ) = arg2;
- register unsigned long reg3 asm ( XEN_REG3 ) = arg3;
- register unsigned long reg4 asm ( XEN_REG4 ) = arg4;
- register unsigned long reg5 asm ( XEN_REG5 ) = arg5;
- unsigned long retval;
-
- __asm__ __volatile__ ( "call *%6"
- : "=a" ( retval ), "+r" ( reg1 ), "+r" ( reg2 ),
- "+r" ( reg3 ), "+r" ( reg4 ), "+r" ( reg5 )
- : "r" ( &xen->hypercall[hypercall] )
- : "memory" );
- return retval;
-}
-
-/**
- * Test and clear pending event
- *
- * @v xen Xen hypervisor
- * @v port Event channel port
- * @ret pending Event was pending
- */
-static inline __attribute__ (( always_inline )) uint8_t
-xenevent_pending ( struct xen_hypervisor *xen, evtchn_port_t port ) {
- uint8_t pending;
-
- __asm__ __volatile__ ( "lock btr %2, %0\n\t"
- "setc %1\n\t"
- : "+m" ( xen->shared->evtchn_pending ),
- "=a" ( pending )
- : "Ir" ( port ) );
- return pending;
-}
-
-#endif /* _BITS_XEN_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/cpuid.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/cpuid.h
deleted file mode 100644
index da85d0b88..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/cpuid.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _IPXE_CPUID_H
-#define _IPXE_CPUID_H
-
-/** @file
- *
- * x86 CPU feature detection
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-
-/** An x86 CPU feature register set */
-struct x86_feature_registers {
- /** Features returned via %ecx */
- uint32_t ecx;
- /** Features returned via %edx */
- uint32_t edx;
-};
-
-/** x86 CPU features */
-struct x86_features {
- /** Intel-defined features (%eax=0x00000001) */
- struct x86_feature_registers intel;
- /** AMD-defined features (%eax=0x80000001) */
- struct x86_feature_registers amd;
-};
-
-/** CPUID support flag */
-#define CPUID_FLAG 0x00200000UL
-
-/** CPUID extended function */
-#define CPUID_EXTENDED 0x80000000UL
-
-/** Get vendor ID and largest standard function */
-#define CPUID_VENDOR_ID 0x00000000UL
-
-/** Get standard features */
-#define CPUID_FEATURES 0x00000001UL
-
-/** Hypervisor is present */
-#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR 0x80000000UL
-
-/** Get largest extended function */
-#define CPUID_AMD_MAX_FN 0x80000000UL
-
-/** Extended function existence check */
-#define CPUID_AMD_CHECK 0x80000000UL
-
-/** Extended function existence check mask */
-#define CPUID_AMD_CHECK_MASK 0xffff0000UL
-
-/** Get extended features */
-#define CPUID_AMD_FEATURES 0x80000001UL
-
-/** Get CPU model */
-#define CPUID_MODEL 0x80000002UL
-
-/**
- * Issue CPUID instruction
- *
- * @v operation CPUID operation
- * @v eax Output via %eax
- * @v ebx Output via %ebx
- * @v ecx Output via %ecx
- * @v edx Output via %edx
- */
-static inline __attribute__ (( always_inline )) void
-cpuid ( uint32_t operation, uint32_t *eax, uint32_t *ebx, uint32_t *ecx,
- uint32_t *edx ) {
-
- __asm__ ( "cpuid"
- : "=a" ( *eax ), "=b" ( *ebx ), "=c" ( *ecx ), "=d" ( *edx )
- : "0" ( operation ) );
-}
-
-extern int cpuid_is_supported ( void );
-extern void x86_features ( struct x86_features *features );
-
-#endif /* _IPXE_CPUID_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/efi/efix86_nap.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/efi/efix86_nap.h
deleted file mode 100644
index 1a391c9b6..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/efi/efix86_nap.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _IPXE_EFIX86_NAP_H
-#define _IPXE_EFIX86_NAP_H
-
-/** @file
- *
- * EFI CPU sleeping
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#ifdef NAP_EFIX86
-#define NAP_PREFIX_efix86
-#else
-#define NAP_PREFIX_efix86 __efix86_
-#endif
-
-#endif /* _IPXE_EFIX86_NAP_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcibios.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcibios.h
deleted file mode 100644
index 7e1bcd814..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcibios.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef _IPXE_PCIBIOS_H
-#define _IPXE_PCIBIOS_H
-
-#include <stdint.h>
-
-/** @file
- *
- * PCI configuration space access via PCI BIOS
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#ifdef PCIAPI_PCBIOS
-#define PCIAPI_PREFIX_pcbios
-#else
-#define PCIAPI_PREFIX_pcbios __pcbios_
-#endif
-
-struct pci_device;
-
-#define PCIBIOS_INSTALLATION_CHECK 0xb1010000
-#define PCIBIOS_READ_CONFIG_BYTE 0xb1080000
-#define PCIBIOS_READ_CONFIG_WORD 0xb1090000
-#define PCIBIOS_READ_CONFIG_DWORD 0xb10a0000
-#define PCIBIOS_WRITE_CONFIG_BYTE 0xb10b0000
-#define PCIBIOS_WRITE_CONFIG_WORD 0xb10c0000
-#define PCIBIOS_WRITE_CONFIG_DWORD 0xb10d0000
-
-extern int pcibios_read ( struct pci_device *pci, uint32_t command,
- uint32_t *value );
-extern int pcibios_write ( struct pci_device *pci, uint32_t command,
- uint32_t value );
-
-/**
- * Read byte from PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_read_config_byte ) ( struct pci_device *pci,
- unsigned int where,
- uint8_t *value ) {
- uint32_t tmp;
- int rc;
-
- rc = pcibios_read ( pci, PCIBIOS_READ_CONFIG_BYTE | where, &tmp );
- *value = tmp;
- return rc;
-}
-
-/**
- * Read word from PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_read_config_word ) ( struct pci_device *pci,
- unsigned int where,
- uint16_t *value ) {
- uint32_t tmp;
- int rc;
-
- rc = pcibios_read ( pci, PCIBIOS_READ_CONFIG_WORD | where, &tmp );
- *value = tmp;
- return rc;
-}
-
-/**
- * Read dword from PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_read_config_dword ) ( struct pci_device *pci,
- unsigned int where,
- uint32_t *value ) {
- return pcibios_read ( pci, PCIBIOS_READ_CONFIG_DWORD | where, value );
-}
-
-/**
- * Write byte to PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_write_config_byte ) ( struct pci_device *pci,
- unsigned int where,
- uint8_t value ) {
- return pcibios_write ( pci, PCIBIOS_WRITE_CONFIG_BYTE | where, value );
-}
-
-/**
- * Write word to PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_write_config_word ) ( struct pci_device *pci,
- unsigned int where,
- uint16_t value ) {
- return pcibios_write ( pci, PCIBIOS_WRITE_CONFIG_WORD | where, value );
-}
-
-/**
- * Write dword to PCI configuration space via PCI BIOS
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_write_config_dword ) ( struct pci_device *pci,
- unsigned int where,
- uint32_t value ) {
- return pcibios_write ( pci, PCIBIOS_WRITE_CONFIG_DWORD | where, value);
-}
-
-#endif /* _IPXE_PCIBIOS_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcidirect.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcidirect.h
deleted file mode 100644
index d924f2f20..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pcidirect.h
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef _PCIDIRECT_H
-#define _PCIDIRECT_H
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <stdint.h>
-#include <ipxe/io.h>
-
-#ifdef PCIAPI_DIRECT
-#define PCIAPI_PREFIX_direct
-#else
-#define PCIAPI_PREFIX_direct __direct_
-#endif
-
-/** @file
- *
- * PCI configuration space access via Type 1 accesses
- *
- */
-
-#define PCIDIRECT_CONFIG_ADDRESS 0xcf8
-#define PCIDIRECT_CONFIG_DATA 0xcfc
-
-struct pci_device;
-
-extern void pcidirect_prepare ( struct pci_device *pci, int where );
-
-/**
- * Determine number of PCI buses within system
- *
- * @ret num_bus Number of buses
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_num_bus ) ( void ) {
- /* No way to work this out via Type 1 accesses */
- return 0x100;
-}
-
-/**
- * Read byte from PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_read_config_byte ) ( struct pci_device *pci,
- unsigned int where,
- uint8_t *value ) {
- pcidirect_prepare ( pci, where );
- *value = inb ( PCIDIRECT_CONFIG_DATA + ( where & 3 ) );
- return 0;
-}
-
-/**
- * Read word from PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_read_config_word ) ( struct pci_device *pci,
- unsigned int where,
- uint16_t *value ) {
- pcidirect_prepare ( pci, where );
- *value = inw ( PCIDIRECT_CONFIG_DATA + ( where & 2 ) );
- return 0;
-}
-
-/**
- * Read dword from PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value read
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_read_config_dword ) ( struct pci_device *pci,
- unsigned int where,
- uint32_t *value ) {
- pcidirect_prepare ( pci, where );
- *value = inl ( PCIDIRECT_CONFIG_DATA );
- return 0;
-}
-
-/**
- * Write byte to PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_write_config_byte ) ( struct pci_device *pci,
- unsigned int where,
- uint8_t value ) {
- pcidirect_prepare ( pci, where );
- outb ( value, PCIDIRECT_CONFIG_DATA + ( where & 3 ) );
- return 0;
-}
-
-/**
- * Write word to PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_write_config_word ) ( struct pci_device *pci,
- unsigned int where,
- uint16_t value ) {
- pcidirect_prepare ( pci, where );
- outw ( value, PCIDIRECT_CONFIG_DATA + ( where & 2 ) );
- return 0;
-}
-
-/**
- * Write dword to PCI configuration space via Type 1 access
- *
- * @v pci PCI device
- * @v where Location within PCI configuration space
- * @v value Value to be written
- * @ret rc Return status code
- */
-static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_write_config_dword ) ( struct pci_device *pci,
- unsigned int where,
- uint32_t value ) {
- pcidirect_prepare ( pci, where );
- outl ( value, PCIDIRECT_CONFIG_DATA );
- return 0;
-}
-
-#endif /* _PCIDIRECT_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pit8254.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/pit8254.h
deleted file mode 100644
index 00b0ab164..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/pit8254.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _IPXE_PIT8254_H
-#define _IPXE_PIT8254_H
-
-/** @file
- *
- * 8254 Programmable Interval Timer
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-/** IRQ0 channel */
-#define PIT8254_CH_IRQ0 0
-
-/** PC speaker channel */
-#define PIT8254_CH_SPKR 2
-
-/** Timer frequency (1.193182MHz) */
-#define PIT8254_HZ 1193182UL
-
-/** Data port */
-#define PIT8254_DATA(channel) ( 0x40 + (channel) )
-
-/** Mode/command register */
-#define PIT8254_CMD 0x43
-
-/** Select channel */
-#define PIT8254_CMD_CHANNEL(channel) ( (channel) << 6 )
-
-/** Access modes */
-#define PIT8254_CMD_ACCESS_LATCH 0x00 /**< Latch count value command */
-#define PIT8254_CMD_ACCESS_LO 0x10 /**< Low byte only */
-#define PIT8254_CMD_ACCESS_HI 0x20 /**< High byte only */
-#define PIT8254_CMD_ACCESS_LOHI 0x30 /**< Low-byte, high-byte pair */
-
-/* Operating modes */
-#define PIT8254_CMD_OP_TERMINAL 0x00 /**< Interrupt on terminal count */
-#define PIT8254_CMD_OP_ONESHOT 0x02 /**< Hardware re-triggerable one-shot */
-#define PIT8254_CMD_OP_RATE 0x04 /**< Rate generator */
-#define PIT8254_CMD_OP_SQUARE 0x06 /**< Square wave generator */
-#define PIT8254_CMD_OP_SWSTROBE 0x08 /**< Software triggered strobe */
-#define PIT8254_CMD_OP_HWSTROBE 0x0a /**< Hardware triggered strobe */
-#define PIT8254_CMD_OP_RATE2 0x0c /**< Rate generator (duplicate) */
-#define PIT8254_CMD_OP_SQUARE2 0x0e /**< Square wave generator (duplicate)*/
-
-/** Binary mode */
-#define PIT8254_CMD_BINARY 0x00
-
-/** BCD mode */
-#define PIT8254_CMD_BCD 0x01
-
-/** PC speaker control register */
-#define PIT8254_SPKR 0x61
-
-/** PC speaker channel gate */
-#define PIT8254_SPKR_GATE 0x01
-
-/** PC speaker enabled */
-#define PIT8254_SPKR_ENABLE 0x02
-
-/** PC speaker channel output */
-#define PIT8254_SPKR_OUT 0x20
-
-extern void pit8254_speaker_delay ( unsigned int ticks );
-
-/**
- * Delay for a fixed number of microseconds
- *
- * @v usecs Number of microseconds for which to delay
- */
-static inline __attribute__ (( always_inline )) void
-pit8254_udelay ( unsigned long usecs ) {
-
- /* Delays are invariably compile-time constants; force the
- * multiplication and division to take place at compilation
- * time rather than runtime.
- */
- pit8254_speaker_delay ( ( usecs * PIT8254_HZ ) / 1000000 );
-}
-
-#endif /* _IPXE_PIT8254_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/ipxe/x86_io.h b/qemu/roms/ipxe/src/arch/x86/include/ipxe/x86_io.h
deleted file mode 100644
index 5214e9fbb..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/ipxe/x86_io.h
+++ /dev/null
@@ -1,162 +0,0 @@
-#ifndef _IPXE_X86_IO_H
-#define _IPXE_X86_IO_H
-
-/** @file
- *
- * iPXE I/O API for x86
- *
- * x86 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
- * under i386, 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_OR_UBDL );
-
-#ifdef IOAPI_X86
-#define IOAPI_PREFIX_x86
-#else
-#define IOAPI_PREFIX_x86 __x86_
-#endif
-
-/*
- * Memory space mappings
- *
- */
-
-/** Page shift */
-#define PAGE_SHIFT 12
-
-/*
- * 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 ( bus_addr ? phys_to_virt ( bus_addr ) : NULL );
-}
-
-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 native word size
- *
- */
-
-#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 );
-#ifdef __x86_64__
-X86_READX ( readq, uint64_t );
-#endif
-
-#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 );
-#ifdef __x86_64__
-X86_WRITEX ( writeq, uint64_t );
-#endif
-
-/*
- * 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 /* _IPXE_X86_IO_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/include/linux/ipxe/dhcp_arch.h b/qemu/roms/ipxe/src/arch/x86/include/linux/ipxe/dhcp_arch.h
deleted file mode 100644
index d60905f22..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/linux/ipxe/dhcp_arch.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010 Piotr Jaroszyński <p.jaroszynski@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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-#ifndef _LINUX_DHCP_ARCH_H
-#define _LINUX_DHCP_ARCH_H
-
-/** @file
- *
- * Architecture-specific DHCP options
- */
-
-FILE_LICENCE(GPL2_OR_LATER_OR_UBDL);
-
-#include <ipxe/dhcp.h>
-
-// Emulate one of the supported arch-platforms
-#include <arch/i386/include/pcbios/ipxe/dhcp_arch.h>
-//#include <arch/i386/include/efi/ipxe/dhcp_arch.h>
-//#include <arch/x86_64/include/efi/ipxe/dhcp_arch.h>
-
-#endif
diff --git a/qemu/roms/ipxe/src/arch/x86/include/pic8259.h b/qemu/roms/ipxe/src/arch/x86/include/pic8259.h
deleted file mode 100644
index f02e62909..000000000
--- a/qemu/roms/ipxe/src/arch/x86/include/pic8259.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Basic support for controlling the 8259 Programmable Interrupt Controllers.
- *
- * Initially written by Michael Brown (mcb30).
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#ifndef PIC8259_H
-#define PIC8259_H
-
-#include <ipxe/io.h>
-
-#define IRQ_PIC_CUTOFF 8
-
-/* 8259 register locations */
-#define PIC1_ICW1 0x20
-#define PIC1_OCW2 0x20
-#define PIC1_OCW3 0x20
-#define PIC1_ICR 0x20
-#define PIC1_IRR 0x20
-#define PIC1_ISR 0x20
-#define PIC1_ICW2 0x21
-#define PIC1_ICW3 0x21
-#define PIC1_ICW4 0x21
-#define PIC1_IMR 0x21
-#define PIC2_ICW1 0xa0
-#define PIC2_OCW2 0xa0
-#define PIC2_OCW3 0xa0
-#define PIC2_ICR 0xa0
-#define PIC2_IRR 0xa0
-#define PIC2_ISR 0xa0
-#define PIC2_ICW2 0xa1
-#define PIC2_ICW3 0xa1
-#define PIC2_ICW4 0xa1
-#define PIC2_IMR 0xa1
-
-/* Register command values */
-#define OCW3_ID 0x08
-#define OCW3_READ_IRR 0x03
-#define OCW3_READ_ISR 0x02
-#define ICR_EOI_NON_SPECIFIC 0x20
-#define ICR_EOI_NOP 0x40
-#define ICR_EOI_SPECIFIC 0x60
-#define ICR_EOI_SET_PRIORITY 0xc0
-
-/* Macros to enable/disable IRQs */
-#define IMR_REG(x) ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR )
-#define IMR_BIT(x) ( 1 << ( (x) % IRQ_PIC_CUTOFF ) )
-#define irq_enabled(x) ( ( inb ( IMR_REG(x) ) & IMR_BIT(x) ) == 0 )
-#define enable_irq(x) outb ( inb( IMR_REG(x) ) & ~IMR_BIT(x), IMR_REG(x) )
-#define disable_irq(x) outb ( inb( IMR_REG(x) ) | IMR_BIT(x), IMR_REG(x) )
-
-/* Macros for acknowledging IRQs */
-#define ICR_REG( irq ) ( (irq) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR )
-#define ICR_VALUE( irq ) ( (irq) % IRQ_PIC_CUTOFF )
-#define CHAINED_IRQ 2
-
-/* Utility macros to convert IRQ numbers to INT numbers and INT vectors */
-#define IRQ_INT( irq ) ( ( ( (irq) - IRQ_PIC_CUTOFF ) ^ 0x70 ) & 0x7f )
-
-/* Other constants */
-#define IRQ_MAX 15
-#define IRQ_NONE -1U
-
-/* Function prototypes
- */
-void send_eoi ( unsigned int irq );
-
-#endif /* PIC8259_H */
diff --git a/qemu/roms/ipxe/src/arch/x86/interface/efi/efi_entropy.c b/qemu/roms/ipxe/src/arch/x86/interface/efi/efi_entropy.c
deleted file mode 100644
index a54bd12e6..000000000
--- a/qemu/roms/ipxe/src/arch/x86/interface/efi/efi_entropy.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2015 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 (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <errno.h>
-#include <ipxe/entropy.h>
-#include <ipxe/crc32.h>
-#include <ipxe/efi/efi.h>
-#include <ipxe/efi/Protocol/Rng.h>
-
-/** @file
- *
- * EFI entropy source
- *
- */
-
-/** Random number generator protocol */
-static EFI_RNG_PROTOCOL *efirng;
-EFI_REQUEST_PROTOCOL ( EFI_RNG_PROTOCOL, &efirng );
-
-/** Minimum number of bytes to request from RNG
- *
- * The UEFI spec states (for no apparently good reason) that "When a
- * Deterministic Random Bit Generator (DRBG) is used on the output of
- * a (raw) entropy source, its security level must be at least 256
- * bits." The EDK2 codebase (mis)interprets this to mean that the
- * call to GetRNG() should fail if given a buffer less than 32 bytes.
- *
- * Incidentally, nothing in the EFI RNG protocol provides any way to
- * report the actual amount of entropy returned by GetRNG().
- */
-#define EFI_ENTROPY_RNG_LEN 32
-
-/** Time (in 100ns units) to delay waiting for timer tick
- *
- * In theory, UEFI allows us to specify a trigger time of zero to
- * simply wait for the next timer tick. In practice, specifying zero
- * seems to often return immediately, which produces almost no
- * entropy. Specify a delay of 1000ns to try to force an existent
- * delay.
- */
-#define EFI_ENTROPY_TRIGGER_TIME 10
-
-/** Event used to wait for timer tick */
-static EFI_EVENT tick;
-
-/**
- * Enable entropy gathering
- *
- * @ret rc Return status code
- */
-static int efi_entropy_enable ( void ) {
- EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
- EFI_STATUS efirc;
- int rc;
-
- DBGC ( &tick, "ENTROPY %s RNG protocol\n",
- ( efirng ? "has" : "has no" ) );
-
- /* Create timer tick event */
- if ( ( efirc = bs->CreateEvent ( EVT_TIMER, TPL_NOTIFY, NULL, NULL,
- &tick ) ) != 0 ) {
- rc = -EEFI ( efirc );
- DBGC ( &tick, "ENTROPY could not create event: %s\n",
- strerror ( rc ) );
- return rc;
- }
-
- return 0;
-}
-
-/**
- * Disable entropy gathering
- *
- */
-static void efi_entropy_disable ( void ) {
- EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
-
- /* Close timer tick event */
- bs->CloseEvent ( tick );
-}
-
-/**
- * Wait for a timer tick
- *
- * @ret low TSC low-order bits, or negative error
- */
-static int efi_entropy_tick ( void ) {
- EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
- UINTN index;
- uint16_t low;
- uint32_t discard_d;
- EFI_STATUS efirc;
- int rc;
-
- /* Wait for next timer tick */
- if ( ( efirc = bs->SetTimer ( tick, TimerRelative,
- EFI_ENTROPY_TRIGGER_TIME ) ) != 0 ) {
- rc = -EEFI ( efirc );
- DBGC ( &tick, "ENTROPY could not set timer: %s\n",
- strerror ( rc ) );
- return rc;
- }
- if ( ( efirc = bs->WaitForEvent ( 1, &tick, &index ) ) != 0 ) {
- rc = -EEFI ( efirc );
- DBGC ( &tick, "ENTROPY could not wait for timer tick: %s\n",
- strerror ( rc ) );
- return rc;
- }
-
- /* Get current TSC low-order bits */
- __asm__ __volatile__ ( "rdtsc" : "=a" ( low ), "=d" ( discard_d ) );
-
- return low;
-}
-
-/**
- * Get noise sample from timer ticks
- *
- * @ret noise Noise sample
- * @ret rc Return status code
- */
-static int efi_get_noise_ticks ( noise_sample_t *noise ) {
- int before;
- int after;
- int rc;
-
- /* Wait for a timer tick */
- before = efi_entropy_tick();
- if ( before < 0 ) {
- rc = before;
- return rc;
- }
-
- /* Wait for another timer tick */
- after = efi_entropy_tick();
- if ( after < 0 ) {
- rc = after;
- return rc;
- }
-
- /* Use TSC delta as noise sample */
- *noise = ( after - before );
-
- return 0;
-}
-
-/**
- * Get noise sample from RNG protocol
- *
- * @ret noise Noise sample
- * @ret rc Return status code
- */
-static int efi_get_noise_rng ( noise_sample_t *noise ) {
- uint8_t buf[EFI_ENTROPY_RNG_LEN];
- EFI_STATUS efirc;
- int rc;
-
- /* Fail if we have no EFI RNG protocol */
- if ( ! efirng )
- return -ENOTSUP;
-
- /* Get the minimum allowed number of random bytes */
- if ( ( efirc = efirng->GetRNG ( efirng, NULL, EFI_ENTROPY_RNG_LEN,
- buf ) ) != 0 ) {
- rc = -EEFI ( efirc );
- DBGC ( &tick, "ENTROPY could not read from RNG: %s\n",
- strerror ( rc ) );
- return rc;
- }
-
- /* Reduce random bytes to a single noise sample. This seems
- * like overkill, but we have no way of knowing how much
- * entropy is actually present in the bytes returned by the
- * RNG protocol.
- */
- *noise = crc32_le ( 0, buf, sizeof ( buf ) );
-
- return 0;
-}
-
-/**
- * Get noise sample
- *
- * @ret noise Noise sample
- * @ret rc Return status code
- */
-static int efi_get_noise ( noise_sample_t *noise ) {
- int rc;
-
- /* Try RNG first, falling back to timer ticks */
- if ( ( ( rc = efi_get_noise_rng ( noise ) ) != 0 ) &&
- ( ( rc = efi_get_noise_ticks ( noise ) ) != 0 ) )
- return rc;
-
- return 0;
-}
-
-PROVIDE_ENTROPY_INLINE ( efi, min_entropy_per_sample );
-PROVIDE_ENTROPY ( efi, entropy_enable, efi_entropy_enable );
-PROVIDE_ENTROPY ( efi, entropy_disable, efi_entropy_disable );
-PROVIDE_ENTROPY ( efi, get_noise, efi_get_noise );
diff --git a/qemu/roms/ipxe/src/arch/x86/interface/efi/efix86_nap.c b/qemu/roms/ipxe/src/arch/x86/interface/efi/efix86_nap.c
deleted file mode 100644
index 3ebf0bd68..000000000
--- a/qemu/roms/ipxe/src/arch/x86/interface/efi/efix86_nap.c
+++ /dev/null
@@ -1,53 +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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
- * You can also choose to distribute this program under the terms of
- * the Unmodified Binary Distribution Licence (as given in the file
- * COPYING.UBDL), provided that you have satisfied its requirements.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
-
-#include <ipxe/nap.h>
-#include <ipxe/efi/efi.h>
-
-/** @file
- *
- * iPXE CPU sleeping API for EFI
- *
- */
-
-/**
- * Sleep until next interrupt
- *
- */
-static void efix86_cpu_nap ( void ) {
- /*
- * I can't find any EFI API that allows us to put the CPU to
- * sleep. The CpuSleep() function is defined in CpuLib.h, but
- * isn't part of any exposed protocol so we have no way to
- * call it.
- *
- * The EFI shell doesn't seem to bother sleeping the CPU; it
- * just sits there idly burning power.
- *
- */
- __asm__ __volatile__ ( "hlt" );
-}
-
-PROVIDE_NAP ( efix86, cpu_nap, efix86_cpu_nap );
diff --git a/qemu/roms/ipxe/src/arch/x86/prefix/efidrvprefix.c b/qemu/roms/ipxe/src/arch/x86/prefix/efidrvprefix.c
deleted file mode 100644
index 4fbb19ff7..000000000
--- a/qemu/roms/ipxe/src/arch/x86/prefix/efidrvprefix.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdlib.h>
-#include <ipxe/init.h>
-#include <ipxe/device.h>
-#include <ipxe/efi/efi.h>
-#include <ipxe/efi/efi_driver.h>
-
-/**
- * EFI entry point
- *
- * @v image_handle Image handle
- * @v systab System table
- * @ret efirc EFI return status code
- */
-EFI_STATUS EFIAPI _efidrv_start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
- EFI_STATUS efirc;
-
- /* Initialise EFI environment */
- if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
- return efirc;
-
- /* Initialise iPXE environment */
- initialise();
- startup();
-
- return 0;
-}
-
-/**
- * Probe EFI root bus
- *
- * @v rootdev EFI root device
- */
-static int efi_probe ( struct root_device *rootdev __unused ) {
-
- /* Do nothing */
- return 0;
-}
-
-/**
- * Remove EFI root bus
- *
- * @v rootdev EFI root device
- */
-static void efi_remove ( struct root_device *rootdev __unused ) {
-
- efi_driver_disconnect_all();
-}
-
-/** EFI root device driver */
-static struct root_driver efi_root_driver = {
- .probe = efi_probe,
- .remove = efi_remove,
-};
-
-/** EFI root device */
-struct root_device efi_root_device __root_device = {
- .dev = { .name = "EFI" },
- .driver = &efi_root_driver,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/prefix/efiprefix.c b/qemu/roms/ipxe/src/arch/x86/prefix/efiprefix.c
deleted file mode 100644
index 18b931e68..000000000
--- a/qemu/roms/ipxe/src/arch/x86/prefix/efiprefix.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2009 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-#include <stdlib.h>
-#include <errno.h>
-#include <ipxe/device.h>
-#include <ipxe/efi/efi.h>
-#include <ipxe/efi/efi_driver.h>
-#include <ipxe/efi/efi_snp.h>
-#include <ipxe/efi/efi_autoboot.h>
-#include <ipxe/efi/efi_watchdog.h>
-
-/**
- * EFI entry point
- *
- * @v image_handle Image handle
- * @v systab System table
- * @ret efirc EFI return status code
- */
-EFI_STATUS EFIAPI _efi_start ( EFI_HANDLE image_handle,
- EFI_SYSTEM_TABLE *systab ) {
- EFI_STATUS efirc;
- int rc;
-
- /* Initialise EFI environment */
- if ( ( efirc = efi_init ( image_handle, systab ) ) != 0 )
- goto err_init;
-
- /* Record autoboot device (if any) */
- efi_set_autoboot();
-
- /* Claim SNP devices for use by iPXE */
- efi_snp_claim();
-
- /* Start watchdog holdoff timer */
- efi_watchdog_start();
-
- /* Call to main() */
- if ( ( rc = main() ) != 0 ) {
- efirc = EFIRC ( rc );
- goto err_main;
- }
-
- err_main:
- efi_watchdog_stop();
- efi_snp_release();
- efi_loaded_image->Unload ( image_handle );
- efi_driver_reconnect_all();
- err_init:
- return efirc;
-}
-
-/**
- * Probe EFI root bus
- *
- * @v rootdev EFI root device
- */
-static int efi_probe ( struct root_device *rootdev __unused ) {
-
- return efi_driver_connect_all();
-}
-
-/**
- * Remove EFI root bus
- *
- * @v rootdev EFI root device
- */
-static void efi_remove ( struct root_device *rootdev __unused ) {
-
- efi_driver_disconnect_all();
-}
-
-/** EFI root device driver */
-static struct root_driver efi_root_driver = {
- .probe = efi_probe,
- .remove = efi_remove,
-};
-
-/** EFI root device */
-struct root_device efi_root_device __root_device = {
- .dev = { .name = "EFI" },
- .driver = &efi_root_driver,
-};
diff --git a/qemu/roms/ipxe/src/arch/x86/scripts/efi.lds b/qemu/roms/ipxe/src/arch/x86/scripts/efi.lds
deleted file mode 100644
index f1049f24b..000000000
--- a/qemu/roms/ipxe/src/arch/x86/scripts/efi.lds
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- sh -*- */
-
-/*
- * Linker script for EFI images
- *
- */
-
-SECTIONS {
-
- /* The file starts at a virtual address of zero, and sections are
- * contiguous. Each section is aligned to at least _max_align,
- * which defaults to 32. Load addresses are equal to virtual
- * addresses.
- */
-
- _max_align = 32;
-
- /* Allow plenty of space for file headers */
- . = 0x1000;
-
- /*
- * The text section
- *
- */
-
- . = ALIGN ( _max_align );
- .text : {
- _text = .;
- *(.text)
- *(.text.*)
- _etext = .;
- }
-
- /*
- * The rodata section
- *
- */
-
- . = ALIGN ( _max_align );
- .rodata : {
- _rodata = .;
- *(.rodata)
- *(.rodata.*)
- _erodata = .;
- }
-
- /*
- * The data section
- *
- */
-
- . = ALIGN ( _max_align );
- .data : {
- _data = .;
- *(.data)
- *(.data.*)
- KEEP(*(SORT(.tbl.*))) /* Various tables. See include/tables.h */
- KEEP(*(.provided))
- KEEP(*(.provided.*))
- _edata = .;
- }
-
- /*
- * The bss section
- *
- */
-
- . = ALIGN ( _max_align );
- .bss : {
- _bss = .;
- *(.bss)
- *(.bss.*)
- *(COMMON)
- _ebss = .;
- }
-
- /*
- * Weak symbols that need zero values if not otherwise defined
- *
- */
-
- .weak 0x0 : {
- _weak = .;
- *(.weak)
- *(.weak.*)
- _eweak = .;
- }
- _assert = ASSERT ( ( _weak == _eweak ), ".weak is non-zero length" );
-
- /*
- * Dispose of the comment and note sections to make the link map
- * easier to read
- *
- */
-
- /DISCARD/ : {
- *(.comment)
- *(.comment.*)
- *(.note)
- *(.note.*)
- *(.eh_frame)
- *(.eh_frame.*)
- *(.rel)
- *(.rel.*)
- *(.einfo)
- *(.einfo.*)
- *(.discard)
- *(.discard.*)
- }
-}