diff options
author | RajithaY <rajithax.yerrumsetty@intel.com> | 2017-04-25 03:31:15 -0700 |
---|---|---|
committer | Rajitha Yerrumchetty <rajithax.yerrumsetty@intel.com> | 2017-05-22 06:48:08 +0000 |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/ipxe/src/arch/x86/include | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (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/include')
18 files changed, 0 insertions, 1734 deletions
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 */ |