mirror of
https://gitlab.com/qemu-project/ipxe.git
synced 2025-11-03 07:59:06 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7adef776fd |
61
.github/workflows/build.yml
vendored
61
.github/workflows/build.yml
vendored
@ -4,45 +4,14 @@ on: push
|
||||
|
||||
jobs:
|
||||
|
||||
cache:
|
||||
name: Cache
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Cache permissions
|
||||
run: |
|
||||
sudo chown $(id -un) /var/cache/apt/archives
|
||||
- name: Cache packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /var/cache/apt/archives/*.deb
|
||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
apt-cache-
|
||||
- name: Download packages
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y -d -o Acquire::Retries=50 \
|
||||
mtools syslinux isolinux \
|
||||
libc6-dev-i386 valgrind \
|
||||
gcc-arm-none-eabi gcc-aarch64-linux-gnu
|
||||
|
||||
x86:
|
||||
name: x86
|
||||
runs-on: ubuntu-22.04
|
||||
needs: cache
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Cache permissions
|
||||
run: |
|
||||
sudo chown $(id -un) /var/cache/apt/archives
|
||||
- name: Cache packages
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: /var/cache/apt/archives/*.deb
|
||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
@ -63,21 +32,12 @@ jobs:
|
||||
|
||||
arm32:
|
||||
name: ARM32
|
||||
runs-on: ubuntu-22.04
|
||||
needs: cache
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Cache permissions
|
||||
run: |
|
||||
sudo chown $(id -un) /var/cache/apt/archives
|
||||
- name: Cache packages
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: /var/cache/apt/archives/*.deb
|
||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt update
|
||||
@ -92,21 +52,12 @@ jobs:
|
||||
|
||||
arm64:
|
||||
name: ARM64
|
||||
runs-on: ubuntu-22.04
|
||||
needs: cache
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Cache permissions
|
||||
run: |
|
||||
sudo chown $(id -un) /var/cache/apt/archives
|
||||
- name: Cache packages
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: /var/cache/apt/archives/*.deb
|
||||
key: apt-cache-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt update
|
||||
|
||||
4
.github/workflows/coverity.yml
vendored
4
.github/workflows/coverity.yml
vendored
@ -8,10 +8,10 @@ on:
|
||||
jobs:
|
||||
submit:
|
||||
name: Submit
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v2
|
||||
- name: Download Coverity Scan
|
||||
run: |
|
||||
curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
|
||||
|
||||
12
src/arch/arm/include/bits/entropy.h
Normal file
12
src/arch/arm/include/bits/entropy.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef _BITS_ENTROPY_H
|
||||
#define _BITS_ENTROPY_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* ARM-specific entropy API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_ENTROPY_H */
|
||||
@ -9,9 +9,6 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
#include <ipxe/arm_io.h>
|
||||
|
||||
#endif /* _BITS_IO_H */
|
||||
|
||||
@ -20,6 +20,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*
|
||||
*/
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
/*
|
||||
* Physical<->Bus address mappings
|
||||
*
|
||||
|
||||
@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
/** Unprefixed constant operand modifier */
|
||||
#define ASM_NO_PREFIX "c"
|
||||
|
||||
#define __asmcall
|
||||
#define __libgcc
|
||||
|
||||
|
||||
@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
/** Unprefixed constant operand modifier */
|
||||
#define ASM_NO_PREFIX "c"
|
||||
|
||||
#define __asmcall
|
||||
#define __libgcc
|
||||
|
||||
|
||||
@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
/** Unprefixed constant operand modifier */
|
||||
#define ASM_NO_PREFIX "c"
|
||||
|
||||
/** Declare a function with standard calling conventions */
|
||||
#define __asmcall __attribute__ (( cdecl, regparm(0) ))
|
||||
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
# Assembler section type character
|
||||
#
|
||||
ASM_TCHAR := @
|
||||
ASM_TCHAR_OPS := @
|
||||
|
||||
# LoongArch64-specific flags
|
||||
#
|
||||
CFLAGS += -fstrength-reduce -fomit-frame-pointer
|
||||
CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
|
||||
|
||||
# Check if -mno-explicit-relocs is valid
|
||||
ifeq ($(CCTYPE),gcc)
|
||||
MNER_TEST = $(CC) -mno-explicit-relocs -x c -c /dev/null -o /dev/null >/dev/null 2>&1
|
||||
MNER_FLAGS := $(shell $(MNER_TEST) && $(ECHO) '-mno-explicit-relocs')
|
||||
WORKAROUND_CFLAGS += $(MNER_FLAGS)
|
||||
endif
|
||||
|
||||
# EFI requires -fshort-wchar, and nothing else currently uses wchar_t
|
||||
CFLAGS += -fshort-wchar
|
||||
|
||||
# LoongArch64-specific directories containing source files
|
||||
SRCDIRS += arch/loong64/core
|
||||
|
||||
# Include platform-specific Makefile
|
||||
MAKEDEPS += arch/loong64/Makefile.$(PLATFORM)
|
||||
include arch/loong64/Makefile.$(PLATFORM)
|
||||
@ -1,10 +0,0 @@
|
||||
# -*- makefile -*- : Force emacs to use Makefile mode
|
||||
|
||||
# Starting virtual address
|
||||
#
|
||||
LDFLAGS += -Ttext=0x120000000
|
||||
|
||||
# Include generic Linux Makefile
|
||||
#
|
||||
MAKEDEPS += Makefile.linux
|
||||
include Makefile.linux
|
||||
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify 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 uint64_t *multiplicand0,
|
||||
const uint64_t *multiplier0,
|
||||
uint64_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;
|
||||
uint64_t multiplicand_element;
|
||||
uint64_t multiplier_element;
|
||||
uint64_t *result_elements;
|
||||
uint64_t discard_low;
|
||||
uint64_t discard_high;
|
||||
uint64_t discard_temp_low;
|
||||
uint64_t discard_temp_high;
|
||||
|
||||
/* 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__ ( "mul.d %1, %6, %7\n\t"
|
||||
"mulh.du %2, %6, %7\n\t"
|
||||
|
||||
"ld.d %3, %0, 0\n\t"
|
||||
"ld.d %4, %0, 8\n\t"
|
||||
|
||||
"add.d %3, %3, %1\n\t"
|
||||
"sltu $t0, %3, %1\n\t"
|
||||
|
||||
"add.d %4, %4, %2\n\t"
|
||||
"sltu $t1, %4, %2\n\t"
|
||||
|
||||
"add.d %4, %4, $t0\n\t"
|
||||
"sltu $t0, %4, $t0\n\t"
|
||||
"or $t0, $t0, $t1\n\t"
|
||||
|
||||
"st.d %3, %0, 0\n\t"
|
||||
"st.d %4, %0, 8\n\t"
|
||||
|
||||
"addi.d %0, %0, 16\n\t"
|
||||
"beqz $t0, 2f\n"
|
||||
"1:\n\t"
|
||||
"ld.d %3, %0, 0\n\t"
|
||||
"add.d %3, %3, $t0\n\t"
|
||||
"sltu $t0, %3, $t0\n\t"
|
||||
"st.d %3, %0, 0\n\t"
|
||||
"addi.d %0, %0, 8\n\t"
|
||||
"bnez $t0, 1b\n"
|
||||
"2:"
|
||||
: "+r" ( result_elements ),
|
||||
"=&r" ( discard_low ),
|
||||
"=&r" ( discard_high ),
|
||||
"=r" ( discard_temp_low ),
|
||||
"=r" ( discard_temp_high ),
|
||||
"+m" ( *result )
|
||||
: "r" ( multiplicand_element ),
|
||||
"r" ( multiplier_element )
|
||||
: "t0", "t1" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,266 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify 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 loong64_memcpy ( void *dest, const void *src, size_t len ) {
|
||||
void *discard_dest;
|
||||
void *discard_end;
|
||||
const void *discard_src;
|
||||
size_t discard_offset;
|
||||
unsigned long discard_data;
|
||||
unsigned long discard_low;
|
||||
unsigned long discard_high;
|
||||
|
||||
/* If length is too short, then just copy individual bytes.
|
||||
*/
|
||||
if ( len < 16 ) {
|
||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"addi.d %0, %0, -1\n\t"
|
||||
"ldx.b %1, %3, %0\n\t"
|
||||
"stx.b %1, %2, %0\n\t"
|
||||
"bnez %0, 1b\n\t"
|
||||
"\n2:\n\t"
|
||||
: "=&r" ( discard_offset ),
|
||||
"=&r" ( discard_data )
|
||||
: "r" ( dest ), "r" ( src ), "0" ( len )
|
||||
: "memory", "t0" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy 16 bytes at a time: one initial
|
||||
* potentially unaligned access, multiple destination-aligned
|
||||
* accesses, one final potentially unaligned access.
|
||||
*/
|
||||
__asm__ __volatile__ ( "ld.d %3, %1, 0\n\t"
|
||||
"ld.d %4, %1, 8\n\t"
|
||||
"addi.d %1, %1, 16\n\t"
|
||||
"st.d %3, %0, 0\n\t"
|
||||
"st.d %4, %0, 8\n\t"
|
||||
"addi.d %0, %0, 16\n\t"
|
||||
"andi %3, %0, 15\n\t"
|
||||
"sub.d %0, %0, %3\n\t"
|
||||
"sub.d %1, %1, %3\n\t"
|
||||
"addi.d $t0, $zero, 0xf\n\t"
|
||||
"andn %2, %5, $t0\n\t"
|
||||
"b 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"ld.d %3, %1, 0\n\t"
|
||||
"ld.d %4, %1, 8\n\t"
|
||||
"addi.d %1, %1, 16\n\t"
|
||||
"st.d %3, %0, 0\n\t"
|
||||
"st.d %4, %0, 8\n\t"
|
||||
"addi.d %0, %0, 16\n\t"
|
||||
"\n2:\n\t"
|
||||
"bne %0, %2, 1b\n\t"
|
||||
"ld.d %3, %6, -16\n\t"
|
||||
"ld.d %4, %6, -8\n\t"
|
||||
"st.d %3, %5, -16\n\t"
|
||||
"st.d %4, %5, -8\n\t"
|
||||
: "=&r" ( discard_dest ),
|
||||
"=&r" ( discard_src ),
|
||||
"=&r" ( discard_end ),
|
||||
"=&r" ( discard_low ),
|
||||
"=&r" ( discard_high )
|
||||
: "r" ( dest + len ), "r" ( src + len ),
|
||||
"0" ( dest ), "1" ( src )
|
||||
: "memory", "t0" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Zero memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v len Length
|
||||
*/
|
||||
void loong64_bzero ( void *dest, size_t len ) {
|
||||
size_t discard_offset;
|
||||
void *discard_dest;
|
||||
void *discard_end;
|
||||
|
||||
/* If length is too short, then just zero individual bytes.
|
||||
*/
|
||||
if ( len < 16 ) {
|
||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"addi.d %0, %0, -1\n\t"
|
||||
"stx.b $zero, %1, %0\n\t"
|
||||
"bnez %0, 1b\n\t"
|
||||
"\n2:\n\t"
|
||||
: "=&r" ( discard_offset )
|
||||
: "r" ( dest ), "0" ( len )
|
||||
: "memory" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* To zero 16 bytes at a time: one initial
|
||||
* potentially unaligned access, multiple aligned accesses,
|
||||
* one final potentially unaligned access.
|
||||
*/
|
||||
|
||||
__asm__ __volatile__ ( "st.d $zero, %0, 0\n\t"
|
||||
"st.d $zero, %0, 8\n\t"
|
||||
"addi.d %0, %0, 16\n\t"
|
||||
"addi.w $t0, $zero, 15\n\t"
|
||||
"andn %0, %0, $t0\n\t"
|
||||
"addi.w $t0, $zero, 15\n\t"
|
||||
"andn %1, %2, $t0\n\t"
|
||||
"b 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"st.d $zero, %0, 0\n\t"
|
||||
"st.d $zero, %0, 8\n\t"
|
||||
"addi.d %0, %0, 16\n\t"
|
||||
"\n2:\n\t"
|
||||
"bne %0, %1, 1b\n\t"
|
||||
"st.d $zero, %2, -16\n\t"
|
||||
"st.d $zero, %2, -8\n\t"
|
||||
: "=&r" ( discard_dest ),
|
||||
"=&r" ( discard_end )
|
||||
: "r" ( dest + len ), "0" ( dest )
|
||||
: "memory", "t0" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v len Length
|
||||
* @v character Fill character
|
||||
*
|
||||
* The unusual parameter order is to allow for more efficient
|
||||
* tail-calling to loong64_memset() when zeroing a region.
|
||||
*/
|
||||
void loong64_memset ( void *dest, size_t len, int character ) {
|
||||
size_t discard_offset;
|
||||
|
||||
/* Use optimised zeroing code if applicable */
|
||||
if ( character == 0 ) {
|
||||
loong64_bzero ( dest, len );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fill one byte at a time. Calling memset() with a non-zero
|
||||
* value is relatively rare and unlikely to be
|
||||
* performance-critical.
|
||||
*/
|
||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"addi.d %0, %0, -1\n\t"
|
||||
"stx.b %2, %1, %0\n\t"
|
||||
"bnez %0, 1b\n\t"
|
||||
"\n2:\n\t"
|
||||
: "=&r" ( discard_offset )
|
||||
: "r" ( dest ), "r" ( character ), "0" ( len )
|
||||
: "memory" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy (possibly overlapping) memory region forwards
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
*/
|
||||
void loong64_memmove_forwards ( void *dest, const void *src, size_t len ) {
|
||||
void *discard_dest;
|
||||
const void *discard_src;
|
||||
unsigned long discard_data;
|
||||
|
||||
/* Assume memmove() is not performance-critical, and perform a
|
||||
* bytewise copy for simplicity.
|
||||
*/
|
||||
__asm__ __volatile__ ( "b 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"ld.b %2, %1, 0\n\t"
|
||||
"addi.d %1, %1, 1\n\t"
|
||||
"st.b %2, %0, 0\n\t"
|
||||
"addi.d %0, %0, 1\n\t"
|
||||
"\n2:\n\t"
|
||||
"bne %0, %3, 1b\n\t"
|
||||
: "=&r" ( discard_dest ),
|
||||
"=&r" ( discard_src ),
|
||||
"=&r" ( discard_data )
|
||||
: "r" ( dest + len ), "0" ( dest ), "1" ( src )
|
||||
: "memory" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy (possibly overlapping) memory region backwards
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
*/
|
||||
void loong64_memmove_backwards ( void *dest, const void *src, size_t len ) {
|
||||
size_t discard_offset;
|
||||
unsigned long discard_data;
|
||||
|
||||
/* Assume memmove() is not performance-critical, and perform a
|
||||
* bytewise copy for simplicity.
|
||||
*/
|
||||
__asm__ __volatile__ ( "beqz %0, 2f\n\t"
|
||||
"\n1:\n\t"
|
||||
"addi.d %0, %0, -1\n\t"
|
||||
"ldx.b %1, %3, %0\n\t"
|
||||
"stx.b %1, %2, %0\n\t"
|
||||
"bnez %0, 1b\n\t"
|
||||
"\n2:\n\t"
|
||||
: "=&r" ( discard_offset ),
|
||||
"=&r" ( discard_data )
|
||||
: "r" ( dest ), "r" ( src ), "0" ( len )
|
||||
: "memory" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy (possibly overlapping) memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
*/
|
||||
void loong64_memmove ( void *dest, const void *src, size_t len ) {
|
||||
|
||||
if ( dest <= src ) {
|
||||
loong64_memmove_forwards ( dest, src, len );
|
||||
} else {
|
||||
loong64_memmove_backwards ( dest, src, len );
|
||||
}
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
|
||||
|
||||
.section ".note.GNU-stack", "", %progbits
|
||||
.text
|
||||
/*
|
||||
int setjmp(jmp_buf env);
|
||||
*/
|
||||
.globl setjmp
|
||||
.type setjmp, %function
|
||||
setjmp:
|
||||
/* Store registers */
|
||||
st.d $s0, $a0, 0x0
|
||||
st.d $s1, $a0, 0x8
|
||||
st.d $s2, $a0, 0x10
|
||||
st.d $s3, $a0, 0x18
|
||||
st.d $s4, $a0, 0x20
|
||||
st.d $s5, $a0, 0x28
|
||||
st.d $s6, $a0, 0x30
|
||||
st.d $s7, $a0, 0x38
|
||||
st.d $s8, $a0, 0x40
|
||||
st.d $fp, $a0, 0x48
|
||||
st.d $sp, $a0, 0x50
|
||||
st.d $ra, $a0, 0x58
|
||||
|
||||
move $a0, $zero
|
||||
jirl $zero, $ra, 0
|
||||
.size setjmp, . - setjmp
|
||||
|
||||
/*
|
||||
void longjmp(jmp_buf env, int val);
|
||||
*/
|
||||
.globl longjmp
|
||||
.type longjmp, %function
|
||||
longjmp:
|
||||
/* Restore registers */
|
||||
ld.d $s0, $a0, 0x0
|
||||
ld.d $s1, $a0, 0x8
|
||||
ld.d $s2, $a0, 0x10
|
||||
ld.d $s3, $a0, 0x18
|
||||
ld.d $s4, $a0, 0x20
|
||||
ld.d $s5, $a0, 0x28
|
||||
ld.d $s6, $a0, 0x30
|
||||
ld.d $s7, $a0, 0x38
|
||||
ld.d $s8, $a0, 0x40
|
||||
ld.d $fp, $a0, 0x48
|
||||
ld.d $sp, $a0, 0x50
|
||||
ld.d $ra, $a0, 0x58
|
||||
addi.d $a0, $zero, 1 # a0 = 1
|
||||
beqz $a1, .exit # if (a1 == 0); goto L0
|
||||
move $a0, $a1 # a0 = a1
|
||||
.exit:
|
||||
jirl $zero, $ra, 0
|
||||
.size longjmp, . - longjmp
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_ACPI_H
|
||||
#define _BITS_ACPI_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific ACPI API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_ACPI_H */
|
||||
@ -1,336 +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>
|
||||
#include <strings.h>
|
||||
|
||||
/** Element of a big integer */
|
||||
typedef uint64_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 ( uint64_t *value0, unsigned int size,
|
||||
const void *data, size_t len ) {
|
||||
size_t pad_len = ( sizeof ( bigint_t ( size ) ) - len );
|
||||
uint8_t *value_byte = ( ( void * ) value0 );
|
||||
const uint8_t *data_byte = ( data + len );
|
||||
|
||||
/* Copy raw data in reverse order, padding with zeros */
|
||||
while ( len-- )
|
||||
*(value_byte++) = *(--data_byte);
|
||||
while ( pad_len-- )
|
||||
*(value_byte++) = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *addend0, uint64_t *value0,
|
||||
unsigned int size ) {
|
||||
bigint_t ( size ) __attribute__ (( may_alias )) *value =
|
||||
( ( void * ) value0 );
|
||||
uint64_t *discard_addend;
|
||||
uint64_t *discard_value;
|
||||
uint64_t discard_addend_i;
|
||||
uint64_t discard_value_i;
|
||||
unsigned int discard_size;
|
||||
__asm__ __volatile__ ( "move $t0, $zero\n"
|
||||
"1:\n\t"
|
||||
"ld.d %3, %0, 0\n\t"
|
||||
"addi.d %0, %0, 8\n\t"
|
||||
"ld.d %4, %1, 0\n\t"
|
||||
|
||||
"add.d %4, %4, $t0\n\t"
|
||||
"sltu $t0, %4, $t0\n\t"
|
||||
|
||||
"add.d %4, %4, %3\n\t"
|
||||
"sltu $t1, %4, %3\n\t"
|
||||
|
||||
"or $t0, $t0, $t1\n\t"
|
||||
"st.d %4, %1, 0\n\t"
|
||||
"addi.d %1, %1, 8\n\t"
|
||||
"addi.w %2, %2, -1\n\t"
|
||||
"bnez %2, 1b"
|
||||
: "=r" ( discard_addend ),
|
||||
"=r" ( discard_value ),
|
||||
"=r" ( discard_size ),
|
||||
"=r" ( discard_addend_i ),
|
||||
"=r" ( discard_value_i ),
|
||||
"+m" ( *value )
|
||||
: "0" ( addend0 ),
|
||||
"1" ( value0 ),
|
||||
"2" ( size )
|
||||
: "t0", "t1" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *subtrahend0, uint64_t *value0,
|
||||
unsigned int size ) {
|
||||
uint64_t *discard_subtrahend;
|
||||
uint64_t *discard_value;
|
||||
uint64_t discard_subtrahend_i;
|
||||
uint64_t discard_value_i;
|
||||
unsigned int discard_size;
|
||||
unsigned int flag = 0;
|
||||
|
||||
discard_subtrahend = (uint64_t*) subtrahend0;
|
||||
discard_value = value0;
|
||||
discard_size = size;
|
||||
|
||||
do {
|
||||
discard_subtrahend_i = *discard_subtrahend;
|
||||
discard_subtrahend++;
|
||||
discard_value_i = *discard_value;
|
||||
|
||||
discard_value_i = discard_value_i - discard_subtrahend_i - flag;
|
||||
|
||||
if ( *discard_value < (discard_subtrahend_i + flag)) {
|
||||
flag = 1;
|
||||
} else {
|
||||
flag = 0;
|
||||
}
|
||||
|
||||
*discard_value = discard_value_i;
|
||||
|
||||
discard_value++;
|
||||
discard_size -= 1;
|
||||
} while (discard_size != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ( uint64_t *value0, unsigned int size ) {
|
||||
uint64_t *discard_value;
|
||||
uint64_t discard_value_i;
|
||||
unsigned int discard_size;
|
||||
uint64_t current_value_i;
|
||||
unsigned int flag = 0;
|
||||
|
||||
discard_value = value0;
|
||||
discard_size = size;
|
||||
do {
|
||||
discard_value_i = *discard_value;
|
||||
current_value_i = discard_value_i;
|
||||
|
||||
discard_value_i += discard_value_i + flag;
|
||||
|
||||
if (discard_value_i < current_value_i) {
|
||||
flag = 1;
|
||||
} else {
|
||||
flag = 0;
|
||||
}
|
||||
|
||||
*discard_value = discard_value_i;
|
||||
discard_value++;
|
||||
discard_size -= 1;
|
||||
} while ( discard_size != 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ( uint64_t *value0, unsigned int size ) {
|
||||
uint64_t *discard_value;
|
||||
uint64_t discard_value_i;
|
||||
uint64_t discard_value_j;
|
||||
unsigned int discard_size;
|
||||
|
||||
discard_value = value0;
|
||||
discard_size = size;
|
||||
|
||||
discard_value_j = 0;
|
||||
|
||||
do {
|
||||
discard_size -= 1;
|
||||
|
||||
discard_value_i = *(discard_value + discard_size);
|
||||
|
||||
discard_value_j = (discard_value_j << 63) | (discard_value_i >> 1);
|
||||
|
||||
*(discard_value + discard_size) = discard_value_j;
|
||||
|
||||
discard_value_j = discard_value_i;
|
||||
} while ( discard_size > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *value0, unsigned int size ) {
|
||||
const uint64_t *value = value0;
|
||||
uint64_t value_i;
|
||||
|
||||
do {
|
||||
value_i = *(value++);
|
||||
if ( value_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return ( value_i == 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *value0, const uint64_t *reference0,
|
||||
unsigned int size ) {
|
||||
const uint64_t *value = ( value0 + size );
|
||||
const uint64_t *reference = ( reference0 + size );
|
||||
uint64_t value_i;
|
||||
uint64_t reference_i;
|
||||
|
||||
do {
|
||||
value_i = *(--value);
|
||||
reference_i = *(--reference);
|
||||
if ( value_i != reference_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return ( value_i >= reference_i );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_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] & ( 1UL << 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 uint64_t *value0, unsigned int size ) {
|
||||
const uint64_t *value = ( value0 + size );
|
||||
int max_bit = ( 8 * sizeof ( bigint_t ( size ) ) );
|
||||
uint64_t value_i;
|
||||
|
||||
do {
|
||||
value_i = *(--value);
|
||||
max_bit -= ( 64 - fls ( value_i ) );
|
||||
if ( value_i )
|
||||
break;
|
||||
} while ( --size );
|
||||
|
||||
return max_bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *source0, unsigned int source_size,
|
||||
uint64_t *dest0, unsigned int dest_size ) {
|
||||
unsigned int pad_size = ( dest_size - source_size );
|
||||
|
||||
memcpy ( dest0, source0, sizeof ( bigint_t ( source_size ) ) );
|
||||
memset ( ( dest0 + source_size ), 0, sizeof ( bigint_t ( pad_size ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *source0, unsigned int source_size __unused,
|
||||
uint64_t *dest0, unsigned int dest_size ) {
|
||||
|
||||
memcpy ( dest0, source0, sizeof ( bigint_t ( dest_size ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 uint64_t *value0, unsigned int size __unused,
|
||||
void *out, size_t len ) {
|
||||
const uint8_t *value_byte = ( ( const void * ) value0 );
|
||||
uint8_t *out_byte = ( out + len );
|
||||
|
||||
/* Copy raw data in reverse order */
|
||||
while ( len-- )
|
||||
*(--out_byte) = *(value_byte++);
|
||||
}
|
||||
|
||||
extern void bigint_multiply_raw ( const uint64_t *multiplicand0,
|
||||
const uint64_t *multiplier0,
|
||||
uint64_t *value0, unsigned int size );
|
||||
|
||||
#endif /* _BITS_BIGINT_H */
|
||||
@ -1,102 +0,0 @@
|
||||
#ifndef _BITS_BITOPS_H
|
||||
#define _BITS_BITOPS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* loongArch bit operations
|
||||
*
|
||||
* We perform atomic bit set and bit clear operations using "ll"
|
||||
* and "sc". We use the output constraint to inform the
|
||||
* compiler that any memory from the start of the bit field up to and
|
||||
* including the byte containing the bit may be modified. (This is
|
||||
* overkill but shouldn't matter in practice since we're unlikely to
|
||||
* subsequently read other bits from the same bit field.)
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Test and set bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
* @ret old Old value of bit (zero or non-zero)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
test_and_set_bit ( unsigned int bit, volatile void *bits ) {
|
||||
unsigned int index = ( bit / 64 );
|
||||
unsigned int offset = ( bit % 64 );
|
||||
volatile uint64_t *qword = ( ( ( volatile uint64_t * ) bits ) + index );
|
||||
uint64_t mask = ( 1UL << offset );
|
||||
uint64_t old;
|
||||
uint64_t new;
|
||||
|
||||
__asm__ __volatile__ ( "1: \n\t"
|
||||
"ll.d %[old], %[qword] \n\t"
|
||||
"or %[new], %[old], %[mask] \n\t"
|
||||
"sc.d %[new], %[qword] \n\t"
|
||||
"beqz %[new], 1b \n\t"
|
||||
: [old] "=&r" ( old ),
|
||||
[new] "=&r" ( new ),
|
||||
[qword] "+m" ( *qword )
|
||||
: [mask] "r" ( mask )
|
||||
: "cc", "memory");
|
||||
return ( !! ( old & mask ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test and clear bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
* @ret old Old value of bit (zero or non-zero)
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int
|
||||
test_and_clear_bit ( unsigned int bit, volatile void *bits ) {
|
||||
unsigned int index = ( bit / 64 );
|
||||
unsigned int offset = ( bit % 64 );
|
||||
volatile uint64_t *qword = ( ( ( volatile uint64_t * ) bits ) + index );
|
||||
uint64_t mask = ( 1UL << offset );
|
||||
uint64_t old;
|
||||
uint64_t new;
|
||||
|
||||
__asm__ __volatile__ ( "1: \n\t"
|
||||
"ll.d %[old], %[qword] \n\t"
|
||||
"andn %[new], %[old], %[mask] \n\t"
|
||||
"sc.d %[new], %[qword] \n\t"
|
||||
"beqz %[new], 1b \n\t"
|
||||
: [old] "=&r" ( old ),
|
||||
[new] "=&r" ( new ),
|
||||
[qword] "+m" ( *qword )
|
||||
: [mask] "r" ( mask )
|
||||
: "cc", "memory");
|
||||
return ( !! ( old & mask ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
set_bit ( unsigned int bit, volatile void *bits ) {
|
||||
|
||||
test_and_set_bit ( bit, bits );
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear bit atomically
|
||||
*
|
||||
* @v bit Bit to set
|
||||
* @v bits Bit field
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
clear_bit ( unsigned int bit, volatile void *bits ) {
|
||||
|
||||
test_and_clear_bit ( bit, bits );
|
||||
}
|
||||
|
||||
#endif /* _BITS_BITOPS_H */
|
||||
@ -1,47 +0,0 @@
|
||||
#ifndef _BITS_BYTESWAP_H
|
||||
#define _BITS_BYTESWAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Byte-order swapping functions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint16_t
|
||||
__bswap_variable_16 ( uint16_t x ) {
|
||||
__asm__ ( "revb.2h %0, %1" : "=r" ( x ) : "r" ( x ) );
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_16s ( uint16_t *x ) {
|
||||
*x = __bswap_variable_16 ( *x );
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint32_t
|
||||
__bswap_variable_32 ( uint32_t x ) {
|
||||
__asm__ ( "revb.2w %0, %1" : "=r" ( x ) : "r" ( x ) );
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_32s ( uint32_t *x ) {
|
||||
*x = __bswap_variable_32 ( *x );
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline, const )) uint64_t
|
||||
__bswap_variable_64 ( uint64_t x ) {
|
||||
__asm__ ( "revb.d %0, %1" : "=r" ( x ) : "r" ( x ) );
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline __attribute__ (( always_inline )) void
|
||||
__bswap_64s ( uint64_t *x ) {
|
||||
*x = __bswap_variable_64 ( *x );
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1,19 +0,0 @@
|
||||
#ifndef _BITS_COMPILER_H
|
||||
#define _BITS_COMPILER_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Dummy relocation type */
|
||||
#define RELOC_TYPE_NONE R_LARCH_NONE
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
/** Unprefixed constant operand modifier */
|
||||
#define ASM_NO_PREFIX "a"
|
||||
|
||||
#define __asmcall
|
||||
#define __libgcc
|
||||
|
||||
#endif /* ASSEMBLY */
|
||||
|
||||
#endif /*_BITS_COMPILER_H */
|
||||
@ -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 */
|
||||
@ -1,19 +0,0 @@
|
||||
#ifndef _BITS_ERRFILE_H
|
||||
#define _BITS_ERRFILE_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific error file identifiers
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/**
|
||||
* @addtogroup errfile Error file identifiers
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* _BITS_ERRFILE_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_HYPERV_H
|
||||
#define _BITS_HYPERV_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Hyper-V interface
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_HYPERV_H */
|
||||
@ -1,15 +0,0 @@
|
||||
#ifndef _BITS_IO_H
|
||||
#define _BITS_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific I/O API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
#endif /* _BITS_IO_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_IOMAP_H
|
||||
#define _BITS_IOMAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific I/O mapping API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_IOMAP_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_NAP_H
|
||||
#define _BITS_NAP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific CPU sleeping API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_MAP_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_PCI_IO_H
|
||||
#define _BITS_PCI_IO_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific PCI I/O API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_PCI_IO_H */
|
||||
@ -1,28 +0,0 @@
|
||||
#ifndef _BITS_PROFILE_H
|
||||
#define _BITS_PROFILE_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Profiling
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Get profiling timestamp
|
||||
*
|
||||
* @ret timestamp Timestamp
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) uint64_t
|
||||
profile_timestamp ( void ) {
|
||||
uint64_t cycles;
|
||||
|
||||
/* Read cycle counter */
|
||||
__asm__ __volatile__ ( "rdtime.d %0, $zero\n\t" : "=r" ( cycles ) );
|
||||
return cycles;
|
||||
}
|
||||
|
||||
#endif /* _BITS_PROFILE_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_REBOOT_H
|
||||
#define _BITS_REBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific reboot API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_REBOOT_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_SANBOOT_H
|
||||
#define _BITS_SANBOOT_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific sanboot API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_SANBOOT_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_SMBIOS_H
|
||||
#define _BITS_SMBIOS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific SMBIOS API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_SMBIOS_H */
|
||||
@ -1,23 +0,0 @@
|
||||
#ifndef _BITS_STDINT_H
|
||||
#define _BITS_STDINT_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
typedef signed long ssize_t;
|
||||
typedef signed long off_t;
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed long long int64_t;
|
||||
|
||||
typedef unsigned long physaddr_t;
|
||||
typedef unsigned long intptr_t;
|
||||
|
||||
#endif /* _BITS_STDINT_H */
|
||||
@ -1,61 +0,0 @@
|
||||
#ifndef _BITS_STRING_H
|
||||
#define _BITS_STRING_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* String functions
|
||||
*
|
||||
*/
|
||||
|
||||
extern void loong64_bzero ( void *dest, size_t len );
|
||||
extern void loong64_memset ( void *dest, size_t len, int character );
|
||||
extern void loong64_memcpy ( void *dest, const void *src, size_t len );
|
||||
extern void loong64_memmove_forwards ( void *dest, const void *src, size_t len );
|
||||
extern void loong64_memmove_backwards ( void *dest, const void *src, size_t len );
|
||||
extern void loong64_memmove ( void *dest, const void *src, size_t len );
|
||||
|
||||
/**
|
||||
* Fill memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v character Fill character
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memset ( void *dest, int character, size_t len ) {
|
||||
loong64_memset ( dest, len, character );
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memcpy ( void *dest, const void *src, size_t len ) {
|
||||
loong64_memcpy ( dest, src, len );
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy (possibly overlapping) memory region
|
||||
*
|
||||
* @v dest Destination region
|
||||
* @v src Source region
|
||||
* @v len Length
|
||||
* @ret dest Destination region
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) void *
|
||||
memmove ( void *dest, const void *src, size_t len ) {
|
||||
loong64_memmove ( dest, src, len );
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif /* _BITS_STRING_H */
|
||||
@ -1,69 +0,0 @@
|
||||
#ifndef _BITS_STRINGS_H
|
||||
#define _BITS_STRINGS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* String functions
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/**
|
||||
* Find first (i.e. least significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __ffsll ( long long value ){
|
||||
unsigned long long bits = value;
|
||||
unsigned long long lsb;
|
||||
unsigned int lz;
|
||||
|
||||
/* Extract least significant set bit */
|
||||
lsb = ( bits & -bits );
|
||||
|
||||
/* Count number of leading zeroes before LSB */
|
||||
__asm__ ( "clz.d %0, %1" : "=r" ( lz ) : "r" ( lsb ) );
|
||||
|
||||
return ( 64 - lz );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find first (i.e. least significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret lsb Least significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __ffsl ( long value ) {
|
||||
|
||||
return __ffsll ( value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find last (i.e. most significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __flsll ( long long value ){
|
||||
unsigned int lz;
|
||||
|
||||
/* Count number of leading zeroes */
|
||||
__asm__ ( "clz.d %0, %1" : "=r" ( lz ) : "r" ( value ) );
|
||||
|
||||
return ( 64 - lz );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find last (i.e. most significant) set bit
|
||||
*
|
||||
* @v value Value
|
||||
* @ret msb Most significant bit set in value (LSB=1), or zero
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) int __flsl ( long value ) {
|
||||
|
||||
return __flsll ( value );
|
||||
}
|
||||
|
||||
#endif /* _BITS_STRINGS_H */
|
||||
@ -1,19 +0,0 @@
|
||||
#ifndef _BITS_TCPIP_H
|
||||
#define _BITS_TCPIP_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Transport-network layer interface
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
static inline __attribute__ (( always_inline )) uint16_t
|
||||
tcpip_continue_chksum ( uint16_t partial, const void *data, size_t len ) {
|
||||
|
||||
/* Not yet optimised */
|
||||
return generic_tcpip_continue_chksum ( partial, data, len );
|
||||
}
|
||||
|
||||
#endif /* _BITS_TCPIP_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_TIME_H
|
||||
#define _BITS_TIME_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific time API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_TIME_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_UACCESS_H
|
||||
#define _BITS_UACCESS_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific user access API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UACCESS_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_UART_H
|
||||
#define _BITS_UART_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* 16550-compatible UART
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UART_H */
|
||||
@ -1,12 +0,0 @@
|
||||
#ifndef _BITS_UMALLOC_H
|
||||
#define _BITS_UMALLOC_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* LoongArch64-specific user memory allocation API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#endif /* _BITS_UMALLOC_H */
|
||||
@ -1,13 +0,0 @@
|
||||
#ifndef _BITS_XEN_H
|
||||
#define _BITS_XEN_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Xen interface
|
||||
*
|
||||
*/
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/nonxen.h>
|
||||
|
||||
#endif /* _BITS_XEN_H */
|
||||
@ -1,45 +0,0 @@
|
||||
#ifndef GDBMACH_H
|
||||
#define GDBMACH_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* GDB architecture specifics
|
||||
*
|
||||
* This file declares functions for manipulating the machine state and
|
||||
* debugging context.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef unsigned long gdbreg_t;
|
||||
|
||||
/* Register snapshot */
|
||||
enum {
|
||||
/* Not yet implemented */
|
||||
GDBMACH_NREGS,
|
||||
};
|
||||
|
||||
#define GDBMACH_SIZEOF_REGS ( GDBMACH_NREGS * sizeof ( gdbreg_t ) )
|
||||
|
||||
static inline void gdbmach_set_pc ( gdbreg_t *regs, gdbreg_t pc ) {
|
||||
/* Not yet implemented */
|
||||
( void ) regs;
|
||||
( void ) pc;
|
||||
}
|
||||
|
||||
static inline void gdbmach_set_single_step ( gdbreg_t *regs, int step ) {
|
||||
/* Not yet implemented */
|
||||
( void ) regs;
|
||||
( void ) step;
|
||||
}
|
||||
|
||||
static inline void gdbmach_breakpoint ( void ) {
|
||||
/* Not yet implemented */
|
||||
}
|
||||
|
||||
extern int gdbmach_set_breakpoint ( int type, unsigned long addr, size_t len,
|
||||
int enable );
|
||||
extern void gdbmach_init ( void );
|
||||
|
||||
#endif /* GDBMACH_H */
|
||||
@ -1,20 +0,0 @@
|
||||
#ifndef _IPXE_EFI_DHCPARCH_H
|
||||
#define _IPXE_EFI_DHCPARCH_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* DHCP client architecture definitions
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/dhcp.h>
|
||||
|
||||
/** DHCP client architecture */
|
||||
#define DHCP_ARCH_CLIENT_ARCHITECTURE DHCP_CLIENT_ARCHITECTURE_LOONG64
|
||||
|
||||
/** DHCP client network device interface */
|
||||
#define DHCP_ARCH_CLIENT_NDI 1 /* UNDI */ , 3, 10 /* v3.10 */
|
||||
|
||||
#endif /* _IPXE_EFI_DHCPARCH_H */
|
||||
@ -1,53 +0,0 @@
|
||||
#ifndef LIMITS_H
|
||||
#define LIMITS_H 1
|
||||
|
||||
/* Number of bits in a `char' */
|
||||
#define CHAR_BIT 8
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold */
|
||||
#define SCHAR_MIN (-128)
|
||||
#define SCHAR_MAX 127
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* Minimum and maximum values a `char' can hold */
|
||||
#define CHAR_MIN SCHAR_MIN
|
||||
#define CHAR_MAX SCHAR_MAX
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold */
|
||||
#define SHRT_MIN (-32768)
|
||||
#define SHRT_MAX 32767
|
||||
|
||||
/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold */
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
#define INT_MAX 2147483647
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
|
||||
#define UINT_MAX 4294967295U
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold */
|
||||
#define INT_MAX 2147483647
|
||||
#define INT_MIN (-INT_MAX - 1)
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
|
||||
#define UINT_MAX 4294967295U
|
||||
|
||||
/* Minimum and maximum values a `signed long' can hold */
|
||||
#define LONG_MAX 9223372036854775807L
|
||||
#define LONG_MIN (-LONG_MAX - 1L)
|
||||
|
||||
/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
|
||||
#define ULONG_MAX 18446744073709551615UL
|
||||
|
||||
/* Minimum and maximum values a `signed long long' can hold */
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#define LLONG_MIN (-LONG_MAX - 1LL)
|
||||
|
||||
/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
|
||||
#define ULLONG_MAX 18446744073709551615ULL
|
||||
|
||||
#endif /* LIMITS_H */
|
||||
@ -1,31 +0,0 @@
|
||||
#ifndef _SETJMP_H
|
||||
#define _SETJMP_H
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** jump buffer env*/
|
||||
typedef struct {
|
||||
uint64_t s0;
|
||||
uint64_t s1;
|
||||
uint64_t s2;
|
||||
uint64_t s3;
|
||||
uint64_t s4;
|
||||
uint64_t s5;
|
||||
uint64_t s6;
|
||||
uint64_t s7;
|
||||
uint64_t s8;
|
||||
|
||||
uint64_t fp;
|
||||
uint64_t sp;
|
||||
uint64_t ra;
|
||||
} jmp_buf[1];
|
||||
|
||||
extern int __asmcall __attribute__ (( returns_twice ))
|
||||
setjmp ( jmp_buf env );
|
||||
|
||||
extern void __asmcall __attribute__ (( noreturn ))
|
||||
longjmp ( jmp_buf env, int val );
|
||||
|
||||
#endif /* _SETJMP_H */
|
||||
@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 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
|
||||
*
|
||||
* Hardware random number generator
|
||||
*
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <ipxe/cpuid.h>
|
||||
#include <ipxe/entropy.h>
|
||||
#include <ipxe/drbg.h>
|
||||
|
||||
struct entropy_source rdrand_entropy __entropy_source ( ENTROPY_PREFERRED );
|
||||
|
||||
/** Number of times to retry RDRAND instruction */
|
||||
#define RDRAND_RETRY_COUNT 16
|
||||
|
||||
/** Colour for debug messages */
|
||||
#define colour &rdrand_entropy
|
||||
|
||||
/**
|
||||
* Enable entropy gathering
|
||||
*
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int rdrand_entropy_enable ( void ) {
|
||||
struct x86_features features;
|
||||
|
||||
/* Check that RDRAND is supported */
|
||||
x86_features ( &features );
|
||||
if ( ! ( features.intel.ecx & CPUID_FEATURES_INTEL_ECX_RDRAND ) ) {
|
||||
DBGC ( colour, "RDRAND not supported\n" );
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
/* Data returned by RDRAND is theoretically full entropy, up
|
||||
* to a security strength of 128 bits, so assume that each
|
||||
* sample contains exactly 8 bits of entropy.
|
||||
*/
|
||||
if ( DRBG_SECURITY_STRENGTH > 128 )
|
||||
return -ENOTSUP;
|
||||
entropy_init ( &rdrand_entropy, MIN_ENTROPY ( 8.0 ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get noise sample
|
||||
*
|
||||
* @ret noise Noise sample
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int rdrand_get_noise ( noise_sample_t *noise ) {
|
||||
unsigned int result;
|
||||
unsigned int discard_c;
|
||||
unsigned int ok;
|
||||
|
||||
/* Issue RDRAND, retrying until CF is set */
|
||||
__asm__ ( "\n1:\n\t"
|
||||
"rdrand %0\n\t"
|
||||
"sbb %1, %1\n\t"
|
||||
"loopz 1b\n\t"
|
||||
: "=r" ( result ), "=r" ( ok ), "=c" ( discard_c )
|
||||
: "2" ( RDRAND_RETRY_COUNT ) );
|
||||
if ( ! ok ) {
|
||||
DBGC ( colour, "RDRAND failed to become ready\n" );
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
*noise = result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hardware random number generator entropy source */
|
||||
struct entropy_source rdrand_entropy __entropy_source ( ENTROPY_PREFERRED ) = {
|
||||
.name = "rdrand",
|
||||
.enable = rdrand_entropy_enable,
|
||||
.get_noise = rdrand_get_noise,
|
||||
};
|
||||
@ -247,17 +247,19 @@ static void bzimage_update_header ( struct image *image,
|
||||
*
|
||||
* @v image bzImage file
|
||||
* @v bzimg bzImage context
|
||||
* @v cmdline Kernel command line
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int bzimage_parse_cmdline ( struct image *image,
|
||||
struct bzimage_context *bzimg ) {
|
||||
const char *vga;
|
||||
const char *mem;
|
||||
struct bzimage_context *bzimg,
|
||||
char *cmdline ) {
|
||||
char *sep;
|
||||
char *end;
|
||||
char *vga;
|
||||
char *mem;
|
||||
|
||||
/* Look for "vga=" */
|
||||
if ( ( vga = image_argument ( image, "vga=" ) ) ) {
|
||||
if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
|
||||
vga += 4;
|
||||
sep = strchr ( vga, ' ' );
|
||||
if ( sep )
|
||||
*sep = '\0';
|
||||
@ -268,10 +270,10 @@ static int bzimage_parse_cmdline ( struct image *image,
|
||||
} else if ( strcmp ( vga, "ask" ) == 0 ) {
|
||||
bzimg->vid_mode = BZI_VID_MODE_ASK;
|
||||
} else {
|
||||
bzimg->vid_mode = strtoul ( vga, &end, 0 );
|
||||
if ( *end ) {
|
||||
bzimg->vid_mode = strtoul ( vga, &vga, 0 );
|
||||
if ( *vga ) {
|
||||
DBGC ( image, "bzImage %p strange \"vga=\" "
|
||||
"terminator '%c'\n", image, *end );
|
||||
"terminator '%c'\n", image, *vga );
|
||||
}
|
||||
}
|
||||
if ( sep )
|
||||
@ -279,9 +281,10 @@ static int bzimage_parse_cmdline ( struct image *image,
|
||||
}
|
||||
|
||||
/* Look for "mem=" */
|
||||
if ( ( mem = image_argument ( image, "mem=" ) ) ) {
|
||||
bzimg->mem_limit = strtoul ( mem, &end, 0 );
|
||||
switch ( *end ) {
|
||||
if ( ( mem = strstr ( cmdline, "mem=" ) ) ) {
|
||||
mem += 4;
|
||||
bzimg->mem_limit = strtoul ( mem, &mem, 0 );
|
||||
switch ( *mem ) {
|
||||
case 'G':
|
||||
case 'g':
|
||||
bzimg->mem_limit <<= 10;
|
||||
@ -299,7 +302,7 @@ static int bzimage_parse_cmdline ( struct image *image,
|
||||
break;
|
||||
default:
|
||||
DBGC ( image, "bzImage %p strange \"mem=\" "
|
||||
"terminator '%c'\n", image, *end );
|
||||
"terminator '%c'\n", image, *mem );
|
||||
break;
|
||||
}
|
||||
bzimg->mem_limit -= 1;
|
||||
@ -313,10 +316,11 @@ static int bzimage_parse_cmdline ( struct image *image,
|
||||
*
|
||||
* @v image bzImage image
|
||||
* @v bzimg bzImage context
|
||||
* @v cmdline Kernel command line
|
||||
*/
|
||||
static void bzimage_set_cmdline ( struct image *image,
|
||||
struct bzimage_context *bzimg ) {
|
||||
const char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
||||
struct bzimage_context *bzimg,
|
||||
const char *cmdline ) {
|
||||
size_t cmdline_len;
|
||||
|
||||
/* Copy command line down to real-mode portion */
|
||||
@ -355,6 +359,10 @@ static size_t bzimage_load_initrd ( struct image *image,
|
||||
size_t offset;
|
||||
size_t pad_len;
|
||||
|
||||
/* Do not include kernel image itself as an initrd */
|
||||
if ( initrd == image )
|
||||
return 0;
|
||||
|
||||
/* Create cpio header for non-prebuilt images */
|
||||
offset = cpio_header ( initrd, &cpio );
|
||||
|
||||
@ -402,6 +410,10 @@ static int bzimage_check_initrds ( struct image *image,
|
||||
/* Calculate total loaded length of initrds */
|
||||
for_each_image ( initrd ) {
|
||||
|
||||
/* Skip kernel */
|
||||
if ( initrd == image )
|
||||
continue;
|
||||
|
||||
/* Calculate length */
|
||||
len += bzimage_load_initrd ( image, initrd, UNULL );
|
||||
len = bzimage_align ( len );
|
||||
@ -516,6 +528,7 @@ static void bzimage_load_initrds ( struct image *image,
|
||||
*/
|
||||
static int bzimage_exec ( struct image *image ) {
|
||||
struct bzimage_context bzimg;
|
||||
char *cmdline = ( image->cmdline ? image->cmdline : "" );
|
||||
int rc;
|
||||
|
||||
/* Read and parse header from image */
|
||||
@ -538,7 +551,7 @@ static int bzimage_exec ( struct image *image ) {
|
||||
}
|
||||
|
||||
/* Parse command line for bootloader parameters */
|
||||
if ( ( rc = bzimage_parse_cmdline ( image, &bzimg ) ) != 0)
|
||||
if ( ( rc = bzimage_parse_cmdline ( image, &bzimg, cmdline ) ) != 0)
|
||||
return rc;
|
||||
|
||||
/* Check that initrds can be loaded */
|
||||
@ -555,7 +568,7 @@ static int bzimage_exec ( struct image *image ) {
|
||||
bzimg.rm_filesz, bzimg.pm_sz );
|
||||
|
||||
/* Store command line */
|
||||
bzimage_set_cmdline ( image, &bzimg );
|
||||
bzimage_set_cmdline ( image, &bzimg, cmdline );
|
||||
|
||||
/* Prepare for exiting. Must do this before loading initrds,
|
||||
* since loading the initrds will corrupt the external heap.
|
||||
|
||||
@ -204,6 +204,10 @@ static int multiboot_add_modules ( struct image *image, physaddr_t start,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Do not include kernel image itself as a module */
|
||||
if ( module_image == image )
|
||||
continue;
|
||||
|
||||
/* Page-align the module */
|
||||
start = ( ( start + 0xfff ) & ~0xfff );
|
||||
|
||||
|
||||
14
src/arch/x86/include/bits/entropy.h
Normal file
14
src/arch/x86/include/bits/entropy.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef _BITS_ENTROPY_H
|
||||
#define _BITS_ENTROPY_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* x86-specific entropy API implementations
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <ipxe/rtc_entropy.h>
|
||||
|
||||
#endif /* _BITS_ENTROPY_H */
|
||||
@ -28,7 +28,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define ERRFILE_cpuid ( ERRFILE_ARCH | ERRFILE_CORE | 0x00110000 )
|
||||
#define ERRFILE_rdtsc_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00120000 )
|
||||
#define ERRFILE_acpi_timer ( ERRFILE_ARCH | ERRFILE_CORE | 0x00130000 )
|
||||
#define ERRFILE_rdrand ( ERRFILE_ARCH | ERRFILE_CORE | 0x00140000 )
|
||||
|
||||
#define ERRFILE_bootsector ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00000000 )
|
||||
#define ERRFILE_bzimage ( ERRFILE_ARCH | ERRFILE_IMAGE | 0x00010000 )
|
||||
|
||||
@ -9,9 +9,6 @@
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
#include <ipxe/x86_io.h>
|
||||
|
||||
#endif /* _BITS_IO_H */
|
||||
|
||||
@ -39,9 +39,6 @@ struct x86_features {
|
||||
/** Get standard features */
|
||||
#define CPUID_FEATURES 0x00000001UL
|
||||
|
||||
/** RDRAND instruction is supported */
|
||||
#define CPUID_FEATURES_INTEL_ECX_RDRAND 0x40000000UL
|
||||
|
||||
/** Hypervisor is present */
|
||||
#define CPUID_FEATURES_INTEL_ECX_HYPERVISOR 0x80000000UL
|
||||
|
||||
|
||||
62
src/arch/x86/include/ipxe/rtc_entropy.h
Normal file
62
src/arch/x86/include/ipxe/rtc_entropy.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef _IPXE_RTC_ENTROPY_H
|
||||
#define _IPXE_RTC_ENTROPY_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* RTC-based entropy source
|
||||
*
|
||||
*/
|
||||
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef ENTROPY_RTC
|
||||
#define ENTROPY_PREFIX_rtc
|
||||
#else
|
||||
#define ENTROPY_PREFIX_rtc __rtc_
|
||||
#endif
|
||||
|
||||
/**
|
||||
* min-entropy per sample
|
||||
*
|
||||
* @ret min_entropy min-entropy of each sample
|
||||
*/
|
||||
static inline __always_inline min_entropy_t
|
||||
ENTROPY_INLINE ( rtc, min_entropy_per_sample ) ( void ) {
|
||||
|
||||
/* The min-entropy has been measured on several platforms
|
||||
* using the entropy_sample test code. Modelling the samples
|
||||
* as independent, and using a confidence level of 99.99%, the
|
||||
* measurements were as follows:
|
||||
*
|
||||
* qemu-kvm : 7.38 bits
|
||||
* VMware : 7.46 bits
|
||||
* Physical hardware : 2.67 bits
|
||||
*
|
||||
* We choose the lowest of these (2.67 bits) and apply a 50%
|
||||
* safety margin to allow for some potential non-independence
|
||||
* of samples.
|
||||
*/
|
||||
return MIN_ENTROPY ( 1.3 );
|
||||
}
|
||||
|
||||
extern uint8_t rtc_sample ( void );
|
||||
|
||||
/**
|
||||
* Get noise sample
|
||||
*
|
||||
* @ret noise Noise sample
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static inline __always_inline int
|
||||
ENTROPY_INLINE ( rtc, get_noise ) ( noise_sample_t *noise ) {
|
||||
|
||||
/* Get sample */
|
||||
*noise = rtc_sample();
|
||||
|
||||
/* Always successful */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* _IPXE_RTC_ENTROPY_H */
|
||||
@ -28,6 +28,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
*
|
||||
*/
|
||||
|
||||
/** Page shift */
|
||||
#define PAGE_SHIFT 12
|
||||
|
||||
/*
|
||||
* Physical<->Bus address mappings
|
||||
*
|
||||
|
||||
@ -39,14 +39,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <ipxe/cpuid.h>
|
||||
#include <ipxe/entropy.h>
|
||||
|
||||
struct entropy_source rtc_entropy __entropy_source ( ENTROPY_NORMAL );
|
||||
|
||||
/** Maximum time to wait for an RTC interrupt, in milliseconds */
|
||||
#define RTC_MAX_WAIT_MS 100
|
||||
|
||||
/** Number of RTC interrupts to check for */
|
||||
#define RTC_CHECK_COUNT 3
|
||||
|
||||
/** RTC interrupt handler */
|
||||
extern void rtc_isr ( void );
|
||||
|
||||
@ -150,7 +145,6 @@ static void rtc_disable_int ( void ) {
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int rtc_entropy_check ( void ) {
|
||||
unsigned int count = 0;
|
||||
unsigned int i;
|
||||
|
||||
/* Check that RTC interrupts are working */
|
||||
@ -164,18 +158,14 @@ static int rtc_entropy_check ( void ) {
|
||||
"cli\n\t" );
|
||||
|
||||
/* Check for RTC interrupt flag */
|
||||
if ( rtc_flag ) {
|
||||
rtc_flag = 0;
|
||||
if ( ++count >= RTC_CHECK_COUNT )
|
||||
return 0;
|
||||
}
|
||||
if ( rtc_flag )
|
||||
return 0;
|
||||
|
||||
/* Delay */
|
||||
mdelay ( 1 );
|
||||
}
|
||||
|
||||
DBGC ( &rtc_flag, "RTC timed out waiting for interrupt %d/%d\n",
|
||||
( count + 1 ), RTC_CHECK_COUNT );
|
||||
DBGC ( &rtc_flag, "RTC timed out waiting for interrupt\n" );
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
@ -205,21 +195,6 @@ static int rtc_entropy_enable ( void ) {
|
||||
if ( ( rc = rtc_entropy_check() ) != 0 )
|
||||
goto err_check;
|
||||
|
||||
/* The min-entropy has been measured on several platforms
|
||||
* using the entropy_sample test code. Modelling the samples
|
||||
* as independent, and using a confidence level of 99.99%, the
|
||||
* measurements were as follows:
|
||||
*
|
||||
* qemu-kvm : 7.38 bits
|
||||
* VMware : 7.46 bits
|
||||
* Physical hardware : 2.67 bits
|
||||
*
|
||||
* We choose the lowest of these (2.67 bits) and apply a 50%
|
||||
* safety margin to allow for some potential non-independence
|
||||
* of samples.
|
||||
*/
|
||||
entropy_init ( &rtc_entropy, MIN_ENTROPY ( 1.3 ) );
|
||||
|
||||
return 0;
|
||||
|
||||
err_check:
|
||||
@ -243,12 +218,11 @@ static void rtc_entropy_disable ( void ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get noise sample
|
||||
* Measure a single RTC tick
|
||||
*
|
||||
* @ret noise Noise sample
|
||||
* @ret rc Return status code
|
||||
* @ret delta Length of RTC tick (in TSC units)
|
||||
*/
|
||||
static int rtc_get_noise ( noise_sample_t *noise ) {
|
||||
uint8_t rtc_sample ( void ) {
|
||||
uint32_t before;
|
||||
uint32_t after;
|
||||
uint32_t temp;
|
||||
@ -283,14 +257,10 @@ static int rtc_get_noise ( noise_sample_t *noise ) {
|
||||
: "=a" ( after ), "=d" ( before ), "=Q" ( temp )
|
||||
: "2" ( 0 ) );
|
||||
|
||||
*noise = ( after - before );
|
||||
return 0;
|
||||
return ( after - before );
|
||||
}
|
||||
|
||||
/** RTC entropy source */
|
||||
struct entropy_source rtc_entropy __entropy_source ( ENTROPY_NORMAL ) = {
|
||||
.name = "rtc",
|
||||
.enable = rtc_entropy_enable,
|
||||
.disable = rtc_entropy_disable,
|
||||
.get_noise = rtc_get_noise,
|
||||
};
|
||||
PROVIDE_ENTROPY_INLINE ( rtc, min_entropy_per_sample );
|
||||
PROVIDE_ENTROPY ( rtc, entropy_enable, rtc_entropy_enable );
|
||||
PROVIDE_ENTROPY ( rtc, entropy_disable, rtc_entropy_disable );
|
||||
PROVIDE_ENTROPY_INLINE ( rtc, get_noise );
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include <ipxe/uaccess.h>
|
||||
#include <ipxe/process.h>
|
||||
#include <ipxe/netdevice.h>
|
||||
#include <ipxe/malloc.h>
|
||||
#include <realmode.h>
|
||||
#include <pxe.h>
|
||||
|
||||
@ -483,28 +482,3 @@ struct pxe_api_call pxe_udp_api[] __pxe_api_call = {
|
||||
PXE_API_CALL ( PXENV_UDP_READ, pxenv_udp_read,
|
||||
struct s_PXENV_UDP_READ ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Discard some cached PXE UDP data
|
||||
*
|
||||
* @ret discarded Number of cached items discarded
|
||||
*/
|
||||
static unsigned int pxe_udp_discard ( void ) {
|
||||
struct io_buffer *iobuf;
|
||||
unsigned int discarded = 0;
|
||||
|
||||
/* Try to discard the oldest received UDP packet */
|
||||
iobuf = list_first_entry ( &pxe_udp.list, struct io_buffer, list );
|
||||
if ( iobuf ) {
|
||||
list_del ( &iobuf->list );
|
||||
free_iob ( iobuf );
|
||||
discarded++;
|
||||
}
|
||||
|
||||
return discarded;
|
||||
}
|
||||
|
||||
/** PXE UDP cache discarder */
|
||||
struct cache_discarder pxe_udp_discarder __cache_discarder ( CACHE_NORMAL ) = {
|
||||
.discard = pxe_udp_discard,
|
||||
};
|
||||
|
||||
@ -8,9 +8,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#ifndef ASSEMBLY
|
||||
|
||||
/** Unprefixed constant operand modifier */
|
||||
#define ASM_NO_PREFIX "c"
|
||||
|
||||
/** Declare a function with standard calling conventions */
|
||||
#define __asmcall __attribute__ (( regparm(0) ))
|
||||
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You 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 <config/entropy.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Entropy configuration options
|
||||
*
|
||||
*/
|
||||
|
||||
PROVIDE_REQUIRING_SYMBOL();
|
||||
|
||||
/*
|
||||
* Drag in entropy sources
|
||||
*/
|
||||
#ifdef ENTROPY_RTC
|
||||
REQUIRE_OBJECT ( rtc_entropy );
|
||||
#endif
|
||||
#ifdef ENTROPY_EFITICK
|
||||
REQUIRE_OBJECT ( efi_entropy );
|
||||
#endif
|
||||
#ifdef ENTROPY_EFIRNG
|
||||
REQUIRE_OBJECT ( efi_rng );
|
||||
#endif
|
||||
#ifdef ENTROPY_LINUX
|
||||
REQUIRE_OBJECT ( linux_entropy );
|
||||
#endif
|
||||
#ifdef ENTROPY_RDRAND
|
||||
REQUIRE_OBJECT ( rdrand );
|
||||
#endif
|
||||
@ -49,6 +49,3 @@ REQUIRE_OBJECT ( eth_slow );
|
||||
#ifdef NET_PROTO_EAPOL
|
||||
REQUIRE_OBJECT ( eapol );
|
||||
#endif
|
||||
#ifdef NET_PROTO_LLDP
|
||||
REQUIRE_OBJECT ( lldp );
|
||||
#endif
|
||||
|
||||
@ -19,15 +19,13 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define SMBIOS_EFI
|
||||
#define SANBOOT_EFI
|
||||
#define BOFM_EFI
|
||||
#define ENTROPY_EFITICK
|
||||
#define ENTROPY_EFIRNG
|
||||
#define ENTROPY_EFI
|
||||
#define TIME_EFI
|
||||
#define REBOOT_EFI
|
||||
#define ACPI_EFI
|
||||
#define FDT_EFI
|
||||
|
||||
#define NET_PROTO_IPV6 /* IPv6 protocol */
|
||||
#define NET_PROTO_LLDP /* Link Layer Discovery protocol */
|
||||
|
||||
#define DOWNLOAD_PROTO_FILE /* Local filesystem access */
|
||||
|
||||
@ -51,7 +49,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#if defined ( __i386__ ) || defined ( __x86_64__ )
|
||||
#define IOAPI_X86
|
||||
#define NAP_EFIX86
|
||||
#define ENTROPY_RDRAND
|
||||
#define CPUID_CMD /* x86 CPU feature detection command */
|
||||
#define UNSAFE_STD /* Avoid setting direction flag */
|
||||
#endif
|
||||
|
||||
@ -33,8 +33,4 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#define SANBOOT_PROTO_FCP
|
||||
#define SANBOOT_PROTO_HTTP
|
||||
|
||||
#if defined ( __i386__ ) || defined ( __x86_64__ )
|
||||
#define ENTROPY_RDRAND
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_DEFAULTS_LINUX_H */
|
||||
|
||||
@ -20,7 +20,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define SMBIOS_PCBIOS
|
||||
#define SANBOOT_PCBIOS
|
||||
#define ENTROPY_RTC
|
||||
#define ENTROPY_RDRAND
|
||||
#define TIME_RTC
|
||||
#define REBOOT_PCBIOS
|
||||
#define ACPI_RSDP
|
||||
|
||||
@ -40,7 +40,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#define NET_PROTO_STP /* Spanning Tree protocol */
|
||||
#define NET_PROTO_LACP /* Link Aggregation control protocol */
|
||||
#define NET_PROTO_EAPOL /* EAP over LAN protocol */
|
||||
//#define NET_PROTO_LLDP /* Link Layer Discovery protocol */
|
||||
|
||||
/*
|
||||
* PXE support
|
||||
@ -150,7 +149,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
//#define POWEROFF_CMD /* Power off command */
|
||||
//#define IMAGE_TRUST_CMD /* Image trust management commands */
|
||||
//#define PCI_CMD /* PCI commands */
|
||||
//#define PARAM_CMD /* Request parameter commands */
|
||||
//#define PARAM_CMD /* Form parameter commands */
|
||||
//#define NEIGHBOUR_CMD /* Neighbour management commands */
|
||||
//#define PING_CMD /* Ping command */
|
||||
//#define CONSOLE_CMD /* Console command */
|
||||
|
||||
@ -77,12 +77,17 @@ size_t cpio_name_len ( struct image *image ) {
|
||||
*/
|
||||
static void cpio_parse_cmdline ( struct image *image,
|
||||
struct cpio_header *cpio ) {
|
||||
const char *arg;
|
||||
const char *cmdline;
|
||||
char *arg;
|
||||
char *end;
|
||||
unsigned int mode;
|
||||
|
||||
/* Skip image filename */
|
||||
cmdline = ( cpio_name ( image ) + cpio_name_len ( image ) );
|
||||
|
||||
/* Look for "mode=" */
|
||||
if ( ( arg = image_argument ( image, "mode=" ) ) ) {
|
||||
if ( ( arg = strstr ( cmdline, "mode=" ) ) ) {
|
||||
arg += 5;
|
||||
mode = strtoul ( arg, &end, 8 /* Octal for file mode */ );
|
||||
if ( *end && ( *end != ' ' ) ) {
|
||||
DBGC ( image, "CPIO %p strange \"mode=\" "
|
||||
|
||||
@ -27,7 +27,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <libgen.h>
|
||||
@ -312,7 +311,7 @@ void unregister_image ( struct image *image ) {
|
||||
struct image * find_image ( const char *name ) {
|
||||
struct image *image;
|
||||
|
||||
for_each_image ( image ) {
|
||||
list_for_each_entry ( image, &images, list ) {
|
||||
if ( strcmp ( image->name, name ) == 0 )
|
||||
return image;
|
||||
}
|
||||
@ -349,8 +348,9 @@ int image_exec ( struct image *image ) {
|
||||
/* Preserve record of any currently-running image */
|
||||
saved_current_image = current_image;
|
||||
|
||||
/* Take out a temporary reference to the image, so that it
|
||||
* does not get freed when temporarily unregistered.
|
||||
/* Take out a temporary reference to the image. This allows
|
||||
* the image to unregister itself if necessary, without
|
||||
* automatically freeing itself.
|
||||
*/
|
||||
current_image = image_get ( image );
|
||||
|
||||
@ -370,9 +370,6 @@ int image_exec ( struct image *image ) {
|
||||
/* Record boot attempt */
|
||||
syslog ( LOG_NOTICE, "Executing \"%s\"\n", image->name );
|
||||
|
||||
/* Temporarily unregister the image during its execution */
|
||||
unregister_image ( image );
|
||||
|
||||
/* Try executing the image */
|
||||
if ( ( rc = image->type->exec ( image ) ) != 0 ) {
|
||||
DBGC ( image, "IMAGE %s could not execute: %s\n",
|
||||
@ -389,10 +386,6 @@ int image_exec ( struct image *image ) {
|
||||
image->name, strerror ( rc ) );
|
||||
}
|
||||
|
||||
/* Re-register image (unless due to be replaced) */
|
||||
if ( ! image->replacement )
|
||||
register_image ( image );
|
||||
|
||||
/* Pick up replacement image before we drop the original
|
||||
* image's temporary reference. The replacement image must
|
||||
* already be registered, so we don't need to hold a temporary
|
||||
@ -576,33 +569,3 @@ struct image * image_memory ( const char *name, userptr_t data, size_t len ) {
|
||||
err_alloc_image:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find argument within image command line
|
||||
*
|
||||
* @v image Image
|
||||
* @v key Argument search key (including trailing delimiter)
|
||||
* @ret value Argument value, or NULL if not found
|
||||
*/
|
||||
const char * image_argument ( struct image *image, const char *key ) {
|
||||
const char *cmdline = image->cmdline;
|
||||
const char *search;
|
||||
const char *match;
|
||||
const char *next;
|
||||
|
||||
/* Find argument */
|
||||
for ( search = cmdline ; search ; search = next ) {
|
||||
|
||||
/* Find next occurrence, if any */
|
||||
match = strstr ( search, key );
|
||||
if ( ! match )
|
||||
break;
|
||||
next = ( match + strlen ( key ) );
|
||||
|
||||
/* Check preceding delimiter, if any */
|
||||
if ( ( match == cmdline ) || isspace ( match[-1] ) )
|
||||
return next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Request parameters
|
||||
* Form parameters
|
||||
*
|
||||
*/
|
||||
|
||||
@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
static LIST_HEAD ( parameters );
|
||||
|
||||
/**
|
||||
* Free request parameter list
|
||||
* Free form parameter list
|
||||
*
|
||||
* @v refcnt Reference count
|
||||
*/
|
||||
@ -60,7 +60,7 @@ static void free_parameters ( struct refcnt *refcnt ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find request parameter list by name
|
||||
* Find form parameter list by name
|
||||
*
|
||||
* @v name Parameter list name (may be NULL)
|
||||
* @ret params Parameter list, or NULL if not found
|
||||
@ -78,7 +78,7 @@ struct parameters * find_parameters ( const char *name ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create request parameter list
|
||||
* Create form parameter list
|
||||
*
|
||||
* @v name Parameter list name (may be NULL)
|
||||
* @ret params Parameter list, or NULL on failure
|
||||
@ -118,17 +118,15 @@ struct parameters * create_parameters ( const char *name ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add request parameter
|
||||
* Add form parameter
|
||||
*
|
||||
* @v params Parameter list
|
||||
* @v key Parameter key
|
||||
* @v value Parameter value
|
||||
* @v flags Parameter flags
|
||||
* @ret param Parameter, or NULL on failure
|
||||
*/
|
||||
struct parameter * add_parameter ( struct parameters *params,
|
||||
const char *key, const char *value,
|
||||
unsigned int flags ) {
|
||||
const char *key, const char *value ) {
|
||||
struct parameter *param;
|
||||
size_t key_len;
|
||||
size_t value_len;
|
||||
@ -149,14 +147,11 @@ struct parameter * add_parameter ( struct parameters *params,
|
||||
param->key = key_copy;
|
||||
strcpy ( value_copy, value );
|
||||
param->value = value_copy;
|
||||
param->flags = flags;
|
||||
|
||||
/* Add to list of parameters */
|
||||
list_add_tail ( ¶m->list, ¶ms->entries );
|
||||
|
||||
DBGC ( params, "PARAMS \"%s\" added \"%s\"=\"%s\"%s%s\n",
|
||||
params->name, param->key, param->value,
|
||||
( ( param->flags & PARAMETER_FORM ) ? " (form)" : "" ),
|
||||
( ( param->flags & PARAMETER_HEADER ) ? " (header)" : "" ) );
|
||||
DBGC ( params, "PARAMS \"%s\" added \"%s\"=\"%s\"\n",
|
||||
params->name, param->key, param->value );
|
||||
return param;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ int parse_autovivified_setting ( char *text, struct named_setting *setting ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse request parameter list name
|
||||
* Parse form parameter list name
|
||||
*
|
||||
* @v text Text
|
||||
* @ret params Parameter list
|
||||
|
||||
@ -51,33 +51,59 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
__einfo_uniqify ( EINFO_EPIPE, 0x02, "Adaptive proportion test failed" )
|
||||
|
||||
/**
|
||||
* Initialise repetition count test
|
||||
* Calculate cutoff value for the repetition count test
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @ret cutoff Cutoff value
|
||||
*
|
||||
* This is the cutoff value for the Repetition Count Test defined in
|
||||
* ANS X9.82 Part 2 (October 2011 Draft) Section 8.5.2.1.2.
|
||||
*/
|
||||
static void repetition_count_test_init ( struct entropy_source *source ) {
|
||||
struct entropy_repetition_count_test *test =
|
||||
&source->repetition_count_test;
|
||||
static inline __attribute__ (( always_inline )) unsigned int
|
||||
repetition_count_cutoff ( void ) {
|
||||
double max_repetitions;
|
||||
unsigned int cutoff;
|
||||
|
||||
/* Sanity checks */
|
||||
assert ( test->repetition_count == 0 );
|
||||
assert ( test->cutoff > 0 );
|
||||
/* The cutoff formula for the repetition test is:
|
||||
*
|
||||
* C = ( 1 + ( -log2(W) / H_min ) )
|
||||
*
|
||||
* where W is set at 2^(-30) (in ANS X9.82 Part 2 (October
|
||||
* 2011 Draft) Section 8.5.2.1.3.1).
|
||||
*/
|
||||
max_repetitions = ( 1 + ( MIN_ENTROPY ( 30 ) /
|
||||
min_entropy_per_sample() ) );
|
||||
|
||||
/* Round up to a whole number of repetitions. We don't have
|
||||
* the ceil() function available, so do the rounding by hand.
|
||||
*/
|
||||
cutoff = max_repetitions;
|
||||
if ( cutoff < max_repetitions )
|
||||
cutoff++;
|
||||
linker_assert ( ( cutoff >= max_repetitions ), rounding_error );
|
||||
|
||||
/* Floating-point operations are not allowed in iPXE since we
|
||||
* never set up a suitable environment. Abort the build
|
||||
* unless the calculated number of repetitions is a
|
||||
* compile-time constant.
|
||||
*/
|
||||
linker_assert ( __builtin_constant_p ( cutoff ),
|
||||
repetition_count_cutoff_not_constant );
|
||||
|
||||
return cutoff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform repetition count test
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @v sample Noise sample
|
||||
* @ret rc Return status code
|
||||
*
|
||||
* This is the Repetition Count Test defined in ANS X9.82 Part 2
|
||||
* (October 2011 Draft) Section 8.5.2.1.2.
|
||||
*/
|
||||
static int repetition_count_test ( struct entropy_source *source,
|
||||
noise_sample_t sample ) {
|
||||
struct entropy_repetition_count_test *test =
|
||||
&source->repetition_count_test;
|
||||
static int repetition_count_test ( noise_sample_t sample ) {
|
||||
static noise_sample_t most_recent_sample;
|
||||
static unsigned int repetition_count = 0;
|
||||
|
||||
/* A = the most recently seen sample value
|
||||
* B = the number of times that value A has been seen in a row
|
||||
@ -90,71 +116,158 @@ static int repetition_count_test ( struct entropy_source *source,
|
||||
* the initial value of most_recent_sample is treated as being
|
||||
* undefined.)
|
||||
*/
|
||||
if ( ( sample == test->most_recent_sample ) &&
|
||||
( test->repetition_count > 0 ) ) {
|
||||
if ( ( sample == most_recent_sample ) && ( repetition_count > 0 ) ) {
|
||||
|
||||
/* a) If the new sample = A, then B is incremented by one. */
|
||||
test->repetition_count++;
|
||||
repetition_count++;
|
||||
|
||||
/* i. If B >= C, then an error condition is raised
|
||||
* due to a failure of the test
|
||||
*/
|
||||
if ( test->repetition_count >= test->cutoff ) {
|
||||
DBGC ( source, "ENTROPY %s excessively repeated "
|
||||
"value %d (%d/%d)\n", source->name, sample,
|
||||
test->repetition_count, test->cutoff );
|
||||
if ( repetition_count >= repetition_count_cutoff() )
|
||||
return -EPIPE_REPETITION_COUNT_TEST;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* b) Else:
|
||||
* i. A = new sample
|
||||
*/
|
||||
test->most_recent_sample = sample;
|
||||
most_recent_sample = sample;
|
||||
|
||||
/* ii. B = 1 */
|
||||
test->repetition_count = 1;
|
||||
repetition_count = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise adaptive proportion test
|
||||
* Window size for the adaptive proportion test
|
||||
*
|
||||
* @v source Entropy source
|
||||
* ANS X9.82 Part 2 (October 2011 Draft) Section 8.5.2.1.3.1.1 allows
|
||||
* five possible window sizes: 16, 64, 256, 4096 and 65536.
|
||||
*
|
||||
* We expect to generate relatively few (<256) entropy samples during
|
||||
* a typical iPXE run; the use of a large window size would mean that
|
||||
* the test would never complete a single cycle. We use a window size
|
||||
* of 64, which is the smallest window size that permits values of
|
||||
* H_min down to one bit per sample.
|
||||
*/
|
||||
static void adaptive_proportion_test_init ( struct entropy_source *source ) {
|
||||
struct entropy_adaptive_proportion_test *test =
|
||||
&source->adaptive_proportion_test;
|
||||
#define ADAPTIVE_PROPORTION_WINDOW_SIZE 64
|
||||
|
||||
/* Sanity checks */
|
||||
assert ( test->sample_count == 0 );
|
||||
assert ( test->repetition_count == 0 );
|
||||
assert ( test->cutoff > 0 );
|
||||
/**
|
||||
* Combine adaptive proportion test window size and min-entropy
|
||||
*
|
||||
* @v n N (window size)
|
||||
* @v h H (min-entropy)
|
||||
* @ret n_h (N,H) combined value
|
||||
*/
|
||||
#define APC_N_H( n, h ) ( ( (n) << 8 ) | (h) )
|
||||
|
||||
/* Ensure that a new test run starts immediately */
|
||||
test->sample_count = ADAPTIVE_PROPORTION_WINDOW_SIZE;
|
||||
/**
|
||||
* Define a row of the adaptive proportion cutoff table
|
||||
*
|
||||
* @v h H (min-entropy)
|
||||
* @v c16 Cutoff for N=16
|
||||
* @v c64 Cutoff for N=64
|
||||
* @v c256 Cutoff for N=256
|
||||
* @v c4096 Cutoff for N=4096
|
||||
* @v c65536 Cutoff for N=65536
|
||||
*/
|
||||
#define APC_TABLE_ROW( h, c16, c64, c256, c4096, c65536) \
|
||||
case APC_N_H ( 16, h ) : return c16; \
|
||||
case APC_N_H ( 64, h ) : return c64; \
|
||||
case APC_N_H ( 256, h ) : return c256; \
|
||||
case APC_N_H ( 4096, h ) : return c4096; \
|
||||
case APC_N_H ( 65536, h ) : return c65536;
|
||||
|
||||
/** Value used to represent "N/A" in adaptive proportion cutoff table */
|
||||
#define APC_NA 0
|
||||
|
||||
/**
|
||||
* Look up value in adaptive proportion test cutoff table
|
||||
*
|
||||
* @v n N (window size)
|
||||
* @v h H (min-entropy)
|
||||
* @ret cutoff Cutoff
|
||||
*
|
||||
* This is the table of cutoff values defined in ANS X9.82 Part 2
|
||||
* (October 2011 Draft) Section 8.5.2.1.3.1.2.
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned int
|
||||
adaptive_proportion_cutoff_lookup ( unsigned int n, unsigned int h ) {
|
||||
switch ( APC_N_H ( n, h ) ) {
|
||||
APC_TABLE_ROW ( 1, APC_NA, 51, 168, 2240, 33537 );
|
||||
APC_TABLE_ROW ( 2, APC_NA, 35, 100, 1193, 17053 );
|
||||
APC_TABLE_ROW ( 3, 10, 24, 61, 643, 8705 );
|
||||
APC_TABLE_ROW ( 4, 8, 16, 38, 354, 4473 );
|
||||
APC_TABLE_ROW ( 5, 6, 12, 25, 200, 2321 );
|
||||
APC_TABLE_ROW ( 6, 5, 9, 17, 117, 1220 );
|
||||
APC_TABLE_ROW ( 7, 4, 7, 15, 71, 653 );
|
||||
APC_TABLE_ROW ( 8, 4, 5, 9, 45, 358 );
|
||||
APC_TABLE_ROW ( 9, 3, 4, 7, 30, 202 );
|
||||
APC_TABLE_ROW ( 10, 3, 4, 5, 21, 118 );
|
||||
APC_TABLE_ROW ( 11, 2, 3, 4, 15, 71 );
|
||||
APC_TABLE_ROW ( 12, 2, 3, 4, 11, 45 );
|
||||
APC_TABLE_ROW ( 13, 2, 2, 3, 9, 30 );
|
||||
APC_TABLE_ROW ( 14, 2, 2, 3, 7, 21 );
|
||||
APC_TABLE_ROW ( 15, 1, 2, 2, 6, 15 );
|
||||
APC_TABLE_ROW ( 16, 1, 2, 2, 5, 11 );
|
||||
APC_TABLE_ROW ( 17, 1, 1, 2, 4, 9 );
|
||||
APC_TABLE_ROW ( 18, 1, 1, 2, 4, 7 );
|
||||
APC_TABLE_ROW ( 19, 1, 1, 1, 3, 6 );
|
||||
APC_TABLE_ROW ( 20, 1, 1, 1, 3, 5 );
|
||||
default:
|
||||
return APC_NA;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate cutoff value for the adaptive proportion test
|
||||
*
|
||||
* @ret cutoff Cutoff value
|
||||
*
|
||||
* This is the cutoff value for the Adaptive Proportion Test defined
|
||||
* in ANS X9.82 Part 2 (October 2011 Draft) Section 8.5.2.1.3.1.2.
|
||||
*/
|
||||
static inline __attribute__ (( always_inline )) unsigned int
|
||||
adaptive_proportion_cutoff ( void ) {
|
||||
unsigned int h;
|
||||
unsigned int n;
|
||||
unsigned int cutoff;
|
||||
|
||||
/* Look up cutoff value in cutoff table */
|
||||
n = ADAPTIVE_PROPORTION_WINDOW_SIZE;
|
||||
h = ( min_entropy_per_sample() / MIN_ENTROPY_SCALE );
|
||||
cutoff = adaptive_proportion_cutoff_lookup ( n, h );
|
||||
|
||||
/* Fail unless cutoff value is a build-time constant */
|
||||
linker_assert ( __builtin_constant_p ( cutoff ),
|
||||
adaptive_proportion_cutoff_not_constant );
|
||||
|
||||
/* Fail if cutoff value is N/A */
|
||||
linker_assert ( ( cutoff != APC_NA ),
|
||||
adaptive_proportion_cutoff_not_applicable );
|
||||
|
||||
return cutoff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform adaptive proportion test
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @v sample Noise sample
|
||||
* @ret rc Return status code
|
||||
*
|
||||
* This is the Adaptive Proportion Test for the Most Common Value
|
||||
* defined in ANS X9.82 Part 2 (October 2011 Draft) Section 8.5.2.1.3.
|
||||
*/
|
||||
static int adaptive_proportion_test ( struct entropy_source *source,
|
||||
noise_sample_t sample ) {
|
||||
struct entropy_adaptive_proportion_test *test =
|
||||
&source->adaptive_proportion_test;
|
||||
static int adaptive_proportion_test ( noise_sample_t sample ) {
|
||||
static noise_sample_t current_counted_sample;
|
||||
static unsigned int sample_count = ADAPTIVE_PROPORTION_WINDOW_SIZE;
|
||||
static unsigned int repetition_count;
|
||||
|
||||
/* A = the sample value currently being counted
|
||||
* S = the number of samples examined in this run of the test so far
|
||||
* B = the number of samples examined in this run of the test so far
|
||||
* N = the total number of samples that must be observed in
|
||||
* one run of the test, also known as the "window size" of
|
||||
* the test
|
||||
@ -171,41 +284,37 @@ static int adaptive_proportion_test ( struct entropy_source *source,
|
||||
*/
|
||||
|
||||
/* 2. If S = N, then a new run of the test begins: */
|
||||
if ( test->sample_count == ADAPTIVE_PROPORTION_WINDOW_SIZE ) {
|
||||
if ( sample_count == ADAPTIVE_PROPORTION_WINDOW_SIZE ) {
|
||||
|
||||
/* a. A = the current sample */
|
||||
test->current_counted_sample = sample;
|
||||
current_counted_sample = sample;
|
||||
|
||||
/* b. S = 0 */
|
||||
test->sample_count = 0;
|
||||
sample_count = 0;
|
||||
|
||||
/* c. B = 0 */
|
||||
test->repetition_count = 0;
|
||||
repetition_count = 0;
|
||||
|
||||
} else {
|
||||
|
||||
/* Else: (the test is already running)
|
||||
* a. S = S + 1
|
||||
*/
|
||||
test->sample_count++;
|
||||
sample_count++;
|
||||
|
||||
/* b. If A = the current sample, then: */
|
||||
if ( sample == test->current_counted_sample ) {
|
||||
if ( sample == current_counted_sample ) {
|
||||
|
||||
/* i. B = B + 1 */
|
||||
test->repetition_count++;
|
||||
repetition_count++;
|
||||
|
||||
/* ii. If S (sic) > C then raise an error
|
||||
* condition, because the test has
|
||||
* detected a failure
|
||||
*/
|
||||
if ( test->repetition_count > test->cutoff ) {
|
||||
DBGC ( source, "ENTROPY %s excessively "
|
||||
"repeated value %d (%d/%d)\n",
|
||||
source->name, sample,
|
||||
test->repetition_count, test->cutoff );
|
||||
if ( repetition_count > adaptive_proportion_cutoff() )
|
||||
return -EPIPE_ADAPTIVE_PROPORTION_TEST;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,180 +324,62 @@ static int adaptive_proportion_test ( struct entropy_source *source,
|
||||
/**
|
||||
* Get entropy sample
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @ret entropy Entropy sample
|
||||
* @ret rc Return status code
|
||||
*
|
||||
* This is the GetEntropy function defined in ANS X9.82 Part 2
|
||||
* (October 2011 Draft) Section 6.5.1.
|
||||
*/
|
||||
static int get_entropy ( struct entropy_source *source,
|
||||
entropy_sample_t *entropy ) {
|
||||
static int get_entropy ( entropy_sample_t *entropy ) {
|
||||
static int rc = 0;
|
||||
noise_sample_t noise;
|
||||
int rc;
|
||||
|
||||
/* Any failure is permanent */
|
||||
if ( ( rc = source->rc ) != 0 )
|
||||
goto err_broken;
|
||||
if ( rc != 0 )
|
||||
return rc;
|
||||
|
||||
/* Get noise sample */
|
||||
if ( ( rc = get_noise ( source, &noise ) ) != 0 )
|
||||
goto err_get_noise;
|
||||
if ( ( rc = get_noise ( &noise ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Perform Repetition Count Test and Adaptive Proportion Test
|
||||
* as mandated by ANS X9.82 Part 2 (October 2011 Draft)
|
||||
* Section 8.5.2.1.1.
|
||||
*/
|
||||
if ( ( rc = repetition_count_test ( source, noise ) ) != 0 )
|
||||
goto err_repetition_count_test;
|
||||
if ( ( rc = adaptive_proportion_test ( source, noise ) ) != 0 )
|
||||
goto err_adaptive_proportion_test;
|
||||
if ( ( rc = repetition_count_test ( noise ) ) != 0 )
|
||||
return rc;
|
||||
if ( ( rc = adaptive_proportion_test ( noise ) ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* We do not use any optional conditioning component */
|
||||
*entropy = noise;
|
||||
|
||||
return 0;
|
||||
|
||||
err_adaptive_proportion_test:
|
||||
err_repetition_count_test:
|
||||
err_get_noise:
|
||||
source->rc = rc;
|
||||
err_broken:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise startup test
|
||||
* Calculate number of samples required for startup tests
|
||||
*
|
||||
* @v source Entropy source
|
||||
*/
|
||||
static void startup_test_init ( struct entropy_source *source ) {
|
||||
struct entropy_startup_test *test = &source->startup_test;
|
||||
|
||||
/* Sanity check */
|
||||
assert ( test->tested == 0 );
|
||||
assert ( test->count > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform startup test
|
||||
* @ret num_samples Number of samples required
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @ret rc Return status code
|
||||
* ANS X9.82 Part 2 (October 2011 Draft) Section 8.5.2.1.5 requires
|
||||
* that at least one full cycle of the continuous tests must be
|
||||
* performed at start-up.
|
||||
*/
|
||||
static int startup_test ( struct entropy_source *source ) {
|
||||
struct entropy_startup_test *test = &source->startup_test;
|
||||
entropy_sample_t sample;
|
||||
int rc;
|
||||
static inline __attribute__ (( always_inline )) unsigned int
|
||||
startup_test_count ( void ) {
|
||||
unsigned int num_samples;
|
||||
|
||||
/* Perform mandatory number of startup tests */
|
||||
for ( ; test->tested < test->count ; test->tested++ ) {
|
||||
if ( ( rc = get_entropy ( source, &sample ) ) != 0 ) {
|
||||
DBGC ( source, "ENTROPY %s failed: %s\n",
|
||||
source->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
/* At least max(N,C) samples shall be generated by the noise
|
||||
* source for start-up testing.
|
||||
*/
|
||||
num_samples = repetition_count_cutoff();
|
||||
if ( num_samples < adaptive_proportion_cutoff() )
|
||||
num_samples = adaptive_proportion_cutoff();
|
||||
linker_assert ( __builtin_constant_p ( num_samples ),
|
||||
startup_test_count_not_constant );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable entropy gathering
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int entropy_enable ( struct entropy_source *source ) {
|
||||
int rc;
|
||||
|
||||
/* Refuse to enable a previously failed source */
|
||||
if ( ( rc = source->rc ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Enable entropy source */
|
||||
if ( ( rc = source->enable() ) != 0 ) {
|
||||
DBGC ( source, "ENTROPY %s could not enable: %s\n",
|
||||
source->name, strerror ( rc ) );
|
||||
source->rc = rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Sanity check */
|
||||
assert ( source->min_entropy_per_sample > 0 );
|
||||
|
||||
/* Initialise test state if this source has not previously been used */
|
||||
if ( source->startup_test.tested == 0 ) {
|
||||
repetition_count_test_init ( source );
|
||||
adaptive_proportion_test_init ( source );
|
||||
startup_test_init ( source );
|
||||
}
|
||||
|
||||
DBGC ( source, "ENTROPY %s enabled\n", source->name );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable and test entropy source
|
||||
*
|
||||
* @v source Entropy source
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int entropy_enable_and_test ( struct entropy_source *source ) {
|
||||
int rc;
|
||||
|
||||
/* Enable source */
|
||||
if ( ( rc = entropy_enable ( source ) ) != 0 )
|
||||
goto err_enable;
|
||||
|
||||
/* Test source */
|
||||
if ( ( rc = startup_test ( source ) ) != 0 )
|
||||
goto err_test;
|
||||
|
||||
DBGC ( source, "ENTROPY %s passed %d startup tests\n",
|
||||
source->name, source->startup_test.count );
|
||||
return 0;
|
||||
|
||||
err_test:
|
||||
entropy_disable ( source );
|
||||
err_enable:
|
||||
assert ( source->rc == rc );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable first working entropy source
|
||||
*
|
||||
* @v source Entropy source to fill in
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
static int entropy_enable_working ( struct entropy_source **source ) {
|
||||
int rc;
|
||||
|
||||
/* Find the first working source */
|
||||
rc = -ENOENT;
|
||||
for_each_table_entry ( *source, ENTROPY_SOURCES ) {
|
||||
if ( ( rc = entropy_enable_and_test ( *source ) ) == 0 )
|
||||
return 0;
|
||||
}
|
||||
|
||||
DBGC ( *source, "ENTROPY has no working sources: %s\n",
|
||||
strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable entropy gathering
|
||||
*
|
||||
* @v source Entropy source
|
||||
*/
|
||||
void entropy_disable ( struct entropy_source *source ) {
|
||||
|
||||
/* Disable entropy gathering, if applicable */
|
||||
if ( source->disable )
|
||||
source->disable();
|
||||
|
||||
DBGC ( source, "ENTROPY %s disabled\n", source->name );
|
||||
return num_samples;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -411,7 +402,7 @@ static uint32_t make_next_nonce ( void ) {
|
||||
/**
|
||||
* Obtain entropy input temporary buffer
|
||||
*
|
||||
* @v min_entropy Min-entropy required
|
||||
* @v num_samples Number of entropy samples
|
||||
* @v tmp Temporary buffer
|
||||
* @v tmp_len Length of temporary buffer
|
||||
* @ret rc Return status code
|
||||
@ -421,41 +412,47 @@ static uint32_t make_next_nonce ( void ) {
|
||||
* and condensing each entropy source output after each GetEntropy
|
||||
* call) as defined in ANS X9.82 Part 4 (April 2011 Draft) Section
|
||||
* 13.3.4.2.
|
||||
*
|
||||
* To minimise code size, the number of samples required is calculated
|
||||
* at compilation time.
|
||||
*/
|
||||
int get_entropy_input_tmp ( min_entropy_t min_entropy, uint8_t *tmp,
|
||||
int get_entropy_input_tmp ( unsigned int num_samples, uint8_t *tmp,
|
||||
size_t tmp_len ) {
|
||||
struct entropy_source *source;
|
||||
static unsigned int startup_tested = 0;
|
||||
struct {
|
||||
uint32_t nonce;
|
||||
entropy_sample_t sample;
|
||||
} __attribute__ (( packed )) data;;
|
||||
uint8_t df_buf[tmp_len];
|
||||
min_entropy_t entropy_total;
|
||||
unsigned int num_samples;
|
||||
unsigned int i;
|
||||
int rc;
|
||||
|
||||
/* Enable entropy gathering */
|
||||
if ( ( rc = entropy_enable_working ( &source ) ) != 0 )
|
||||
goto err_enable_working;
|
||||
if ( ( rc = entropy_enable() ) != 0 )
|
||||
return rc;
|
||||
|
||||
/* Sanity checks */
|
||||
assert ( source->startup_test.count > 0 );
|
||||
assert ( source->startup_test.tested >= source->startup_test.count );
|
||||
/* Perform mandatory startup tests, if not yet performed */
|
||||
for ( ; startup_tested < startup_test_count() ; startup_tested++ ) {
|
||||
if ( ( rc = get_entropy ( &data.sample ) ) != 0 )
|
||||
goto err_get_entropy;
|
||||
}
|
||||
|
||||
/* 3. entropy_total = 0 */
|
||||
entropy_total = MIN_ENTROPY ( 0 );
|
||||
/* 3. entropy_total = 0
|
||||
*
|
||||
* (Nothing to do; the number of entropy samples required has
|
||||
* already been precalculated.)
|
||||
*/
|
||||
|
||||
/* 4. tmp = a fixed n-bit value, such as 0^n */
|
||||
memset ( tmp, 0, tmp_len );
|
||||
|
||||
/* 5. While ( entropy_total < min_entropy ) */
|
||||
for ( num_samples = 0 ; entropy_total < min_entropy ; num_samples++ ) {
|
||||
while ( num_samples-- ) {
|
||||
/* 5.1. ( status, entropy_bitstring, assessed_entropy )
|
||||
* = GetEntropy()
|
||||
* 5.2. If status indicates an error, return ( status, Null )
|
||||
*/
|
||||
if ( ( rc = get_entropy ( source, &data.sample ) ) != 0 )
|
||||
if ( ( rc = get_entropy ( &data.sample ) ) != 0 )
|
||||
goto err_get_entropy;
|
||||
|
||||
/* 5.3. nonce = MakeNextNonce() */
|
||||
@ -469,26 +466,19 @@ int get_entropy_input_tmp ( min_entropy_t min_entropy, uint8_t *tmp,
|
||||
for ( i = 0 ; i < tmp_len ; i++ )
|
||||
tmp[i] ^= df_buf[i];
|
||||
|
||||
/* 5.5. entropy_total = entropy_total + assessed_entropy */
|
||||
entropy_total += source->min_entropy_per_sample;
|
||||
/* 5.5. entropy_total = entropy_total + assessed_entropy
|
||||
*
|
||||
* (Nothing to do; the number of entropy samples
|
||||
* required has already been precalculated.)
|
||||
*/
|
||||
}
|
||||
|
||||
/* Disable entropy gathering */
|
||||
entropy_disable ( source );
|
||||
entropy_disable();
|
||||
|
||||
DBGC ( source, "ENTROPY %s gathered %d bits in %d samples\n",
|
||||
source->name, ( min_entropy / MIN_ENTROPY_SCALE ), num_samples );
|
||||
return 0;
|
||||
|
||||
err_get_entropy:
|
||||
entropy_disable ( source );
|
||||
assert ( source->rc == rc );
|
||||
err_enable_working:
|
||||
entropy_disable();
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Drag in objects via entropy_enable */
|
||||
REQUIRING_SYMBOL ( entropy_enable );
|
||||
|
||||
/* Drag in entropy configuration */
|
||||
REQUIRE_OBJECT ( config_entropy );
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Michael Brown <mbrown@fensystems.co.uk>.
|
||||
* 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
|
||||
@ -25,29 +25,16 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* CPU sleeping test
|
||||
* Nonexistent entropy source
|
||||
*
|
||||
*
|
||||
* This source provides no entropy and must NOT be used in a
|
||||
* security-sensitive environment.
|
||||
*/
|
||||
|
||||
/* Forcibly enable assertions */
|
||||
#undef NDEBUG
|
||||
#include <ipxe/entropy.h>
|
||||
|
||||
#include <ipxe/nap.h>
|
||||
#include <ipxe/test.h>
|
||||
|
||||
/**
|
||||
* Perform CPU sleeping self-test
|
||||
*
|
||||
*/
|
||||
static void nap_test_exec ( void ) {
|
||||
|
||||
/* Check that we can sleep without crashing or halting forever */
|
||||
cpu_nap();
|
||||
ok ( 1 );
|
||||
}
|
||||
|
||||
/** CPU sleeping self-test */
|
||||
struct self_test nap_test __self_test = {
|
||||
.name = "nap",
|
||||
.exec = nap_test_exec,
|
||||
};
|
||||
PROVIDE_ENTROPY_INLINE ( null, min_entropy_per_sample );
|
||||
PROVIDE_ENTROPY_INLINE ( null, entropy_enable );
|
||||
PROVIDE_ENTROPY_INLINE ( null, entropy_disable );
|
||||
PROVIDE_ENTROPY_INLINE ( null, get_noise );
|
||||
@ -609,7 +609,6 @@ static void scsicmd_read_capacity_cmd ( struct scsi_command *scsicmd,
|
||||
*/
|
||||
static void scsicmd_read_capacity_done ( struct scsi_command *scsicmd,
|
||||
int rc ) {
|
||||
struct scsi_device *scsidev = scsicmd->scsidev;
|
||||
struct scsi_read_capacity_private *priv = scsicmd_priv ( scsicmd );
|
||||
struct scsi_capacity_16 *capacity16 = &priv->capacity.capacity16;
|
||||
struct scsi_capacity_10 *capacity10 = &priv->capacity.capacity10;
|
||||
@ -646,9 +645,6 @@ static void scsicmd_read_capacity_done ( struct scsi_command *scsicmd,
|
||||
}
|
||||
capacity.max_count = -1U;
|
||||
|
||||
/* Allow transport layer to update capacity */
|
||||
block_capacity ( &scsidev->scsi, &capacity );
|
||||
|
||||
/* Return capacity to caller */
|
||||
block_capacity ( &scsicmd->block, &capacity );
|
||||
|
||||
|
||||
@ -98,16 +98,8 @@ static void eisa_remove ( struct eisa_device *eisa ) {
|
||||
static int eisabus_probe ( struct root_device *rootdev ) {
|
||||
struct eisa_device *eisa = NULL;
|
||||
unsigned int slot;
|
||||
uint8_t system;
|
||||
int rc;
|
||||
|
||||
/* Check for EISA system board */
|
||||
system = inb ( EISA_VENDOR_ID );
|
||||
if ( system & 0x80 ) {
|
||||
DBG ( "No EISA system board (read %02x)\n", system );
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
for ( slot = EISA_MIN_SLOT ; slot <= EISA_MAX_SLOT ; slot++ ) {
|
||||
/* Allocate struct eisa_device */
|
||||
if ( ! eisa )
|
||||
|
||||
@ -205,7 +205,6 @@ int pci_read_config ( struct pci_device *pci ) {
|
||||
pci_read_config_dword ( pci, PCI_REVISION, &tmp );
|
||||
pci->class = ( tmp >> 8 );
|
||||
pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, &pci->irq );
|
||||
pci_read_config_byte ( pci, PCI_HEADER_TYPE, &pci->hdrtype );
|
||||
pci_read_bases ( pci );
|
||||
|
||||
/* Initialise generic device component */
|
||||
|
||||
@ -290,18 +290,6 @@ static int intel_reset ( struct intel_nic *intel ) {
|
||||
pba, readl ( intel->regs + INTEL_PBA ) );
|
||||
}
|
||||
|
||||
/* The Intel I210's packet buffer size registers reset only on
|
||||
* power up. If an operating system changes these but then
|
||||
* the computer recieves a reset signal without losing power,
|
||||
* the registers will stay the same (but be incompatible with
|
||||
* other register defaults), thus making the device unable to
|
||||
* pass traffic.
|
||||
*/
|
||||
if ( intel->flags & INTEL_PBSIZE_RST ) {
|
||||
writel ( INTEL_RXPBS_I210, intel->regs + INTEL_RXPBS );
|
||||
writel ( INTEL_TXPBS_I210, intel->regs + INTEL_TXPBS );
|
||||
}
|
||||
|
||||
/* Always reset MAC. Required to reset the TX and RX rings. */
|
||||
writel ( ( ctrl | INTEL_CTRL_RST ), intel->regs + INTEL_CTRL );
|
||||
mdelay ( INTEL_RESET_DELAY_MS );
|
||||
@ -1151,7 +1139,7 @@ static struct pci_device_id intel_nics[] = {
|
||||
PCI_ROM ( 0x8086, 0x1525, "82567v-4", "82567V-4", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1526, "82576-5", "82576", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1527, "82580-f2", "82580 Fiber", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1533, "i210", "I210", INTEL_PBSIZE_RST ),
|
||||
PCI_ROM ( 0x8086, 0x1533, "i210", "I210", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1539, "i211", "I211", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x153a, "i217lm", "I217-LM", INTEL_NO_PHY_RST ),
|
||||
PCI_ROM ( 0x8086, 0x153b, "i217v", "I217-V", 0 ),
|
||||
@ -1159,7 +1147,7 @@ static struct pci_device_id intel_nics[] = {
|
||||
PCI_ROM ( 0x8086, 0x155a, "i218lm", "I218-LM", INTEL_NO_PHY_RST ),
|
||||
PCI_ROM ( 0x8086, 0x156f, "i219lm", "I219-LM", INTEL_I219 ),
|
||||
PCI_ROM ( 0x8086, 0x1570, "i219v", "I219-V", INTEL_I219 ),
|
||||
PCI_ROM ( 0x8086, 0x157b, "i210-2", "I210", INTEL_PBSIZE_RST ),
|
||||
PCI_ROM ( 0x8086, 0x157b, "i210-2", "I210", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x15a0, "i218lm-2", "I218-LM", INTEL_NO_PHY_RST ),
|
||||
PCI_ROM ( 0x8086, 0x15a1, "i218v-2", "I218-V", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x15a2, "i218lm-3", "I218-LM", INTEL_NO_PHY_RST ),
|
||||
|
||||
@ -138,10 +138,6 @@ struct intel_descriptor {
|
||||
/** Packet Buffer Size */
|
||||
#define INTEL_PBS 0x01008UL
|
||||
|
||||
/** Receive packet buffer size */
|
||||
#define INTEL_RXPBS 0x02404UL
|
||||
#define INTEL_RXPBS_I210 0x000000a2UL /**< I210 power-up default */
|
||||
|
||||
/** Receive Descriptor register block */
|
||||
#define INTEL_RD 0x02800UL
|
||||
|
||||
@ -158,10 +154,6 @@ struct intel_descriptor {
|
||||
/** Receive buffer length */
|
||||
#define INTEL_RX_MAX_LEN 2048
|
||||
|
||||
/** Transmit packet buffer size */
|
||||
#define INTEL_TXPBS 0x03404UL
|
||||
#define INTEL_TXPBS_I210 0x04000014UL /**< I210 power-up default */
|
||||
|
||||
/** Transmit Descriptor register block */
|
||||
#define INTEL_TD 0x03800UL
|
||||
|
||||
@ -327,8 +319,6 @@ enum intel_flags {
|
||||
INTEL_NO_ASDE = 0x0008,
|
||||
/** Reset may cause a complete device hang */
|
||||
INTEL_RST_HANG = 0x0010,
|
||||
/** PBSIZE registers must be explicitly reset */
|
||||
INTEL_PBSIZE_RST = 0x0020,
|
||||
};
|
||||
|
||||
/** The i219 has a seriously broken reset mechanism */
|
||||
|
||||
@ -473,7 +473,6 @@ static struct pci_device_id intelx_nics[] = {
|
||||
PCI_ROM ( 0x8086, 0x10f9, "82599-cx4", "82599 (CX4)", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x10fb, "82599-sfp", "82599 (SFI/SFP+)", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x10fc, "82599-xaui", "82599 (XAUI/BX4)", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x151c, "82599-tn", "82599 (TN)", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1528, "x540t", "X540-AT2/X540-BT2", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x154d, "82599-sfp-sf2", "82599 (SFI/SFP+)", 0 ),
|
||||
PCI_ROM ( 0x8086, 0x1557, "82599en-sfp", "82599 (Single Port SFI Only)", 0 ),
|
||||
|
||||
@ -1067,15 +1067,11 @@ static void realtek_detect ( struct realtek_nic *rtl ) {
|
||||
* Note that enabling DAC seems to cause bizarre behaviour
|
||||
* (lockups, garbage data on the wire) on some systems, even
|
||||
* if only 32-bit addresses are used.
|
||||
*
|
||||
* Disable VLAN offload, since some cards seem to have it
|
||||
* enabled by default.
|
||||
*/
|
||||
cpcr = readw ( rtl->regs + RTL_CPCR );
|
||||
cpcr |= ( RTL_CPCR_MULRW | RTL_CPCR_CPRX | RTL_CPCR_CPTX );
|
||||
if ( sizeof ( physaddr_t ) > sizeof ( uint32_t ) )
|
||||
cpcr |= RTL_CPCR_DAC;
|
||||
cpcr &= ~RTL_CPCR_VLAN;
|
||||
writew ( cpcr, rtl->regs + RTL_CPCR );
|
||||
check_cpcr = readw ( rtl->regs + RTL_CPCR );
|
||||
|
||||
|
||||
@ -228,9 +228,8 @@ enum realtek_legacy_status {
|
||||
|
||||
/** C+ Command Register (word) */
|
||||
#define RTL_CPCR 0xe0
|
||||
#define RTL_CPCR_VLAN 0x0040 /**< VLAN tag stripping enable */
|
||||
#define RTL_CPCR_DAC 0x0010 /**< PCI Dual Address Cycle enable */
|
||||
#define RTL_CPCR_MULRW 0x0008 /**< PCI Multiple Read/Write enable */
|
||||
#define RTL_CPCR_DAC 0x0010 /**< PCI Dual Address Cycle Enable */
|
||||
#define RTL_CPCR_MULRW 0x0008 /**< PCI Multiple Read/Write Enable */
|
||||
#define RTL_CPCR_CPRX 0x0002 /**< C+ receive enable */
|
||||
#define RTL_CPCR_CPTX 0x0001 /**< C+ transmit enable */
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Request parameter commands
|
||||
* Form parameter commands
|
||||
*
|
||||
*/
|
||||
|
||||
@ -90,16 +90,12 @@ static int params_exec ( int argc, char **argv ) {
|
||||
struct param_options {
|
||||
/** Parameter list name */
|
||||
char *params;
|
||||
/** Parameter is a header */
|
||||
int header;
|
||||
};
|
||||
|
||||
/** "param" option list */
|
||||
static struct option_descriptor param_opts[] = {
|
||||
OPTION_DESC ( "params", 'p', required_argument,
|
||||
struct param_options, params, parse_string ),
|
||||
OPTION_DESC ( "header", 'H', no_argument,
|
||||
struct param_options, header, parse_flag ),
|
||||
};
|
||||
|
||||
/** "param" command descriptor */
|
||||
@ -118,7 +114,6 @@ static int param_exec ( int argc, char **argv ) {
|
||||
struct param_options opts;
|
||||
char *key;
|
||||
char *value;
|
||||
unsigned int flags;
|
||||
struct parameters *params;
|
||||
struct parameter *param;
|
||||
int rc;
|
||||
@ -137,15 +132,12 @@ static int param_exec ( int argc, char **argv ) {
|
||||
goto err_parse_value;
|
||||
}
|
||||
|
||||
/* Construct flags */
|
||||
flags = ( opts.header ? PARAMETER_HEADER : PARAMETER_FORM );
|
||||
|
||||
/* Identify parameter list */
|
||||
if ( ( rc = parse_parameters ( opts.params, ¶ms ) ) != 0 )
|
||||
goto err_parse_parameters;
|
||||
|
||||
/* Add parameter */
|
||||
param = add_parameter ( params, key, value, flags );
|
||||
param = add_parameter ( params, key, value );
|
||||
if ( ! param ) {
|
||||
rc = -ENOMEM;
|
||||
goto err_add_parameter;
|
||||
@ -162,7 +154,7 @@ static int param_exec ( int argc, char **argv ) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** Request parameter commands */
|
||||
/** Form parameter commands */
|
||||
struct command param_commands[] __command = {
|
||||
{
|
||||
.name = "params",
|
||||
|
||||
@ -147,38 +147,38 @@ static int efi_image_exec ( struct image *image ) {
|
||||
/* Find an appropriate device handle to use */
|
||||
snpdev = last_opened_snpdev();
|
||||
if ( ! snpdev ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not identify SNP device\n",
|
||||
image->name );
|
||||
DBGC ( image, "EFIIMAGE %p could not identify SNP device\n",
|
||||
image );
|
||||
rc = -ENODEV;
|
||||
goto err_no_snpdev;
|
||||
}
|
||||
|
||||
/* Install file I/O protocols */
|
||||
if ( ( rc = efi_file_install ( snpdev->handle ) ) != 0 ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not install file protocol: "
|
||||
"%s\n", image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not install file protocol: "
|
||||
"%s\n", image, strerror ( rc ) );
|
||||
goto err_file_install;
|
||||
}
|
||||
|
||||
/* Install PXE base code protocol */
|
||||
if ( ( rc = efi_pxe_install ( snpdev->handle, snpdev->netdev ) ) != 0 ){
|
||||
DBGC ( image, "EFIIMAGE %s could not install PXE protocol: "
|
||||
"%s\n", image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not install PXE protocol: "
|
||||
"%s\n", image, strerror ( rc ) );
|
||||
goto err_pxe_install;
|
||||
}
|
||||
|
||||
/* Install iPXE download protocol */
|
||||
if ( ( rc = efi_download_install ( snpdev->handle ) ) != 0 ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not install iPXE download "
|
||||
"protocol: %s\n", image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not install iPXE download "
|
||||
"protocol: %s\n", image, strerror ( rc ) );
|
||||
goto err_download_install;
|
||||
}
|
||||
|
||||
/* Create device path for image */
|
||||
path = efi_image_path ( image, snpdev->path );
|
||||
if ( ! path ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not create device path\n",
|
||||
image->name );
|
||||
DBGC ( image, "EFIIMAGE %p could not create device path\n",
|
||||
image );
|
||||
rc = -ENOMEM;
|
||||
goto err_image_path;
|
||||
}
|
||||
@ -186,8 +186,8 @@ static int efi_image_exec ( struct image *image ) {
|
||||
/* Create command line for image */
|
||||
cmdline = efi_image_cmdline ( image );
|
||||
if ( ! cmdline ) {
|
||||
DBGC ( image, "EFIIMAGE %s could not create command line\n",
|
||||
image->name );
|
||||
DBGC ( image, "EFIIMAGE %p could not create command line\n",
|
||||
image );
|
||||
rc = -ENOMEM;
|
||||
goto err_cmdline;
|
||||
}
|
||||
@ -199,8 +199,8 @@ static int efi_image_exec ( struct image *image ) {
|
||||
image->len, &handle ) ) != 0 ) {
|
||||
/* Not an EFI image */
|
||||
rc = -EEFI_LOAD ( efirc );
|
||||
DBGC ( image, "EFIIMAGE %s could not load: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not load: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
if ( efirc == EFI_SECURITY_VIOLATION ) {
|
||||
goto err_load_image_security_violation;
|
||||
} else {
|
||||
@ -220,8 +220,8 @@ static int efi_image_exec ( struct image *image ) {
|
||||
|
||||
/* Some EFI 1.10 implementations seem not to fill in DeviceHandle */
|
||||
if ( loaded.image->DeviceHandle == NULL ) {
|
||||
DBGC ( image, "EFIIMAGE %s filling in missing DeviceHandle\n",
|
||||
image->name );
|
||||
DBGC ( image, "EFIIMAGE %p filling in missing DeviceHandle\n",
|
||||
image );
|
||||
loaded.image->DeviceHandle = snpdev->handle;
|
||||
}
|
||||
|
||||
@ -251,14 +251,14 @@ static int efi_image_exec ( struct image *image ) {
|
||||
/* Start the image */
|
||||
if ( ( efirc = bs->StartImage ( handle, NULL, NULL ) ) != 0 ) {
|
||||
rc = -EEFI_START ( efirc );
|
||||
DBGC ( image, "EFIIMAGE %s could not start (or returned with "
|
||||
"error): %s\n", image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not start (or returned with "
|
||||
"error): %s\n", image, strerror ( rc ) );
|
||||
goto err_start_image;
|
||||
}
|
||||
|
||||
/* If image was a driver, connect it up to anything available */
|
||||
if ( type == EfiBootServicesCode ) {
|
||||
DBGC ( image, "EFIIMAGE %s connecting drivers\n", image->name );
|
||||
DBGC ( image, "EFIIMAGE %p connecting drivers\n", image );
|
||||
efi_driver_reconnect_all();
|
||||
}
|
||||
|
||||
@ -324,8 +324,8 @@ static int efi_image_probe ( struct image *image ) {
|
||||
image->len, &handle ) ) != 0 ) {
|
||||
/* Not an EFI image */
|
||||
rc = -EEFI_LOAD ( efirc );
|
||||
DBGC ( image, "EFIIMAGE %s could not load: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
DBGC ( image, "EFIIMAGE %p could not load: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
if ( efirc == EFI_SECURITY_VIOLATION ) {
|
||||
goto err_load_image_security_violation;
|
||||
} else {
|
||||
|
||||
@ -197,6 +197,11 @@ static int script_exec ( struct image *image ) {
|
||||
size_t saved_offset;
|
||||
int rc;
|
||||
|
||||
/* Temporarily de-register image, so that a "boot" command
|
||||
* doesn't throw us into an execution loop.
|
||||
*/
|
||||
unregister_image ( image );
|
||||
|
||||
/* Preserve state of any currently-running script */
|
||||
saved_offset = script_offset;
|
||||
|
||||
@ -207,6 +212,10 @@ static int script_exec ( struct image *image ) {
|
||||
/* Restore saved state */
|
||||
script_offset = saved_offset;
|
||||
|
||||
/* Re-register image (unless we have been replaced) */
|
||||
if ( ! image->replacement )
|
||||
register_image ( image );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@ -755,53 +755,6 @@ char __debug_disable(OBJECT) = ( DBGLVL_MAX & ~DBGLVL_DFLT );
|
||||
#define FILE_LICENCE_BSD2 \
|
||||
PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd2__ ) )
|
||||
|
||||
/** Declare a file as being under the two-clause BSD plus patent licence
|
||||
*
|
||||
* This licence declaration is applicable when a file states itself to
|
||||
* be licensed under terms allowing redistribution in source and
|
||||
* binary forms (with or without modification) provided that:
|
||||
*
|
||||
* redistributions of source code retain the copyright notice,
|
||||
* list of conditions and any attached disclaimers
|
||||
*
|
||||
* redistributions in binary form reproduce the copyright notice,
|
||||
* list of conditions and any attached disclaimers in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution
|
||||
*
|
||||
* and in addition states that
|
||||
*
|
||||
* Subject to the terms and conditions of this license, each
|
||||
* copyright holder and contributor hereby grants to those
|
||||
* receiving rights under this license a perpetual, worldwide,
|
||||
* non-exclusive, no-charge, royalty-free, irrevocable (except for
|
||||
* failure to satisfy the conditions of this license) patent
|
||||
* license to make, have made, use, offer to sell, sell, import,
|
||||
* and otherwise transfer this software, where such license
|
||||
* applies only to those patent claims, already acquired or
|
||||
* hereafter acquired, licensable by such copyright holder or
|
||||
* contributor that are necessarily infringed by:
|
||||
*
|
||||
* their Contribution(s) (the licensed copyrights of copyright
|
||||
* holders and non-copyrightable additions of contributors, in
|
||||
* source or binary form) alone; or
|
||||
*
|
||||
* combination of their Contribution(s) with the work of
|
||||
* authorship to which such Contribution(s) was added by such
|
||||
* copyright holder or contributor, if, at the time the
|
||||
* Contribution is added, such addition causes such combination
|
||||
* to be necessarily infringed. The patent license shall not
|
||||
* apply to any other combinations which include the
|
||||
* Contribution.
|
||||
*
|
||||
* It is not necessary for the file to explicitly state that it is
|
||||
* under a "BSD" licence; only that the licensing terms be
|
||||
* functionally equivalent to the standard two-clause BSD licence with
|
||||
* patent grant.
|
||||
*/
|
||||
#define FILE_LICENCE_BSD2_PATENT \
|
||||
PROVIDE_SYMBOL ( PREFIX_OBJECT ( __licence__bsd2_patent__ ) )
|
||||
|
||||
/** Declare a file as being under the one-clause MIT-style licence
|
||||
*
|
||||
* This licence declaration is applicable when a file states itself to
|
||||
|
||||
@ -262,10 +262,10 @@ static inline void eplatform_discard ( int dummy __unused, ... ) {}
|
||||
".balign 8\n\t" \
|
||||
"\n1:\n\t" \
|
||||
".long ( 4f - 1b )\n\t" \
|
||||
".long %" ASM_NO_PREFIX "0\n\t" \
|
||||
".long %c0\n\t" \
|
||||
".long ( 2f - 1b )\n\t" \
|
||||
".long ( 3f - 1b )\n\t" \
|
||||
".long %" ASM_NO_PREFIX "1\n\t" \
|
||||
".long %c1\n\t" \
|
||||
"\n2:\t.asciz \"" __einfo_desc ( einfo ) "\"\n\t" \
|
||||
"\n3:\t.asciz \"" __FILE__ "\"\n\t" \
|
||||
".balign 8\n\t" \
|
||||
|
||||
@ -274,9 +274,8 @@ struct dhcp_client_architecture {
|
||||
|
||||
/** DHCP client architecture values
|
||||
*
|
||||
* These are originally defined by the PXE specification, redefined by
|
||||
* RFC4578, redefined again by RFC5970, and now maintained in the IANA
|
||||
* DHCPv6 parameters registry.
|
||||
* These are defined by the PXE specification and redefined by
|
||||
* RFC4578.
|
||||
*/
|
||||
enum dhcp_client_architecture_values {
|
||||
/** Intel x86 PC */
|
||||
@ -303,24 +302,6 @@ enum dhcp_client_architecture_values {
|
||||
DHCP_CLIENT_ARCHITECTURE_ARM32 = 0x000a,
|
||||
/** EFI 64-bit ARM */
|
||||
DHCP_CLIENT_ARCHITECTURE_ARM64 = 0x000b,
|
||||
/** EFI 32-bit RISC-V */
|
||||
DHCP_CLIENT_ARCHITECTURE_RISCV32 = 0x0019,
|
||||
/** EFI 64-bit RISC-V */
|
||||
DHCP_CLIENT_ARCHITECTURE_RISCV64 = 0x001b,
|
||||
/** EFI 128-bit RISC-V */
|
||||
DHCP_CLIENT_ARCHITECTURE_RISCV128 = 0x001d,
|
||||
/** EFI 32-bit MIPS */
|
||||
DHCP_CLIENT_ARCHITECTURE_MIPS32 = 0x0021,
|
||||
/** EFI 64-bit MIPS */
|
||||
DHCP_CLIENT_ARCHITECTURE_MIPS64 = 0x0022,
|
||||
/** EFI 32-bit Sunway */
|
||||
DHCP_CLIENT_ARCHITECTURE_SUNWAY32 = 0x0023,
|
||||
/** EFI 64-bit Sunway */
|
||||
DHCP_CLIENT_ARCHITECTURE_SUNWAY64 = 0x0024,
|
||||
/** EFI 32-bit LoongArch */
|
||||
DHCP_CLIENT_ARCHITECTURE_LOONG32 = 0x0025,
|
||||
/** EFI 64-bit LoongArch */
|
||||
DHCP_CLIENT_ARCHITECTURE_LOONG64 = 0x0027,
|
||||
};
|
||||
|
||||
/** Client network device interface */
|
||||
|
||||
@ -1,18 +1,24 @@
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for AArch64.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
///
|
||||
/// Define the processor type so other code can make processor based choices
|
||||
@ -22,102 +28,53 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#if !defined (__GNUC__) && !defined (__ASSEMBLER__)
|
||||
#pragma pack()
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
|
||||
//
|
||||
// Disable some level 4 compilation warnings (same as IA32 and X64)
|
||||
//
|
||||
|
||||
//
|
||||
// Disabling bitfield type checking warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4214 )
|
||||
|
||||
//
|
||||
// Disabling the unreferenced formal parameter warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4100 )
|
||||
|
||||
//
|
||||
// Disable slightly different base types warning as CHAR8 * can not be set
|
||||
// to a constant string.
|
||||
//
|
||||
#pragma warning ( disable : 4057 )
|
||||
|
||||
//
|
||||
// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
|
||||
//
|
||||
#pragma warning ( disable : 4127 )
|
||||
|
||||
//
|
||||
// This warning is caused by functions defined but not used. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4505 )
|
||||
|
||||
//
|
||||
// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4206 )
|
||||
|
||||
//
|
||||
// Disable 'potentially uninitialized local variable X used' warnings
|
||||
//
|
||||
#pragma warning ( disable : 4701 )
|
||||
|
||||
//
|
||||
// Disable 'potentially uninitialized local pointer variable X used' warnings
|
||||
//
|
||||
#pragma warning ( disable : 4703 )
|
||||
|
||||
//
|
||||
// use Microsoft* C compiler dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
|
||||
#if _MSC_EXTENSIONS
|
||||
//
|
||||
// use Microsoft* C compiler dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#else
|
||||
|
||||
//
|
||||
// Assume standard AARCH64 alignment.
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
|
||||
//
|
||||
// Assume standard AARCH64 alignment.
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef UINT64 UINTN;
|
||||
typedef UINT64 UINTN;
|
||||
|
||||
///
|
||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef INT64 INTN;
|
||||
typedef INT64 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
@ -126,7 +83,7 @@ typedef INT64 INTN;
|
||||
///
|
||||
/// A value of native width with the highest bit set.
|
||||
///
|
||||
#define MAX_BIT 0x8000000000000000ULL
|
||||
#define MAX_BIT 0x8000000000000000ULL
|
||||
|
||||
///
|
||||
/// A value of native width with the two highest bits set.
|
||||
@ -136,12 +93,7 @@ typedef INT64 INTN;
|
||||
///
|
||||
/// Maximum legal AARCH64 address
|
||||
///
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
///
|
||||
/// Maximum usable address at boot time (48 bits using 4 KB pages)
|
||||
///
|
||||
#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL
|
||||
#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
///
|
||||
/// Maximum legal AArch64 INTN and UINTN values.
|
||||
@ -149,11 +101,6 @@ typedef INT64 INTN;
|
||||
#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
|
||||
#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
///
|
||||
/// Minimum legal AArch64 INTN value.
|
||||
///
|
||||
#define MIN_INTN (((INTN)-9223372036854775807LL) - 1)
|
||||
|
||||
///
|
||||
/// The stack alignment required for AARCH64
|
||||
///
|
||||
@ -162,8 +109,8 @@ typedef INT64 INTN;
|
||||
///
|
||||
/// Page allocation granularity for AARCH64
|
||||
///
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
@ -174,18 +121,18 @@ typedef INT64 INTN;
|
||||
|
||||
// When compiling with Clang, we still use GNU as for the assembler, so we still
|
||||
// need to define the GCC_ASM* macros.
|
||||
#if defined (__GNUC__) || defined (__clang__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||
.type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||
|
||||
#endif
|
||||
@ -200,7 +147,7 @@ typedef INT64 INTN;
|
||||
@return The pointer to the first instruction of a function given a function pointer.
|
||||
|
||||
**/
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
|
||||
#ifndef __USER_LABEL_PREFIX__
|
||||
#define __USER_LABEL_PREFIX__
|
||||
|
||||
@ -1,16 +1,22 @@
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for ARM.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
///
|
||||
/// Define the processor type so other code can make processor based choices
|
||||
@ -20,110 +26,61 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#if !defined (__GNUC__) && !defined (__ASSEMBLER__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
|
||||
//
|
||||
// Disable some level 4 compilation warnings (same as IA32 and X64)
|
||||
//
|
||||
|
||||
//
|
||||
// Disabling bitfield type checking warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4214 )
|
||||
|
||||
//
|
||||
// Disabling the unreferenced formal parameter warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4100 )
|
||||
|
||||
//
|
||||
// Disable slightly different base types warning as CHAR8 * can not be set
|
||||
// to a constant string.
|
||||
//
|
||||
#pragma warning ( disable : 4057 )
|
||||
|
||||
//
|
||||
// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
|
||||
//
|
||||
#pragma warning ( disable : 4127 )
|
||||
|
||||
//
|
||||
// This warning is caused by functions defined but not used. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4505 )
|
||||
|
||||
//
|
||||
// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4206 )
|
||||
|
||||
//
|
||||
// Disable 'potentially uninitialized local variable X used' warnings
|
||||
//
|
||||
#pragma warning ( disable : 4701 )
|
||||
|
||||
//
|
||||
// Disable 'potentially uninitialized local pointer variable X used' warnings
|
||||
//
|
||||
#pragma warning ( disable : 4703 )
|
||||
|
||||
#ifndef __GNUC__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
//
|
||||
// MSFT doesn't support the __builtin_unreachable() macro
|
||||
// RVCT does not support the __builtin_unreachable() macro
|
||||
//
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
#ifdef __ARMCC_VERSION
|
||||
#define UNREACHABLE()
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
//
|
||||
// use Microsoft* C compiler dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#if _MSC_EXTENSIONS
|
||||
//
|
||||
// use Microsoft* C compiler dependent integer width types
|
||||
//
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef __int64 INT64;
|
||||
typedef unsigned __int32 UINT32;
|
||||
typedef __int32 INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#else
|
||||
//
|
||||
// Assume standard ARM alignment.
|
||||
// Need to check portability of long long
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
//
|
||||
// Assume standard ARM alignment.
|
||||
// Need to check portability of long long
|
||||
//
|
||||
typedef unsigned long long UINT64;
|
||||
typedef long long INT64;
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned short CHAR16;
|
||||
typedef short INT16;
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef unsigned char UINT8;
|
||||
typedef char CHAR8;
|
||||
typedef signed char INT8;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef UINT32 UINTN;
|
||||
typedef UINT32 UINTN;
|
||||
|
||||
///
|
||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||
/// 8 bytes on supported 64-bit processor instructions)
|
||||
///
|
||||
typedef INT32 INTN;
|
||||
typedef INT32 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
@ -132,34 +89,24 @@ typedef INT32 INTN;
|
||||
///
|
||||
/// A value of native width with the highest bit set.
|
||||
///
|
||||
#define MAX_BIT 0x80000000
|
||||
#define MAX_BIT 0x80000000
|
||||
|
||||
///
|
||||
/// A value of native width with the two highest bits set.
|
||||
///
|
||||
#define MAX_2_BITS 0xC0000000
|
||||
#define MAX_2_BITS 0xC0000000
|
||||
|
||||
///
|
||||
/// Maximum legal ARM address
|
||||
///
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
///
|
||||
/// Maximum usable address at boot time
|
||||
///
|
||||
#define MAX_ALLOC_ADDRESS MAX_ADDRESS
|
||||
|
||||
///
|
||||
/// Maximum legal ARM INTN and UINTN values.
|
||||
///
|
||||
#define MAX_INTN ((INTN)0x7FFFFFFF)
|
||||
#define MAX_UINTN ((UINTN)0xFFFFFFFF)
|
||||
|
||||
///
|
||||
/// Minimum legal ARM INTN value.
|
||||
///
|
||||
#define MIN_INTN (((INTN)-2147483647) - 1)
|
||||
|
||||
///
|
||||
/// The stack alignment required for ARM
|
||||
///
|
||||
@ -168,8 +115,8 @@ typedef INT32 INTN;
|
||||
///
|
||||
/// Page allocation granularity for ARM
|
||||
///
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
@ -180,45 +127,40 @@ typedef INT32 INTN;
|
||||
|
||||
// When compiling with Clang, we still use GNU as for the assembler, so we still
|
||||
// need to define the GCC_ASM* macros.
|
||||
#if defined (__GNUC__) || defined (__clang__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
|
||||
#if !defined (__APPLE__)
|
||||
///
|
||||
/// ARM EABI defines that the linker should not manipulate call relocations
|
||||
/// (do bl/blx conversion) unless the target symbol has function type.
|
||||
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
||||
///
|
||||
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
||||
#if !defined(__APPLE__)
|
||||
///
|
||||
/// ARM EABI defines that the linker should not manipulate call relocations
|
||||
/// (do bl/blx conversion) unless the target symbol has function type.
|
||||
/// CodeSourcery 2010.09 started requiring the .type to function properly
|
||||
///
|
||||
#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
|
||||
.type ASM_PFX(func__), %function
|
||||
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
#define GCC_ASM_IMPORT(func__) \
|
||||
.extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
|
||||
|
||||
#else
|
||||
//
|
||||
// .type not supported by Apple Xcode tools
|
||||
//
|
||||
#define INTERWORK_FUNC(func__)
|
||||
//
|
||||
// .type not supported by Apple Xcode tools
|
||||
//
|
||||
#define INTERWORK_FUNC(func__)
|
||||
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
#define GCC_ASM_EXPORT(func__) \
|
||||
.globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
|
||||
|
||||
#define GCC_ASM_IMPORT(name)
|
||||
#define GCC_ASM_IMPORT(name)
|
||||
|
||||
#endif
|
||||
#elif defined (_MSC_EXTENSIONS)
|
||||
//
|
||||
// PRESERVE8 is not supported by the MSFT assembler.
|
||||
//
|
||||
#define PRESERVE8
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -231,10 +173,12 @@ typedef INT32 INTN;
|
||||
@return The pointer to the first instruction of a function given a function pointer.
|
||||
|
||||
**/
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
|
||||
#ifndef __USER_LABEL_PREFIX__
|
||||
#define __USER_LABEL_PREFIX__
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,8 +5,14 @@
|
||||
ACPI 2.0 specification defines the ACPI 2.0 GUID. UEFI 2.0 defines the
|
||||
ACPI 2.0 Table GUID and ACPI Table GUID.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUIDs defined in UEFI 2.0 spec.
|
||||
@ -16,7 +22,7 @@
|
||||
#ifndef __ACPI_GUID_H__
|
||||
#define __ACPI_GUID_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define ACPI_TABLE_GUID \
|
||||
{ \
|
||||
@ -28,15 +34,15 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
|
||||
}
|
||||
|
||||
#define ACPI_10_TABLE_GUID ACPI_TABLE_GUID
|
||||
#define ACPI_10_TABLE_GUID ACPI_TABLE_GUID
|
||||
|
||||
//
|
||||
// ACPI 2.0 or newer tables should use EFI_ACPI_TABLE_GUID.
|
||||
//
|
||||
#define EFI_ACPI_20_TABLE_GUID EFI_ACPI_TABLE_GUID
|
||||
#define EFI_ACPI_20_TABLE_GUID EFI_ACPI_TABLE_GUID
|
||||
|
||||
extern EFI_GUID gEfiAcpiTableGuid;
|
||||
extern EFI_GUID gEfiAcpi10TableGuid;
|
||||
extern EFI_GUID gEfiAcpi20TableGuid;
|
||||
extern EFI_GUID gEfiAcpiTableGuid;
|
||||
extern EFI_GUID gEfiAcpi10TableGuid;
|
||||
extern EFI_GUID gEfiAcpi20TableGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,15 +3,21 @@
|
||||
and EFI_FILE_PROTOCOL.GetInfo() to set or get generic file information.
|
||||
This GUID is defined in UEFI specification.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __FILE_INFO_H__
|
||||
#define __FILE_INFO_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define EFI_FILE_INFO_ID \
|
||||
{ \
|
||||
@ -22,35 +28,35 @@ typedef struct {
|
||||
///
|
||||
/// The size of the EFI_FILE_INFO structure, including the Null-terminated FileName string.
|
||||
///
|
||||
UINT64 Size;
|
||||
UINT64 Size;
|
||||
///
|
||||
/// The size of the file in bytes.
|
||||
///
|
||||
UINT64 FileSize;
|
||||
UINT64 FileSize;
|
||||
///
|
||||
/// PhysicalSize The amount of physical space the file consumes on the file system volume.
|
||||
///
|
||||
UINT64 PhysicalSize;
|
||||
UINT64 PhysicalSize;
|
||||
///
|
||||
/// The time the file was created.
|
||||
///
|
||||
EFI_TIME CreateTime;
|
||||
EFI_TIME CreateTime;
|
||||
///
|
||||
/// The time when the file was last accessed.
|
||||
///
|
||||
EFI_TIME LastAccessTime;
|
||||
EFI_TIME LastAccessTime;
|
||||
///
|
||||
/// The time when the file's contents were last modified.
|
||||
///
|
||||
EFI_TIME ModificationTime;
|
||||
EFI_TIME ModificationTime;
|
||||
///
|
||||
/// The attribute bits for the file.
|
||||
///
|
||||
UINT64 Attribute;
|
||||
UINT64 Attribute;
|
||||
///
|
||||
/// The Null-terminated name of the file.
|
||||
///
|
||||
CHAR16 FileName[1];
|
||||
CHAR16 FileName[1];
|
||||
} EFI_FILE_INFO;
|
||||
|
||||
///
|
||||
@ -60,8 +66,8 @@ typedef struct {
|
||||
/// computes this size correctly no matter how big the FileName array is declared.
|
||||
/// This is required to make the EFI_FILE_INFO data structure ANSI compilant.
|
||||
///
|
||||
#define SIZE_OF_EFI_FILE_INFO OFFSET_OF (EFI_FILE_INFO, FileName)
|
||||
#define SIZE_OF_EFI_FILE_INFO OFFSET_OF (EFI_FILE_INFO, FileName)
|
||||
|
||||
extern EFI_GUID gEfiFileInfoGuid;
|
||||
extern EFI_GUID gEfiFileInfoGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,15 +3,21 @@
|
||||
or EFI_FILE_PROTOCOL.SetInfo() to get or set information about the system's volume.
|
||||
This GUID is defined in UEFI specification.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __FILE_SYSTEM_INFO_H__
|
||||
#define __FILE_SYSTEM_INFO_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define EFI_FILE_SYSTEM_INFO_ID \
|
||||
{ \
|
||||
@ -22,27 +28,27 @@ typedef struct {
|
||||
///
|
||||
/// The size of the EFI_FILE_SYSTEM_INFO structure, including the Null-terminated VolumeLabel string.
|
||||
///
|
||||
UINT64 Size;
|
||||
UINT64 Size;
|
||||
///
|
||||
/// TRUE if the volume only supports read access.
|
||||
///
|
||||
BOOLEAN ReadOnly;
|
||||
BOOLEAN ReadOnly;
|
||||
///
|
||||
/// The number of bytes managed by the file system.
|
||||
///
|
||||
UINT64 VolumeSize;
|
||||
UINT64 VolumeSize;
|
||||
///
|
||||
/// The number of available bytes for use by the file system.
|
||||
///
|
||||
UINT64 FreeSpace;
|
||||
UINT64 FreeSpace;
|
||||
///
|
||||
/// The nominal block size by which files are typically grown.
|
||||
///
|
||||
UINT32 BlockSize;
|
||||
UINT32 BlockSize;
|
||||
///
|
||||
/// The Null-terminated string that is the volume's label.
|
||||
///
|
||||
CHAR16 VolumeLabel[1];
|
||||
CHAR16 VolumeLabel[1];
|
||||
} EFI_FILE_SYSTEM_INFO;
|
||||
|
||||
///
|
||||
@ -54,6 +60,6 @@ typedef struct {
|
||||
///
|
||||
#define SIZE_OF_EFI_FILE_SYSTEM_INFO OFFSET_OF (EFI_FILE_SYSTEM_INFO, VolumeLabel)
|
||||
|
||||
extern EFI_GUID gEfiFileSystemInfoGuid;
|
||||
extern EFI_GUID gEfiFileSystemInfoGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
/** @file
|
||||
Guid used to identify HII FormMap configuration method.
|
||||
|
||||
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUID defined in UEFI 2.2 spec.
|
||||
@ -11,11 +17,11 @@
|
||||
#ifndef __EFI_HII_FORMMAP_GUID_H__
|
||||
#define __EFI_HII_FORMMAP_GUID_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define EFI_HII_STANDARD_FORM_GUID \
|
||||
{ 0x3bd2f4ec, 0xe524, 0x46e4, { 0xa9, 0xd8, 0x51, 0x1, 0x17, 0x42, 0x55, 0x62 } }
|
||||
|
||||
extern EFI_GUID gEfiHiiStandardFormGuid;
|
||||
extern EFI_GUID gEfiHiiStandardFormGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,8 +2,14 @@
|
||||
GUID indicates that the form set contains forms designed to be used
|
||||
for platform configuration and this form set will be displayed.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUID defined in UEFI 2.1.
|
||||
@ -13,7 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef __HII_PLATFORM_SETUP_FORMSET_GUID_H__
|
||||
#define __HII_PLATFORM_SETUP_FORMSET_GUID_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define EFI_HII_PLATFORM_SETUP_FORMSET_GUID \
|
||||
{ 0x93039971, 0x8545, 0x4b04, { 0xb4, 0x5e, 0x32, 0xeb, 0x83, 0x26, 0x4, 0xe } }
|
||||
@ -24,12 +30,8 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
#define EFI_HII_USER_CREDENTIAL_FORMSET_GUID \
|
||||
{ 0x337f4407, 0x5aee, 0x4b83, { 0xb2, 0xa7, 0x4e, 0xad, 0xca, 0x30, 0x88, 0xcd } }
|
||||
|
||||
#define EFI_HII_REST_STYLE_FORMSET_GUID \
|
||||
{ 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 } }
|
||||
|
||||
extern EFI_GUID gEfiHiiPlatformSetupFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiDriverHealthFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiUserCredentialFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiRestStyleFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiPlatformSetupFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiDriverHealthFormsetGuid;
|
||||
extern EFI_GUID gEfiHiiUserCredentialFormsetGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,19 +1,25 @@
|
||||
/** @file
|
||||
EDKII extented HII IFR guid opcodes.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MDEMODULE_HII_H__
|
||||
#define __MDEMODULE_HII_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define NARROW_CHAR 0xFFF0
|
||||
#define WIDE_CHAR 0xFFF1
|
||||
#define NON_BREAKING_CHAR 0xFFF2
|
||||
#define NARROW_CHAR 0xFFF0
|
||||
#define WIDE_CHAR 0xFFF1
|
||||
#define NON_BREAKING_CHAR 0xFFF2
|
||||
|
||||
///
|
||||
/// State defined for password statemachine .
|
||||
@ -32,91 +38,91 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
///
|
||||
/// EDKII implementation extension opcodes, new extension can be added here later.
|
||||
///
|
||||
#define EFI_IFR_EXTEND_OP_LABEL 0x0
|
||||
#define EFI_IFR_EXTEND_OP_BANNER 0x1
|
||||
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
|
||||
#define EFI_IFR_EXTEND_OP_CLASS 0x3
|
||||
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
|
||||
#define EFI_IFR_EXTEND_OP_LABEL 0x0
|
||||
#define EFI_IFR_EXTEND_OP_BANNER 0x1
|
||||
#define EFI_IFR_EXTEND_OP_TIMEOUT 0x2
|
||||
#define EFI_IFR_EXTEND_OP_CLASS 0x3
|
||||
#define EFI_IFR_EXTEND_OP_SUBCLASS 0x4
|
||||
|
||||
///
|
||||
/// Label opcode.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_LABEL {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_TIANO_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_LABEL.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT8 ExtendOpCode;
|
||||
///
|
||||
/// Label Number.
|
||||
///
|
||||
UINT16 Number;
|
||||
UINT16 Number;
|
||||
} EFI_IFR_GUID_LABEL;
|
||||
|
||||
#define EFI_IFR_BANNER_ALIGN_LEFT 0
|
||||
#define EFI_IFR_BANNER_ALIGN_CENTER 1
|
||||
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
|
||||
#define EFI_IFR_BANNER_ALIGN_LEFT 0
|
||||
#define EFI_IFR_BANNER_ALIGN_CENTER 1
|
||||
#define EFI_IFR_BANNER_ALIGN_RIGHT 2
|
||||
|
||||
///
|
||||
/// Banner opcode.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_BANNER {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_TIANO_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_BANNER
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
EFI_STRING_ID Title; ///< The string token for the banner title.
|
||||
UINT16 LineNumber; ///< 1-based line number.
|
||||
UINT8 Alignment; ///< left, center, or right-aligned.
|
||||
UINT8 ExtendOpCode;
|
||||
EFI_STRING_ID Title; ///< The string token for the banner title.
|
||||
UINT16 LineNumber; ///< 1-based line number.
|
||||
UINT8 Alignment; ///< left, center, or right-aligned.
|
||||
} EFI_IFR_GUID_BANNER;
|
||||
|
||||
///
|
||||
/// Timeout opcode.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_TIMEOUT {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_TIANO_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_TIMEOUT.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 TimeOut; ///< TimeOut Value.
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 TimeOut; ///< TimeOut Value.
|
||||
} EFI_IFR_GUID_TIMEOUT;
|
||||
|
||||
#define EFI_NON_DEVICE_CLASS 0x00
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
#define EFI_NON_DEVICE_CLASS 0x00
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
#define EFI_VIDEO_DEVICE_CLASS 0x02
|
||||
#define EFI_NETWORK_DEVICE_CLASS 0x04
|
||||
#define EFI_INPUT_DEVICE_CLASS 0x08
|
||||
#define EFI_ON_BOARD_DEVICE_CLASS 0x10
|
||||
#define EFI_OTHER_DEVICE_CLASS 0x20
|
||||
|
||||
///
|
||||
/// Device Class opcode.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_CLASS {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_TIANO_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_CLASS.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 Class; ///< Device Class from the above.
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 Class; ///< Device Class from the above.
|
||||
} EFI_IFR_GUID_CLASS;
|
||||
|
||||
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
|
||||
@ -128,16 +134,16 @@ typedef struct _EFI_IFR_GUID_CLASS {
|
||||
/// SubClass opcode
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_SUBCLASS {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_TIANO_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_SUBCLASS.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 SubClass; ///< Sub Class type from the above.
|
||||
UINT8 ExtendOpCode;
|
||||
UINT16 SubClass; ///< Sub Class type from the above.
|
||||
} EFI_IFR_GUID_SUBCLASS;
|
||||
|
||||
///
|
||||
@ -151,83 +157,66 @@ typedef struct _EFI_IFR_GUID_SUBCLASS {
|
||||
/// One is for framework OneOf question Option Key value;
|
||||
/// another is for framework vareqval.
|
||||
///
|
||||
#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
|
||||
#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
|
||||
#define EFI_IFR_EXTEND_OP_OPTIONKEY 0x0
|
||||
#define EFI_IFR_EXTEND_OP_VAREQNAME 0x1
|
||||
|
||||
///
|
||||
/// Store the framework vfr option key value.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_OPTIONKEY {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_FRAMEWORK_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_OPTIONKEY.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT8 ExtendOpCode;
|
||||
///
|
||||
/// OneOf Questiond ID binded by OneOf Option.
|
||||
///
|
||||
EFI_QUESTION_ID QuestionId;
|
||||
EFI_QUESTION_ID QuestionId;
|
||||
///
|
||||
/// The OneOf Option Value.
|
||||
///
|
||||
EFI_IFR_TYPE_VALUE OptionValue;
|
||||
EFI_IFR_TYPE_VALUE OptionValue;
|
||||
///
|
||||
/// The Framework OneOf Option Key Value.
|
||||
///
|
||||
UINT16 KeyValue;
|
||||
UINT16 KeyValue;
|
||||
} EFI_IFR_GUID_OPTIONKEY;
|
||||
|
||||
///
|
||||
/// Store the framework vfr vareqval name number.
|
||||
///
|
||||
typedef struct _EFI_IFR_GUID_VAREQNAME {
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
EFI_IFR_OP_HEADER Header;
|
||||
///
|
||||
/// EFI_IFR_FRAMEWORK_GUID.
|
||||
///
|
||||
EFI_GUID Guid;
|
||||
EFI_GUID Guid;
|
||||
///
|
||||
/// EFI_IFR_EXTEND_OP_VAREQNAME.
|
||||
///
|
||||
UINT8 ExtendOpCode;
|
||||
UINT8 ExtendOpCode;
|
||||
///
|
||||
/// Question ID of the Numeric Opcode created.
|
||||
///
|
||||
EFI_QUESTION_ID QuestionId;
|
||||
EFI_QUESTION_ID QuestionId;
|
||||
///
|
||||
/// For vareqval (0x100), NameId is 0x100.
|
||||
/// This value will convert to a Unicode String following this rule;
|
||||
/// sprintf(StringBuffer, "%d", NameId) .
|
||||
/// The the Unicode String will be used as a EFI Variable Name.
|
||||
///
|
||||
UINT16 NameId;
|
||||
UINT16 NameId;
|
||||
} EFI_IFR_GUID_VAREQNAME;
|
||||
|
||||
///
|
||||
/// EDKII implementation extension GUID, used to indaicate there are bit fields in the varstore.
|
||||
///
|
||||
#define EDKII_IFR_BIT_VARSTORE_GUID \
|
||||
{0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60,0xA7, 0x1D}}
|
||||
|
||||
///
|
||||
/// EDKII implementation extension flags, used to indaicate the disply style and bit width for bit filed storage.
|
||||
/// Two high bits for display style and the low six bits for bit width.
|
||||
///
|
||||
#define EDKII_IFR_DISPLAY_BIT 0xC0
|
||||
#define EDKII_IFR_DISPLAY_INT_DEC_BIT 0x00
|
||||
#define EDKII_IFR_DISPLAY_UINT_DEC_BIT 0x40
|
||||
#define EDKII_IFR_DISPLAY_UINT_HEX_BIT 0x80
|
||||
|
||||
#define EDKII_IFR_NUMERIC_SIZE_BIT 0x3F
|
||||
|
||||
#pragma pack()
|
||||
|
||||
extern EFI_GUID gEfiIfrTianoGuid;
|
||||
extern EFI_GUID gEfiIfrFrameworkGuid;
|
||||
extern EFI_GUID gEdkiiIfrBitVarstoreGuid;
|
||||
extern EFI_GUID gEfiIfrTianoGuid;
|
||||
extern EFI_GUID gEfiIfrFrameworkGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,8 +1,14 @@
|
||||
/** @file
|
||||
Terminal Device Path Vendor Guid.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUIDs defined in UEFI 2.0 spec.
|
||||
@ -12,7 +18,7 @@
|
||||
#ifndef __PC_ANSI_H__
|
||||
#define __PC_ANSI_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define EFI_PC_ANSI_GUID \
|
||||
{ \
|
||||
@ -44,11 +50,11 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
0xd487ddb4, 0x008b, 0x11d9, {0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiPcAnsiGuid;
|
||||
extern EFI_GUID gEfiVT100Guid;
|
||||
extern EFI_GUID gEfiVT100PlusGuid;
|
||||
extern EFI_GUID gEfiVTUTF8Guid;
|
||||
extern EFI_GUID gEfiUartDevicePathGuid;
|
||||
extern EFI_GUID gEfiSasDevicePathGuid;
|
||||
extern EFI_GUID gEfiPcAnsiGuid;
|
||||
extern EFI_GUID gEfiVT100Guid;
|
||||
extern EFI_GUID gEfiVT100PlusGuid;
|
||||
extern EFI_GUID gEfiVTUTF8Guid;
|
||||
extern EFI_GUID gEfiUartDevicePathGuid;
|
||||
extern EFI_GUID gEfiSasDevicePathGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -5,8 +5,14 @@
|
||||
locate the SMBIOS tables. Do not search the 0xF0000 segment to find SMBIOS
|
||||
tables.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUIDs defined in UEFI 2.5 spec.
|
||||
@ -16,7 +22,7 @@
|
||||
#ifndef __SMBIOS_GUID_H__
|
||||
#define __SMBIOS_GUID_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#define SMBIOS_TABLE_GUID \
|
||||
{ \
|
||||
@ -28,7 +34,7 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEfiSmbiosTableGuid;
|
||||
extern EFI_GUID gEfiSmbios3TableGuid;
|
||||
extern EFI_GUID gEfiSmbiosTableGuid;
|
||||
extern EFI_GUID gEfiSmbios3TableGuid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,7 +2,13 @@
|
||||
GUID for UEFI WIN_CERTIFICATE structure.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
@par Revision Reference:
|
||||
GUID defined in UEFI 2.0 spec.
|
||||
@ -11,14 +17,14 @@
|
||||
#ifndef __EFI_WIN_CERTIFICATE_H__
|
||||
#define __EFI_WIN_CERTIFICATE_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
//
|
||||
// _WIN_CERTIFICATE.wCertificateType
|
||||
//
|
||||
#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
|
||||
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
|
||||
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
|
||||
#define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
|
||||
#define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
|
||||
#define WIN_CERT_TYPE_EFI_GUID 0x0EF1
|
||||
|
||||
///
|
||||
/// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
|
||||
@ -28,18 +34,18 @@ typedef struct {
|
||||
/// The length of the entire certificate,
|
||||
/// including the length of the header, in bytes.
|
||||
///
|
||||
UINT32 dwLength;
|
||||
UINT32 dwLength;
|
||||
///
|
||||
/// The revision level of the WIN_CERTIFICATE
|
||||
/// structure. The current revision level is 0x0200.
|
||||
///
|
||||
UINT16 wRevision;
|
||||
UINT16 wRevision;
|
||||
///
|
||||
/// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI
|
||||
/// certificate types. The UEFI specification reserves the range of
|
||||
/// certificate type values from 0x0EF0 to 0x0EFF.
|
||||
///
|
||||
UINT16 wCertificateType;
|
||||
UINT16 wCertificateType;
|
||||
///
|
||||
/// The following is the actual certificate. The format of
|
||||
/// the certificate depends on wCertificateType.
|
||||
@ -58,11 +64,12 @@ typedef struct {
|
||||
/// WIN_CERTIFICATE_UEFI_GUID.CertData
|
||||
///
|
||||
typedef struct {
|
||||
EFI_GUID HashType;
|
||||
UINT8 PublicKey[256];
|
||||
UINT8 Signature[256];
|
||||
EFI_GUID HashType;
|
||||
UINT8 PublicKey[256];
|
||||
UINT8 Signature[256];
|
||||
} EFI_CERT_BLOCK_RSA_2048_SHA256;
|
||||
|
||||
|
||||
///
|
||||
/// Certificate which encapsulates a GUID-specific digital signature
|
||||
///
|
||||
@ -71,21 +78,22 @@ typedef struct {
|
||||
/// This is the standard WIN_CERTIFICATE header, where
|
||||
/// wCertificateType is set to WIN_CERT_TYPE_EFI_GUID.
|
||||
///
|
||||
WIN_CERTIFICATE Hdr;
|
||||
WIN_CERTIFICATE Hdr;
|
||||
///
|
||||
/// This is the unique id which determines the
|
||||
/// format of the CertData. .
|
||||
///
|
||||
EFI_GUID CertType;
|
||||
EFI_GUID CertType;
|
||||
///
|
||||
/// The following is the certificate data. The format of
|
||||
/// the data is determined by the CertType.
|
||||
/// If CertType is EFI_CERT_TYPE_RSA2048_SHA256_GUID,
|
||||
/// the CertData will be EFI_CERT_BLOCK_RSA_2048_SHA256 structure.
|
||||
///
|
||||
UINT8 CertData[1];
|
||||
UINT8 CertData[1];
|
||||
} WIN_CERTIFICATE_UEFI_GUID;
|
||||
|
||||
|
||||
///
|
||||
/// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.
|
||||
///
|
||||
@ -99,12 +107,12 @@ typedef struct {
|
||||
/// This is the standard WIN_CERTIFICATE header, where
|
||||
/// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15.
|
||||
///
|
||||
WIN_CERTIFICATE Hdr;
|
||||
WIN_CERTIFICATE Hdr;
|
||||
///
|
||||
/// This is the hashing algorithm which was performed on the
|
||||
/// UEFI executable when creating the digital signature.
|
||||
///
|
||||
EFI_GUID HashAlgorithm;
|
||||
EFI_GUID HashAlgorithm;
|
||||
///
|
||||
/// The following is the actual digital signature. The
|
||||
/// size of the signature is the same size as the key
|
||||
@ -117,6 +125,6 @@ typedef struct {
|
||||
///
|
||||
} WIN_CERTIFICATE_EFI_PKCS1_15;
|
||||
|
||||
extern EFI_GUID gEfiCertTypeRsa2048Sha256Guid;
|
||||
extern EFI_GUID gEfiCertTypeRsa2048Sha256Guid;
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,15 +1,21 @@
|
||||
/** @file
|
||||
Processor or Compiler specific defines and types for IA-32 architecture.
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PROCESSOR_BIND_H__
|
||||
#define __PROCESSOR_BIND_H__
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
///
|
||||
/// Define the processor type so other code can make processor based choices.
|
||||
@ -19,38 +25,39 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
//
|
||||
// Make sure we are using the correct packing rules per EFI specification
|
||||
//
|
||||
#if !defined (__GNUC__)
|
||||
#pragma pack()
|
||||
#if !defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#if defined (__INTEL_COMPILER)
|
||||
#if defined(__INTEL_COMPILER)
|
||||
//
|
||||
// Disable ICC's remark #869: "Parameter" was never referenced warning.
|
||||
// This is legal ANSI C code so we disable the remark that is turned on with -Wall
|
||||
//
|
||||
#pragma warning ( disable : 869 )
|
||||
#pragma warning ( disable : 869 )
|
||||
|
||||
//
|
||||
// Disable ICC's remark #1418: external function definition with no prior declaration.
|
||||
// This is legal ANSI C code so we disable the remark that is turned on with /W4
|
||||
//
|
||||
#pragma warning ( disable : 1418 )
|
||||
#pragma warning ( disable : 1418 )
|
||||
|
||||
//
|
||||
// Disable ICC's remark #1419: external declaration in primary source file
|
||||
// This is legal ANSI C code so we disable the remark that is turned on with /W4
|
||||
//
|
||||
#pragma warning ( disable : 1419 )
|
||||
#pragma warning ( disable : 1419 )
|
||||
|
||||
//
|
||||
// Disable ICC's remark #593: "Variable" was set but never used.
|
||||
// This is legal ANSI C code so we disable the remark that is turned on with /W4
|
||||
//
|
||||
#pragma warning ( disable : 593 )
|
||||
#pragma warning ( disable : 593 )
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
|
||||
#if defined(_MSC_EXTENSIONS)
|
||||
|
||||
//
|
||||
// Disable warning that make it impossible to compile at /W4
|
||||
@ -60,35 +67,35 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
//
|
||||
// Disabling bitfield type checking warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4214 )
|
||||
#pragma warning ( disable : 4214 )
|
||||
|
||||
//
|
||||
// Disabling the unreferenced formal parameter warnings.
|
||||
//
|
||||
#pragma warning ( disable : 4100 )
|
||||
#pragma warning ( disable : 4100 )
|
||||
|
||||
//
|
||||
// Disable slightly different base types warning as CHAR8 * can not be set
|
||||
// to a constant string.
|
||||
//
|
||||
#pragma warning ( disable : 4057 )
|
||||
#pragma warning ( disable : 4057 )
|
||||
|
||||
//
|
||||
// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
|
||||
//
|
||||
#pragma warning ( disable : 4127 )
|
||||
#pragma warning ( disable : 4127 )
|
||||
|
||||
//
|
||||
// This warning is caused by functions defined but not used. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4505 )
|
||||
#pragma warning ( disable : 4505 )
|
||||
|
||||
//
|
||||
// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
|
||||
//
|
||||
#pragma warning ( disable : 4206 )
|
||||
#pragma warning ( disable : 4206 )
|
||||
|
||||
#if defined (_MSC_VER) && _MSC_VER >= 1800
|
||||
#if _MSC_VER == 1800 || _MSC_VER == 1900
|
||||
|
||||
//
|
||||
// Disable these warnings for VS2013.
|
||||
@ -98,129 +105,130 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
// This warning is for potentially uninitialized local variable, and it may cause false
|
||||
// positive issues in VS2013 and VS2015 build
|
||||
//
|
||||
#pragma warning ( disable : 4701 )
|
||||
#pragma warning ( disable : 4701 )
|
||||
|
||||
//
|
||||
// This warning is for potentially uninitialized local pointer variable, and it may cause
|
||||
// false positive issues in VS2013 and VS2015 build
|
||||
//
|
||||
#pragma warning ( disable : 4703 )
|
||||
|
||||
#endif
|
||||
#pragma warning ( disable : 4703 )
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_EXTENSIONS)
|
||||
#endif
|
||||
|
||||
//
|
||||
// use Microsoft C compiler dependent integer width types
|
||||
//
|
||||
|
||||
///
|
||||
/// 8-byte unsigned value.
|
||||
///
|
||||
typedef unsigned __int64 UINT64;
|
||||
///
|
||||
/// 8-byte signed value.
|
||||
///
|
||||
typedef __int64 INT64;
|
||||
///
|
||||
/// 4-byte unsigned value.
|
||||
///
|
||||
typedef unsigned __int32 UINT32;
|
||||
///
|
||||
/// 4-byte signed value.
|
||||
///
|
||||
typedef __int32 INT32;
|
||||
///
|
||||
/// 2-byte unsigned value.
|
||||
///
|
||||
typedef unsigned short UINT16;
|
||||
///
|
||||
/// 2-byte Character. Unless otherwise specified all strings are stored in the
|
||||
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
|
||||
///
|
||||
typedef unsigned short CHAR16;
|
||||
///
|
||||
/// 2-byte signed value.
|
||||
///
|
||||
typedef short INT16;
|
||||
///
|
||||
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
|
||||
/// values are undefined.
|
||||
///
|
||||
typedef unsigned char BOOLEAN;
|
||||
///
|
||||
/// 1-byte unsigned value.
|
||||
///
|
||||
typedef unsigned char UINT8;
|
||||
///
|
||||
/// 1-byte Character.
|
||||
///
|
||||
typedef char CHAR8;
|
||||
///
|
||||
/// 1-byte signed value.
|
||||
///
|
||||
typedef signed char INT8;
|
||||
#if defined(_MSC_EXTENSIONS)
|
||||
|
||||
//
|
||||
// use Microsoft C compiler dependent integer width types
|
||||
//
|
||||
|
||||
///
|
||||
/// 8-byte unsigned value.
|
||||
///
|
||||
typedef unsigned __int64 UINT64;
|
||||
///
|
||||
/// 8-byte signed value.
|
||||
///
|
||||
typedef __int64 INT64;
|
||||
///
|
||||
/// 4-byte unsigned value.
|
||||
///
|
||||
typedef unsigned __int32 UINT32;
|
||||
///
|
||||
/// 4-byte signed value.
|
||||
///
|
||||
typedef __int32 INT32;
|
||||
///
|
||||
/// 2-byte unsigned value.
|
||||
///
|
||||
typedef unsigned short UINT16;
|
||||
///
|
||||
/// 2-byte Character. Unless otherwise specified all strings are stored in the
|
||||
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
|
||||
///
|
||||
typedef unsigned short CHAR16;
|
||||
///
|
||||
/// 2-byte signed value.
|
||||
///
|
||||
typedef short INT16;
|
||||
///
|
||||
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
|
||||
/// values are undefined.
|
||||
///
|
||||
typedef unsigned char BOOLEAN;
|
||||
///
|
||||
/// 1-byte unsigned value.
|
||||
///
|
||||
typedef unsigned char UINT8;
|
||||
///
|
||||
/// 1-byte Character.
|
||||
///
|
||||
typedef char CHAR8;
|
||||
///
|
||||
/// 1-byte signed value.
|
||||
///
|
||||
typedef signed char INT8;
|
||||
#else
|
||||
///
|
||||
/// 8-byte unsigned value.
|
||||
///
|
||||
typedef unsigned long long UINT64;
|
||||
///
|
||||
/// 8-byte signed value.
|
||||
///
|
||||
typedef long long INT64;
|
||||
///
|
||||
/// 4-byte unsigned value.
|
||||
///
|
||||
typedef unsigned int UINT32;
|
||||
///
|
||||
/// 4-byte signed value.
|
||||
///
|
||||
typedef int INT32;
|
||||
///
|
||||
/// 2-byte unsigned value.
|
||||
///
|
||||
typedef unsigned short UINT16;
|
||||
///
|
||||
/// 2-byte Character. Unless otherwise specified all strings are stored in the
|
||||
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
|
||||
///
|
||||
typedef unsigned short CHAR16;
|
||||
///
|
||||
/// 2-byte signed value.
|
||||
///
|
||||
typedef short INT16;
|
||||
///
|
||||
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
|
||||
/// values are undefined.
|
||||
///
|
||||
typedef unsigned char BOOLEAN;
|
||||
///
|
||||
/// 1-byte unsigned value.
|
||||
///
|
||||
typedef unsigned char UINT8;
|
||||
///
|
||||
/// 1-byte Character
|
||||
///
|
||||
typedef char CHAR8;
|
||||
///
|
||||
/// 1-byte signed value
|
||||
///
|
||||
typedef signed char INT8;
|
||||
///
|
||||
/// 8-byte unsigned value.
|
||||
///
|
||||
typedef unsigned long long UINT64;
|
||||
///
|
||||
/// 8-byte signed value.
|
||||
///
|
||||
typedef long long INT64;
|
||||
///
|
||||
/// 4-byte unsigned value.
|
||||
///
|
||||
typedef unsigned int UINT32;
|
||||
///
|
||||
/// 4-byte signed value.
|
||||
///
|
||||
typedef int INT32;
|
||||
///
|
||||
/// 2-byte unsigned value.
|
||||
///
|
||||
typedef unsigned short UINT16;
|
||||
///
|
||||
/// 2-byte Character. Unless otherwise specified all strings are stored in the
|
||||
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
|
||||
///
|
||||
typedef unsigned short CHAR16;
|
||||
///
|
||||
/// 2-byte signed value.
|
||||
///
|
||||
typedef short INT16;
|
||||
///
|
||||
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
|
||||
/// values are undefined.
|
||||
///
|
||||
typedef unsigned char BOOLEAN;
|
||||
///
|
||||
/// 1-byte unsigned value.
|
||||
///
|
||||
typedef unsigned char UINT8;
|
||||
///
|
||||
/// 1-byte Character
|
||||
///
|
||||
typedef char CHAR8;
|
||||
///
|
||||
/// 1-byte signed value
|
||||
///
|
||||
typedef signed char INT8;
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
|
||||
/// 8 bytes on supported 64-bit processor instructions.)
|
||||
///
|
||||
typedef UINT32 UINTN;
|
||||
typedef UINT32 UINTN;
|
||||
///
|
||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
|
||||
/// 8 bytes on supported 64-bit processor instructions.)
|
||||
///
|
||||
typedef INT32 INTN;
|
||||
typedef INT32 INTN;
|
||||
|
||||
//
|
||||
// Processor specific defines
|
||||
@ -229,7 +237,7 @@ typedef INT32 INTN;
|
||||
///
|
||||
/// A value of native width with the highest bit set.
|
||||
///
|
||||
#define MAX_BIT 0x80000000
|
||||
#define MAX_BIT 0x80000000
|
||||
///
|
||||
/// A value of native width with the two highest bits set.
|
||||
///
|
||||
@ -238,12 +246,7 @@ typedef INT32 INTN;
|
||||
///
|
||||
/// Maximum legal IA-32 address.
|
||||
///
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
///
|
||||
/// Maximum usable address at boot time
|
||||
///
|
||||
#define MAX_ALLOC_ADDRESS MAX_ADDRESS
|
||||
#define MAX_ADDRESS 0xFFFFFFFF
|
||||
|
||||
///
|
||||
/// Maximum legal IA-32 INTN and UINTN values.
|
||||
@ -251,21 +254,16 @@ typedef INT32 INTN;
|
||||
#define MAX_INTN ((INTN)0x7FFFFFFF)
|
||||
#define MAX_UINTN ((UINTN)0xFFFFFFFF)
|
||||
|
||||
///
|
||||
/// Minimum legal IA-32 INTN value.
|
||||
///
|
||||
#define MIN_INTN (((INTN)-2147483647) - 1)
|
||||
|
||||
///
|
||||
/// The stack alignment required for IA-32.
|
||||
///
|
||||
#define CPU_STACK_ALIGNMENT sizeof(UINTN)
|
||||
#define CPU_STACK_ALIGNMENT sizeof(UINTN)
|
||||
|
||||
///
|
||||
/// Page allocation granularity for IA-32.
|
||||
///
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
|
||||
|
||||
//
|
||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||
@ -273,33 +271,33 @@ typedef INT32 INTN;
|
||||
// EFI intrinsics are required to modify their member functions with EFIAPI.
|
||||
//
|
||||
#ifdef EFIAPI
|
||||
///
|
||||
/// If EFIAPI is already defined, then we use that definition.
|
||||
///
|
||||
#elif defined (_MSC_EXTENSIONS)
|
||||
///
|
||||
/// Microsoft* compiler specific method for EFIAPI calling convention.
|
||||
///
|
||||
#define EFIAPI __cdecl
|
||||
#elif defined (__GNUC__) || defined (__clang__)
|
||||
///
|
||||
/// GCC specific method for EFIAPI calling convention.
|
||||
///
|
||||
#define EFIAPI __attribute__((cdecl))
|
||||
///
|
||||
/// If EFIAPI is already defined, then we use that definition.
|
||||
///
|
||||
#elif defined(_MSC_EXTENSIONS)
|
||||
///
|
||||
/// Microsoft* compiler specific method for EFIAPI calling convention.
|
||||
///
|
||||
#define EFIAPI __cdecl
|
||||
#elif defined(__GNUC__)
|
||||
///
|
||||
/// GCC specific method for EFIAPI calling convention.
|
||||
///
|
||||
#define EFIAPI __attribute__((cdecl))
|
||||
#else
|
||||
///
|
||||
/// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
|
||||
/// is the standard.
|
||||
///
|
||||
#define EFIAPI
|
||||
///
|
||||
/// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
|
||||
/// is the standard.
|
||||
///
|
||||
#define EFIAPI
|
||||
#endif
|
||||
|
||||
#if defined (__GNUC__) || defined (__clang__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
#if defined(__GNUC__)
|
||||
///
|
||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||
/// Define this macro to unify the usage.
|
||||
///
|
||||
#define ASM_GLOBAL .globl
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -312,10 +310,11 @@ typedef INT32 INTN;
|
||||
@return The pointer to the first instruction of a function given a function pointer.
|
||||
|
||||
**/
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
|
||||
|
||||
#ifndef __USER_LABEL_PREFIX__
|
||||
#define __USER_LABEL_PREFIX__ _
|
||||
#define __USER_LABEL_PREFIX__ _
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,15 +1,20 @@
|
||||
/** @file
|
||||
ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#ifndef _ACPI_1_0_H_
|
||||
#define _ACPI_1_0_H_
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#include <ipxe/efi/IndustryStandard/AcpiAml.h>
|
||||
|
||||
@ -18,8 +23,8 @@ FILE_LICENCE ( BSD2_PATENT );
|
||||
/// excluding the RSD PTR structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
} EFI_ACPI_COMMON_HEADER;
|
||||
|
||||
#pragma pack(1)
|
||||
@ -27,84 +32,84 @@ typedef struct {
|
||||
/// The common ACPI description table header. This structure prefaces most ACPI tables.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT8 Revision;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT64 OemTableId;
|
||||
UINT32 OemRevision;
|
||||
UINT32 CreatorId;
|
||||
UINT32 CreatorRevision;
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT8 Revision;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT64 OemTableId;
|
||||
UINT32 OemRevision;
|
||||
UINT32 CreatorId;
|
||||
UINT32 CreatorRevision;
|
||||
} EFI_ACPI_DESCRIPTION_HEADER;
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// Define for Descriptor
|
||||
// Define for Desriptor
|
||||
//
|
||||
#define ACPI_SMALL_ITEM_FLAG 0x00
|
||||
#define ACPI_LARGE_ITEM_FLAG 0x01
|
||||
#define ACPI_SMALL_ITEM_FLAG 0x00
|
||||
#define ACPI_LARGE_ITEM_FLAG 0x01
|
||||
|
||||
//
|
||||
// Small Item Descriptor Name
|
||||
//
|
||||
#define ACPI_SMALL_IRQ_DESCRIPTOR_NAME 0x04
|
||||
#define ACPI_SMALL_DMA_DESCRIPTOR_NAME 0x05
|
||||
#define ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME 0x06
|
||||
#define ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME 0x07
|
||||
#define ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME 0x08
|
||||
#define ACPI_SMALL_FIXED_IO_PORT_DESCRIPTOR_NAME 0x09
|
||||
#define ACPI_SMALL_VENDOR_DEFINED_DESCRIPTOR_NAME 0x0E
|
||||
#define ACPI_SMALL_END_TAG_DESCRIPTOR_NAME 0x0F
|
||||
#define ACPI_SMALL_IRQ_DESCRIPTOR_NAME 0x04
|
||||
#define ACPI_SMALL_DMA_DESCRIPTOR_NAME 0x05
|
||||
#define ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME 0x06
|
||||
#define ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME 0x07
|
||||
#define ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME 0x08
|
||||
#define ACPI_SMALL_FIXED_IO_PORT_DESCRIPTOR_NAME 0x09
|
||||
#define ACPI_SMALL_VENDOR_DEFINED_DESCRIPTOR_NAME 0x0E
|
||||
#define ACPI_SMALL_END_TAG_DESCRIPTOR_NAME 0x0F
|
||||
|
||||
//
|
||||
// Large Item Descriptor Name
|
||||
//
|
||||
#define ACPI_LARGE_24_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x01
|
||||
#define ACPI_LARGE_VENDOR_DEFINED_DESCRIPTOR_NAME 0x04
|
||||
#define ACPI_LARGE_32_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x05
|
||||
#define ACPI_LARGE_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR_NAME 0x06
|
||||
#define ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x07
|
||||
#define ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x08
|
||||
#define ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME 0x09
|
||||
#define ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0A
|
||||
#define ACPI_LARGE_24_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x01
|
||||
#define ACPI_LARGE_VENDOR_DEFINED_DESCRIPTOR_NAME 0x04
|
||||
#define ACPI_LARGE_32_BIT_MEMORY_RANGE_DESCRIPTOR_NAME 0x05
|
||||
#define ACPI_LARGE_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR_NAME 0x06
|
||||
#define ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x07
|
||||
#define ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x08
|
||||
#define ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME 0x09
|
||||
#define ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0A
|
||||
|
||||
//
|
||||
// Small Item Descriptor Value
|
||||
//
|
||||
#define ACPI_IRQ_NOFLAG_DESCRIPTOR 0x22
|
||||
#define ACPI_IRQ_DESCRIPTOR 0x23
|
||||
#define ACPI_DMA_DESCRIPTOR 0x2A
|
||||
#define ACPI_START_DEPENDENT_DESCRIPTOR 0x30
|
||||
#define ACPI_START_DEPENDENT_EX_DESCRIPTOR 0x31
|
||||
#define ACPI_END_DEPENDENT_DESCRIPTOR 0x38
|
||||
#define ACPI_IO_PORT_DESCRIPTOR 0x47
|
||||
#define ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR 0x4B
|
||||
#define ACPI_END_TAG_DESCRIPTOR 0x79
|
||||
#define ACPI_IRQ_NOFLAG_DESCRIPTOR 0x22
|
||||
#define ACPI_IRQ_DESCRIPTOR 0x23
|
||||
#define ACPI_DMA_DESCRIPTOR 0x2A
|
||||
#define ACPI_START_DEPENDENT_DESCRIPTOR 0x30
|
||||
#define ACPI_START_DEPENDENT_EX_DESCRIPTOR 0x31
|
||||
#define ACPI_END_DEPENDENT_DESCRIPTOR 0x38
|
||||
#define ACPI_IO_PORT_DESCRIPTOR 0x47
|
||||
#define ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR 0x4B
|
||||
#define ACPI_END_TAG_DESCRIPTOR 0x79
|
||||
|
||||
//
|
||||
// Large Item Descriptor Value
|
||||
//
|
||||
#define ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR 0x81
|
||||
#define ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR 0x85
|
||||
#define ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR 0x86
|
||||
#define ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR 0x87
|
||||
#define ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR 0x88
|
||||
#define ACPI_EXTENDED_INTERRUPT_DESCRIPTOR 0x89
|
||||
#define ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR 0x8A
|
||||
#define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
|
||||
#define ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR 0x81
|
||||
#define ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR 0x85
|
||||
#define ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR 0x86
|
||||
#define ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR 0x87
|
||||
#define ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR 0x88
|
||||
#define ACPI_EXTENDED_INTERRUPT_DESCRIPTOR 0x89
|
||||
#define ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR 0x8A
|
||||
#define ACPI_ADDRESS_SPACE_DESCRIPTOR 0x8A
|
||||
|
||||
//
|
||||
// Resource Type
|
||||
//
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_IO 0x01
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_MEM 0x00
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_IO 0x01
|
||||
#define ACPI_ADDRESS_SPACE_TYPE_BUS 0x02
|
||||
|
||||
///
|
||||
/// Power Management Timer frequency is fixed at 3.579545MHz.
|
||||
///
|
||||
#define ACPI_TIMER_FREQUENCY 3579545
|
||||
#define ACPI_TIMER_FREQUENCY 3579545
|
||||
|
||||
//
|
||||
// Ensure proper structure formats
|
||||
@ -112,87 +117,87 @@ typedef struct {
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// The common definition of QWORD, DWORD, and WORD
|
||||
/// The commond definition of QWORD, DWORD, and WORD
|
||||
/// Address Space Descriptors.
|
||||
///
|
||||
typedef PACKED struct {
|
||||
UINT8 Desc;
|
||||
UINT16 Len;
|
||||
UINT8 ResType;
|
||||
UINT8 GenFlag;
|
||||
UINT8 SpecificFlag;
|
||||
UINT64 AddrSpaceGranularity;
|
||||
UINT64 AddrRangeMin;
|
||||
UINT64 AddrRangeMax;
|
||||
UINT64 AddrTranslationOffset;
|
||||
UINT64 AddrLen;
|
||||
UINT8 Desc;
|
||||
UINT16 Len;
|
||||
UINT8 ResType;
|
||||
UINT8 GenFlag;
|
||||
UINT8 SpecificFlag;
|
||||
UINT64 AddrSpaceGranularity;
|
||||
UINT64 AddrRangeMin;
|
||||
UINT64 AddrRangeMax;
|
||||
UINT64 AddrTranslationOffset;
|
||||
UINT64 AddrLen;
|
||||
} EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
|
||||
|
||||
typedef PACKED union {
|
||||
UINT8 Byte;
|
||||
UINT8 Byte;
|
||||
PACKED struct {
|
||||
UINT8 Length : 3;
|
||||
UINT8 Name : 4;
|
||||
UINT8 Type : 1;
|
||||
UINT8 Length : 3;
|
||||
UINT8 Name : 4;
|
||||
UINT8 Type : 1;
|
||||
} Bits;
|
||||
} ACPI_SMALL_RESOURCE_HEADER;
|
||||
|
||||
typedef PACKED struct {
|
||||
PACKED union {
|
||||
UINT8 Byte;
|
||||
UINT8 Byte;
|
||||
PACKED struct {
|
||||
UINT8 Name : 7;
|
||||
UINT8 Type : 1;
|
||||
} Bits;
|
||||
UINT8 Name : 7;
|
||||
UINT8 Type : 1;
|
||||
}Bits;
|
||||
} Header;
|
||||
UINT16 Length;
|
||||
UINT16 Length;
|
||||
} ACPI_LARGE_RESOURCE_HEADER;
|
||||
|
||||
///
|
||||
/// IRQ Descriptor.
|
||||
///
|
||||
typedef PACKED struct {
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 Mask;
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 Mask;
|
||||
} EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR;
|
||||
|
||||
///
|
||||
/// IRQ Descriptor.
|
||||
///
|
||||
typedef PACKED struct {
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 Mask;
|
||||
UINT8 Information;
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 Mask;
|
||||
UINT8 Information;
|
||||
} EFI_ACPI_IRQ_DESCRIPTOR;
|
||||
|
||||
///
|
||||
/// DMA Descriptor.
|
||||
///
|
||||
typedef PACKED struct {
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT8 ChannelMask;
|
||||
UINT8 Information;
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT8 ChannelMask;
|
||||
UINT8 Information;
|
||||
} EFI_ACPI_DMA_DESCRIPTOR;
|
||||
|
||||
///
|
||||
/// I/O Port Descriptor
|
||||
///
|
||||
typedef PACKED struct {
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT8 Information;
|
||||
UINT16 BaseAddressMin;
|
||||
UINT16 BaseAddressMax;
|
||||
UINT8 Alignment;
|
||||
UINT8 Length;
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT8 Information;
|
||||
UINT16 BaseAddressMin;
|
||||
UINT16 BaseAddressMax;
|
||||
UINT8 Alignment;
|
||||
UINT8 Length;
|
||||
} EFI_ACPI_IO_PORT_DESCRIPTOR;
|
||||
|
||||
///
|
||||
/// Fixed Location I/O Port Descriptor.
|
||||
///
|
||||
typedef PACKED struct {
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 BaseAddress;
|
||||
UINT8 Length;
|
||||
ACPI_SMALL_RESOURCE_HEADER Header;
|
||||
UINT16 BaseAddress;
|
||||
UINT8 Length;
|
||||
} EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR;
|
||||
|
||||
///
|
||||
@ -290,17 +295,17 @@ typedef PACKED struct {
|
||||
/// The End tag identifies an end of resource data.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Desc;
|
||||
UINT8 Checksum;
|
||||
UINT8 Desc;
|
||||
UINT8 Checksum;
|
||||
} EFI_ACPI_END_TAG_DESCRIPTOR;
|
||||
|
||||
//
|
||||
// General use definitions
|
||||
//
|
||||
#define EFI_ACPI_RESERVED_BYTE 0x00
|
||||
#define EFI_ACPI_RESERVED_WORD 0x0000
|
||||
#define EFI_ACPI_RESERVED_DWORD 0x00000000
|
||||
#define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
|
||||
#define EFI_ACPI_RESERVED_BYTE 0x00
|
||||
#define EFI_ACPI_RESERVED_WORD 0x0000
|
||||
#define EFI_ACPI_RESERVED_DWORD 0x00000000
|
||||
#define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
|
||||
|
||||
//
|
||||
// Resource Type Specific Flags
|
||||
@ -308,86 +313,76 @@ typedef struct {
|
||||
//
|
||||
// Bit [0] : Write Status, _RW
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE (1 << 0)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 0)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE (1 << 0)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY (0 << 0)
|
||||
//
|
||||
// Bit [2:1] : Memory Attributes, _MEM
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE (3 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE (0 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE (1 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE (3 << 1)
|
||||
//
|
||||
// Bit [4:3] : Memory Attributes, _MTP
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY (0 << 3)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED (1 << 3)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI (2 << 3)
|
||||
#define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 3)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY (0 << 3)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED (1 << 3)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI (2 << 3)
|
||||
#define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS (3 << 3)
|
||||
//
|
||||
// Bit [5] : Memory to I/O Translation, _TTP
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << 5)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 5)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION (1 << 5)
|
||||
#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC (0 << 5)
|
||||
|
||||
//
|
||||
// IRQ Information
|
||||
// Ref ACPI specification 6.4.2.1
|
||||
//
|
||||
#define EFI_ACPI_IRQ_SHARABLE_MASK 0x10
|
||||
#define EFI_ACPI_IRQ_SHARABLE 0x10
|
||||
#define EFI_ACPI_IRQ_SHARABLE_MASK 0x10
|
||||
#define EFI_ACPI_IRQ_SHARABLE 0x10
|
||||
|
||||
#define EFI_ACPI_IRQ_POLARITY_MASK 0x08
|
||||
#define EFI_ACPI_IRQ_HIGH_TRUE 0x00
|
||||
#define EFI_ACPI_IRQ_LOW_FALSE 0x08
|
||||
#define EFI_ACPI_IRQ_POLARITY_MASK 0x08
|
||||
#define EFI_ACPI_IRQ_HIGH_TRUE 0x00
|
||||
#define EFI_ACPI_IRQ_LOW_FALSE 0x08
|
||||
|
||||
#define EFI_ACPI_IRQ_MODE 0x01
|
||||
#define EFI_ACPI_IRQ_LEVEL_TRIGGERED 0x00
|
||||
#define EFI_ACPI_IRQ_EDGE_TRIGGERED 0x01
|
||||
#define EFI_ACPI_IRQ_MODE 0x01
|
||||
#define EFI_ACPI_IRQ_LEVEL_TRIGGERED 0x00
|
||||
#define EFI_ACPI_IRQ_EDGE_TRIGGERED 0x01
|
||||
|
||||
//
|
||||
// DMA Information
|
||||
// Ref ACPI specification 6.4.2.2
|
||||
//
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_MASK 0x60
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_A 0x20
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_B 0x40
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_F 0x60
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_MASK 0x60
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY 0x00
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_A 0x20
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_B 0x40
|
||||
#define EFI_ACPI_DMA_SPEED_TYPE_F 0x60
|
||||
|
||||
#define EFI_ACPI_DMA_BUS_MASTER_MASK 0x04
|
||||
#define EFI_ACPI_DMA_BUS_MASTER 0x04
|
||||
#define EFI_ACPI_DMA_BUS_MASTER_MASK 0x04
|
||||
#define EFI_ACPI_DMA_BUS_MASTER 0x04
|
||||
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_MASK 0x03
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x00
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x01
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x02
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_MASK 0x03
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x00
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT 0x01
|
||||
#define EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT 0x10
|
||||
|
||||
//
|
||||
// IO Information
|
||||
// Ref ACPI specification 6.4.2.5
|
||||
//
|
||||
#define EFI_ACPI_IO_DECODE_MASK 0x01
|
||||
#define EFI_ACPI_IO_DECODE_16_BIT 0x01
|
||||
#define EFI_ACPI_IO_DECODE_10_BIT 0x00
|
||||
#define EFI_ACPI_IO_DECODE_MASK 0x01
|
||||
#define EFI_ACPI_IO_DECODE_16_BIT 0x01
|
||||
#define EFI_ACPI_IO_DECODE_10_BIT 0x00
|
||||
|
||||
//
|
||||
// Memory Information
|
||||
// Ref ACPI specification 6.4.3.4
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_WRITE_STATUS_MASK 0x01
|
||||
#define EFI_ACPI_MEMORY_WRITABLE 0x01
|
||||
#define EFI_ACPI_MEMORY_NON_WRITABLE 0x00
|
||||
|
||||
//
|
||||
// Interrupt Vector Flags definitions for Extended Interrupt Descriptor
|
||||
// Ref ACPI specification 6.4.3.6
|
||||
//
|
||||
#define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_PRODUCER_CONSUMER_MASK BIT0
|
||||
#define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_MODE_MASK BIT1
|
||||
#define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_POLARITY_MASK BIT2
|
||||
#define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_SHARABLE_MASK BIT3
|
||||
#define EFI_ACPI_EXTENDED_INTERRUPT_FLAG_WAKE_CAPABLITY_MASK BIT4
|
||||
#define EFI_ACPI_MEMORY_WRITE_STATUS_MASK 0x01
|
||||
#define EFI_ACPI_MEMORY_WRITABLE 0x01
|
||||
#define EFI_ACPI_MEMORY_NON_WRITABLE 0x00
|
||||
|
||||
//
|
||||
// Ensure proper structure formats
|
||||
@ -401,11 +396,11 @@ typedef struct {
|
||||
/// Root System Description Pointer Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Reserved;
|
||||
UINT32 RsdtAddress;
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Reserved;
|
||||
UINT32 RsdtAddress;
|
||||
} EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
|
||||
|
||||
//
|
||||
@ -417,52 +412,52 @@ typedef struct {
|
||||
///
|
||||
/// RSDT Revision (as defined in ACPI 1.0b specification).
|
||||
///
|
||||
#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Fixed ACPI Description Table Structure (FADT).
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 IntModel;
|
||||
UINT8 Reserved1;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 Reserved2;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 Reserved3;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT8 Reserved4;
|
||||
UINT8 Reserved5;
|
||||
UINT8 Reserved6;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 IntModel;
|
||||
UINT8 Reserved1;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 Reserved2;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 Reserved3;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT8 Reserved4;
|
||||
UINT8 Reserved5;
|
||||
UINT8 Reserved6;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE;
|
||||
|
||||
///
|
||||
@ -470,63 +465,63 @@ typedef struct {
|
||||
///
|
||||
#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
#define EFI_ACPI_1_0_INT_MODE_DUAL_PIC 0
|
||||
#define EFI_ACPI_1_0_INT_MODE_MULTIPLE_APIC 1
|
||||
#define EFI_ACPI_1_0_INT_MODE_DUAL_PIC 0
|
||||
#define EFI_ACPI_1_0_INT_MODE_MULTIPLE_APIC 1
|
||||
|
||||
//
|
||||
// Fixed ACPI Description Table Fixed Feature Flags
|
||||
// All other bits are reserved and must be set to 0.
|
||||
//
|
||||
#define EFI_ACPI_1_0_WBINVD BIT0
|
||||
#define EFI_ACPI_1_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_1_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_1_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_1_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_1_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_1_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_1_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_1_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_1_0_DCK_CAP BIT9
|
||||
#define EFI_ACPI_1_0_WBINVD BIT0
|
||||
#define EFI_ACPI_1_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_1_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_1_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_1_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_1_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_1_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_1_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_1_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_1_0_DCK_CAP BIT9
|
||||
|
||||
///
|
||||
/// Firmware ACPI Control Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT8 Reserved[40];
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT8 Reserved[40];
|
||||
} EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Firmware Control Structure Feature Flags.
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_1_0_S4BIOS_F BIT0
|
||||
#define EFI_ACPI_1_0_S4BIOS_F BIT0
|
||||
|
||||
///
|
||||
/// Multiple APIC Description Table header definition. The rest of the table
|
||||
/// must be defined in a platform-specific manner.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
|
||||
|
||||
///
|
||||
/// MADT Revision (as defined in ACPI 1.0b specification).
|
||||
///
|
||||
#define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Multiple APIC Flags
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_1_0_PCAT_COMPAT BIT0
|
||||
#define EFI_ACPI_1_0_PCAT_COMPAT BIT0
|
||||
|
||||
//
|
||||
// Multiple APIC Description Table APIC structure types
|
||||
@ -547,71 +542,71 @@ typedef struct {
|
||||
/// Processor Local APIC Structure Definition.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC Flags. All other bits are reserved and must be 0.
|
||||
///
|
||||
#define EFI_ACPI_1_0_LOCAL_APIC_ENABLED BIT0
|
||||
#define EFI_ACPI_1_0_LOCAL_APIC_ENABLED BIT0
|
||||
|
||||
///
|
||||
/// IO APIC Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 SystemVectorBase;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 SystemVectorBase;
|
||||
} EFI_ACPI_1_0_IO_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Interrupt Source Override Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterruptVector;
|
||||
UINT16 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterruptVector;
|
||||
UINT16 Flags;
|
||||
} EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Non-Maskable Interrupt Source Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterruptVector;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterruptVector;
|
||||
} EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC NMI Structure.
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicInti;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicInti;
|
||||
} EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Smart Battery Description Table (SBST)
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
} EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE;
|
||||
|
||||
//
|
||||
|
||||
@ -1,23 +1,29 @@
|
||||
/** @file
|
||||
ACPI 2.0 definitions from the ACPI Specification, revision 2.0
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#ifndef _ACPI_2_0_H_
|
||||
#define _ACPI_2_0_H_
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#include <ipxe/efi/IndustryStandard/Acpi10.h>
|
||||
|
||||
//
|
||||
// Define for Descriptor
|
||||
// Define for Desriptor
|
||||
//
|
||||
#define ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME 0x02
|
||||
#define ACPI_LARGE_GENERIC_REGISTER_DESCRIPTOR_NAME 0x02
|
||||
|
||||
#define ACPI_GENERIC_REGISTER_DESCRIPTOR 0x82
|
||||
#define ACPI_GENERIC_REGISTER_DESCRIPTOR 0x82
|
||||
|
||||
//
|
||||
// Ensure proper structure formats
|
||||
@ -47,11 +53,11 @@ typedef PACKED struct {
|
||||
/// ACPI 2.0 Generic Address Space definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 AddressSpaceId;
|
||||
UINT8 RegisterBitWidth;
|
||||
UINT8 RegisterBitOffset;
|
||||
UINT8 Reserved;
|
||||
UINT64 Address;
|
||||
UINT8 AddressSpaceId;
|
||||
UINT8 RegisterBitWidth;
|
||||
UINT8 RegisterBitOffset;
|
||||
UINT8 Reserved;
|
||||
UINT64 Address;
|
||||
} EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE;
|
||||
|
||||
//
|
||||
@ -72,29 +78,29 @@ typedef struct {
|
||||
/// Root System Description Pointer Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Revision;
|
||||
UINT32 RsdtAddress;
|
||||
UINT32 Length;
|
||||
UINT64 XsdtAddress;
|
||||
UINT8 ExtendedChecksum;
|
||||
UINT8 Reserved[3];
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Revision;
|
||||
UINT32 RsdtAddress;
|
||||
UINT32 Length;
|
||||
UINT64 XsdtAddress;
|
||||
UINT8 ExtendedChecksum;
|
||||
UINT8 Reserved[3];
|
||||
} EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
|
||||
|
||||
///
|
||||
/// RSD_PTR Revision (as defined in ACPI 2.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02
|
||||
#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02
|
||||
|
||||
///
|
||||
/// Common table header, this prefaces all ACPI tables, including FACS, but
|
||||
/// excluding the RSD PTR structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
} EFI_ACPI_2_0_COMMON_HEADER;
|
||||
|
||||
//
|
||||
@ -106,7 +112,7 @@ typedef struct {
|
||||
///
|
||||
/// RSDT Revision (as defined in ACPI 2.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
//
|
||||
// Extended System Description Table
|
||||
@ -117,64 +123,64 @@ typedef struct {
|
||||
///
|
||||
/// XSDT Revision (as defined in ACPI 2.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Fixed ACPI Description Table Structure (FADT)
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 Reserved0;
|
||||
UINT8 PreferredPmProfile;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 PstateCnt;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmrLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 CstCnt;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT16 IaPcBootArch;
|
||||
UINT8 Reserved1;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
|
||||
UINT8 ResetValue;
|
||||
UINT8 Reserved2[3];
|
||||
UINT64 XFirmwareCtrl;
|
||||
UINT64 XDsdt;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 Reserved0;
|
||||
UINT8 PreferredPmProfile;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 PstateCnt;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmrLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 CstCnt;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT16 IaPcBootArch;
|
||||
UINT8 Reserved1;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
|
||||
UINT8 ResetValue;
|
||||
UINT8 Reserved2[3];
|
||||
UINT64 XFirmwareCtrl;
|
||||
UINT64 XDsdt;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
|
||||
} EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE;
|
||||
|
||||
///
|
||||
@ -185,53 +191,53 @@ typedef struct {
|
||||
//
|
||||
// Fixed ACPI Description Table Preferred Power Management Profile
|
||||
//
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED 0
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_DESKTOP 1
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_MOBILE 2
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_WORKSTATION 3
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_ENTERPRISE_SERVER 4
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_SOHO_SERVER 5
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_APPLIANCE_PC 6
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED 0
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_DESKTOP 1
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_MOBILE 2
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_WORKSTATION 3
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_ENTERPRISE_SERVER 4
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_SOHO_SERVER 5
|
||||
#define EFI_ACPI_2_0_PM_PROFILE_APPLIANCE_PC 6
|
||||
|
||||
//
|
||||
// Fixed ACPI Description Table Boot Architecture Flags
|
||||
// All other bits are reserved and must be set to 0.
|
||||
//
|
||||
#define EFI_ACPI_2_0_LEGACY_DEVICES BIT0
|
||||
#define EFI_ACPI_2_0_8042 BIT1
|
||||
#define EFI_ACPI_2_0_LEGACY_DEVICES BIT0
|
||||
#define EFI_ACPI_2_0_8042 BIT1
|
||||
|
||||
//
|
||||
// Fixed ACPI Description Table Fixed Feature Flags
|
||||
// All other bits are reserved and must be set to 0.
|
||||
//
|
||||
#define EFI_ACPI_2_0_WBINVD BIT0
|
||||
#define EFI_ACPI_2_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_2_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_2_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_2_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_2_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_2_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_2_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_2_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_2_0_DCK_CAP BIT9
|
||||
#define EFI_ACPI_2_0_RESET_REG_SUP BIT10
|
||||
#define EFI_ACPI_2_0_SEALED_CASE BIT11
|
||||
#define EFI_ACPI_2_0_HEADLESS BIT12
|
||||
#define EFI_ACPI_2_0_CPU_SW_SLP BIT13
|
||||
#define EFI_ACPI_2_0_WBINVD BIT0
|
||||
#define EFI_ACPI_2_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_2_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_2_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_2_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_2_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_2_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_2_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_2_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_2_0_DCK_CAP BIT9
|
||||
#define EFI_ACPI_2_0_RESET_REG_SUP BIT10
|
||||
#define EFI_ACPI_2_0_SEALED_CASE BIT11
|
||||
#define EFI_ACPI_2_0_HEADLESS BIT12
|
||||
#define EFI_ACPI_2_0_CPU_SW_SLP BIT13
|
||||
|
||||
///
|
||||
/// Firmware ACPI Control Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT64 XFirmwareWakingVector;
|
||||
UINT8 Version;
|
||||
UINT8 Reserved[31];
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT64 XFirmwareWakingVector;
|
||||
UINT8 Version;
|
||||
UINT8 Reserved[31];
|
||||
} EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
|
||||
|
||||
///
|
||||
@ -243,28 +249,28 @@ typedef struct {
|
||||
/// Firmware Control Structure Feature Flags
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_2_0_S4BIOS_F BIT0
|
||||
#define EFI_ACPI_2_0_S4BIOS_F BIT0
|
||||
|
||||
///
|
||||
/// Multiple APIC Description Table header definition. The rest of the table
|
||||
/// must be defined in a platform specific manner.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
|
||||
|
||||
///
|
||||
/// MADT Revision (as defined in ACPI 2.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Multiple APIC Flags
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_2_0_PCAT_COMPAT BIT0
|
||||
#define EFI_ACPI_2_0_PCAT_COMPAT BIT0
|
||||
|
||||
//
|
||||
// Multiple APIC Description Table APIC structure types
|
||||
@ -289,127 +295,127 @@ typedef struct {
|
||||
/// Processor Local APIC Structure Definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC Flags. All other bits are reserved and must be 0.
|
||||
///
|
||||
#define EFI_ACPI_2_0_LOCAL_APIC_ENABLED BIT0
|
||||
#define EFI_ACPI_2_0_LOCAL_APIC_ENABLED BIT0
|
||||
|
||||
///
|
||||
/// IO APIC Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
} EFI_ACPI_2_0_IO_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Interrupt Source Override Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT16 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT16 Flags;
|
||||
} EFI_ACPI_2_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Non-Maskable Interrupt Source Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
} EFI_ACPI_2_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC NMI Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicLint;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicLint;
|
||||
} EFI_ACPI_2_0_LOCAL_APIC_NMI_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC Address Override Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Reserved;
|
||||
UINT64 LocalApicAddress;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Reserved;
|
||||
UINT64 LocalApicAddress;
|
||||
} EFI_ACPI_2_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// IO SAPIC Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT64 IoSapicAddress;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT64 IoSapicAddress;
|
||||
} EFI_ACPI_2_0_IO_SAPIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local SAPIC Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 LocalSapicId;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 Reserved[3];
|
||||
UINT32 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 LocalSapicId;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 Reserved[3];
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_2_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Platform Interrupt Sources Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 Reserved;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 Reserved;
|
||||
} EFI_ACPI_2_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Smart Battery Description Table (SBST)
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
} EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE;
|
||||
|
||||
///
|
||||
/// SBST Version (as defined in ACPI 2.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_2_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Embedded Controller Boot Resources Table (ECDT)
|
||||
@ -417,11 +423,11 @@ typedef struct {
|
||||
/// a fully qualified reference to the name space object.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcControl;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcData;
|
||||
UINT32 Uid;
|
||||
UINT8 GpeBit;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcControl;
|
||||
EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE EcData;
|
||||
UINT32 Uid;
|
||||
UINT8 GpeBit;
|
||||
} EFI_ACPI_2_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
|
||||
|
||||
///
|
||||
@ -507,7 +513,7 @@ typedef struct {
|
||||
#define EFI_ACPI_2_0_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE SIGNATURE_32('S', 'L', 'I', 'T')
|
||||
|
||||
///
|
||||
/// "SPCR" Serial Port Console Redirection Table
|
||||
/// "SPCR" Serial Port Concole Redirection Table
|
||||
///
|
||||
#define EFI_ACPI_2_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE SIGNATURE_32('S', 'P', 'C', 'R')
|
||||
|
||||
|
||||
@ -1,23 +1,29 @@
|
||||
/** @file
|
||||
ACPI 3.0 definitions from the ACPI Specification Revision 3.0b October 10, 2006
|
||||
|
||||
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
|
||||
#ifndef _ACPI_3_0_H_
|
||||
#define _ACPI_3_0_H_
|
||||
|
||||
FILE_LICENCE ( BSD2_PATENT );
|
||||
FILE_LICENCE ( BSD3 );
|
||||
|
||||
#include <ipxe/efi/IndustryStandard/Acpi20.h>
|
||||
|
||||
//
|
||||
// Define for Descriptor
|
||||
// Define for Desriptor
|
||||
//
|
||||
#define ACPI_LARGE_EXTENDED_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0B
|
||||
#define ACPI_LARGE_EXTENDED_ADDRESS_SPACE_DESCRIPTOR_NAME 0x0B
|
||||
|
||||
#define ACPI_EXTENDED_ADDRESS_SPACE_DESCRIPTOR 0x8B
|
||||
#define ACPI_EXTENDED_ADDRESS_SPACE_DESCRIPTOR 0x8B
|
||||
|
||||
//
|
||||
// Ensure proper structure formats
|
||||
@ -47,12 +53,12 @@ typedef PACKED struct {
|
||||
//
|
||||
// Memory Type Specific Flags
|
||||
//
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_UC 0x0000000000000001
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WC 0x0000000000000002
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WT 0x0000000000000004
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WB 0x0000000000000008
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_UCE 0x0000000000000010
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_NV 0x0000000000008000
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_UC 0x0000000000000001
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WC 0x0000000000000002
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WT 0x0000000000000004
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_WB 0x0000000000000008
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_UCE 0x0000000000000010
|
||||
#define EFI_ACPI_MEMORY_TYPE_SPECIFIC_ATTRIBUTES_NV 0x0000000000008000
|
||||
|
||||
//
|
||||
// Ensure proper structure formats
|
||||
@ -63,11 +69,11 @@ typedef PACKED struct {
|
||||
/// ACPI 3.0 Generic Address Space definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 AddressSpaceId;
|
||||
UINT8 RegisterBitWidth;
|
||||
UINT8 RegisterBitOffset;
|
||||
UINT8 AccessSize;
|
||||
UINT64 Address;
|
||||
UINT8 AddressSpaceId;
|
||||
UINT8 RegisterBitWidth;
|
||||
UINT8 RegisterBitOffset;
|
||||
UINT8 AccessSize;
|
||||
UINT64 Address;
|
||||
} EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE;
|
||||
|
||||
//
|
||||
@ -97,29 +103,29 @@ typedef struct {
|
||||
/// Root System Description Pointer Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Revision;
|
||||
UINT32 RsdtAddress;
|
||||
UINT32 Length;
|
||||
UINT64 XsdtAddress;
|
||||
UINT8 ExtendedChecksum;
|
||||
UINT8 Reserved[3];
|
||||
UINT64 Signature;
|
||||
UINT8 Checksum;
|
||||
UINT8 OemId[6];
|
||||
UINT8 Revision;
|
||||
UINT32 RsdtAddress;
|
||||
UINT32 Length;
|
||||
UINT64 XsdtAddress;
|
||||
UINT8 ExtendedChecksum;
|
||||
UINT8 Reserved[3];
|
||||
} EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
|
||||
|
||||
///
|
||||
/// RSD_PTR Revision (as defined in ACPI 3.0b spec.)
|
||||
///
|
||||
#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 ///< ACPISpec (Revision 3.0b) says current value is 2
|
||||
#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION 0x02 ///< ACPISpec (Revision 3.0b) says current value is 2
|
||||
|
||||
///
|
||||
/// Common table header, this prefaces all ACPI tables, including FACS, but
|
||||
/// excluding the RSD PTR structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
} EFI_ACPI_3_0_COMMON_HEADER;
|
||||
|
||||
//
|
||||
@ -131,7 +137,7 @@ typedef struct {
|
||||
///
|
||||
/// RSDT Revision (as defined in ACPI 3.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
//
|
||||
// Extended System Description Table
|
||||
@ -142,64 +148,64 @@ typedef struct {
|
||||
///
|
||||
/// XSDT Revision (as defined in ACPI 3.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_3_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Fixed ACPI Description Table Structure (FADT)
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 Reserved0;
|
||||
UINT8 PreferredPmProfile;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 PstateCnt;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmrLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 CstCnt;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT16 IaPcBootArch;
|
||||
UINT8 Reserved1;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
|
||||
UINT8 ResetValue;
|
||||
UINT8 Reserved2[3];
|
||||
UINT64 XFirmwareCtrl;
|
||||
UINT64 XDsdt;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 FirmwareCtrl;
|
||||
UINT32 Dsdt;
|
||||
UINT8 Reserved0;
|
||||
UINT8 PreferredPmProfile;
|
||||
UINT16 SciInt;
|
||||
UINT32 SmiCmd;
|
||||
UINT8 AcpiEnable;
|
||||
UINT8 AcpiDisable;
|
||||
UINT8 S4BiosReq;
|
||||
UINT8 PstateCnt;
|
||||
UINT32 Pm1aEvtBlk;
|
||||
UINT32 Pm1bEvtBlk;
|
||||
UINT32 Pm1aCntBlk;
|
||||
UINT32 Pm1bCntBlk;
|
||||
UINT32 Pm2CntBlk;
|
||||
UINT32 PmTmrBlk;
|
||||
UINT32 Gpe0Blk;
|
||||
UINT32 Gpe1Blk;
|
||||
UINT8 Pm1EvtLen;
|
||||
UINT8 Pm1CntLen;
|
||||
UINT8 Pm2CntLen;
|
||||
UINT8 PmTmrLen;
|
||||
UINT8 Gpe0BlkLen;
|
||||
UINT8 Gpe1BlkLen;
|
||||
UINT8 Gpe1Base;
|
||||
UINT8 CstCnt;
|
||||
UINT16 PLvl2Lat;
|
||||
UINT16 PLvl3Lat;
|
||||
UINT16 FlushSize;
|
||||
UINT16 FlushStride;
|
||||
UINT8 DutyOffset;
|
||||
UINT8 DutyWidth;
|
||||
UINT8 DayAlrm;
|
||||
UINT8 MonAlrm;
|
||||
UINT8 Century;
|
||||
UINT16 IaPcBootArch;
|
||||
UINT8 Reserved1;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE ResetReg;
|
||||
UINT8 ResetValue;
|
||||
UINT8 Reserved2[3];
|
||||
UINT64 XFirmwareCtrl;
|
||||
UINT64 XDsdt;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
|
||||
} EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE;
|
||||
|
||||
///
|
||||
@ -223,50 +229,50 @@ typedef struct {
|
||||
// Fixed ACPI Description Table Boot Architecture Flags
|
||||
// All other bits are reserved and must be set to 0.
|
||||
//
|
||||
#define EFI_ACPI_3_0_LEGACY_DEVICES BIT0
|
||||
#define EFI_ACPI_3_0_8042 BIT1
|
||||
#define EFI_ACPI_3_0_VGA_NOT_PRESENT BIT2
|
||||
#define EFI_ACPI_3_0_MSI_NOT_SUPPORTED BIT3
|
||||
#define EFI_ACPI_3_0_PCIE_ASPM_CONTROLS BIT4
|
||||
#define EFI_ACPI_3_0_LEGACY_DEVICES BIT0
|
||||
#define EFI_ACPI_3_0_8042 BIT1
|
||||
#define EFI_ACPI_3_0_VGA_NOT_PRESENT BIT2
|
||||
#define EFI_ACPI_3_0_MSI_NOT_SUPPORTED BIT3
|
||||
#define EFI_ACPI_3_0_PCIE_ASPM_CONTROLS BIT4
|
||||
|
||||
//
|
||||
// Fixed ACPI Description Table Fixed Feature Flags
|
||||
// All other bits are reserved and must be set to 0.
|
||||
//
|
||||
#define EFI_ACPI_3_0_WBINVD BIT0
|
||||
#define EFI_ACPI_3_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_3_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_3_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_3_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_3_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_3_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_3_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_3_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_3_0_DCK_CAP BIT9
|
||||
#define EFI_ACPI_3_0_RESET_REG_SUP BIT10
|
||||
#define EFI_ACPI_3_0_SEALED_CASE BIT11
|
||||
#define EFI_ACPI_3_0_HEADLESS BIT12
|
||||
#define EFI_ACPI_3_0_CPU_SW_SLP BIT13
|
||||
#define EFI_ACPI_3_0_PCI_EXP_WAK BIT14
|
||||
#define EFI_ACPI_3_0_USE_PLATFORM_CLOCK BIT15
|
||||
#define EFI_ACPI_3_0_S4_RTC_STS_VALID BIT16
|
||||
#define EFI_ACPI_3_0_REMOTE_POWER_ON_CAPABLE BIT17
|
||||
#define EFI_ACPI_3_0_FORCE_APIC_CLUSTER_MODEL BIT18
|
||||
#define EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
|
||||
#define EFI_ACPI_3_0_WBINVD BIT0
|
||||
#define EFI_ACPI_3_0_WBINVD_FLUSH BIT1
|
||||
#define EFI_ACPI_3_0_PROC_C1 BIT2
|
||||
#define EFI_ACPI_3_0_P_LVL2_UP BIT3
|
||||
#define EFI_ACPI_3_0_PWR_BUTTON BIT4
|
||||
#define EFI_ACPI_3_0_SLP_BUTTON BIT5
|
||||
#define EFI_ACPI_3_0_FIX_RTC BIT6
|
||||
#define EFI_ACPI_3_0_RTC_S4 BIT7
|
||||
#define EFI_ACPI_3_0_TMR_VAL_EXT BIT8
|
||||
#define EFI_ACPI_3_0_DCK_CAP BIT9
|
||||
#define EFI_ACPI_3_0_RESET_REG_SUP BIT10
|
||||
#define EFI_ACPI_3_0_SEALED_CASE BIT11
|
||||
#define EFI_ACPI_3_0_HEADLESS BIT12
|
||||
#define EFI_ACPI_3_0_CPU_SW_SLP BIT13
|
||||
#define EFI_ACPI_3_0_PCI_EXP_WAK BIT14
|
||||
#define EFI_ACPI_3_0_USE_PLATFORM_CLOCK BIT15
|
||||
#define EFI_ACPI_3_0_S4_RTC_STS_VALID BIT16
|
||||
#define EFI_ACPI_3_0_REMOTE_POWER_ON_CAPABLE BIT17
|
||||
#define EFI_ACPI_3_0_FORCE_APIC_CLUSTER_MODEL BIT18
|
||||
#define EFI_ACPI_3_0_FORCE_APIC_PHYSICAL_DESTINATION_MODE BIT19
|
||||
|
||||
///
|
||||
/// Firmware ACPI Control Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT64 XFirmwareWakingVector;
|
||||
UINT8 Version;
|
||||
UINT8 Reserved[31];
|
||||
UINT32 Signature;
|
||||
UINT32 Length;
|
||||
UINT32 HardwareSignature;
|
||||
UINT32 FirmwareWakingVector;
|
||||
UINT32 GlobalLock;
|
||||
UINT32 Flags;
|
||||
UINT64 XFirmwareWakingVector;
|
||||
UINT8 Version;
|
||||
UINT8 Reserved[31];
|
||||
} EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
|
||||
|
||||
///
|
||||
@ -278,7 +284,7 @@ typedef struct {
|
||||
/// Firmware Control Structure Feature Flags
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_3_0_S4BIOS_F BIT0
|
||||
#define EFI_ACPI_3_0_S4BIOS_F BIT0
|
||||
|
||||
//
|
||||
// Differentiated System Description Table,
|
||||
@ -287,29 +293,29 @@ typedef struct {
|
||||
// no definition needed as they are common description table header, the same with
|
||||
// EFI_ACPI_DESCRIPTION_HEADER, followed by a definition block.
|
||||
//
|
||||
#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
|
||||
#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
|
||||
#define EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
|
||||
#define EFI_ACPI_3_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_REVISION 0x02
|
||||
|
||||
///
|
||||
/// Multiple APIC Description Table header definition. The rest of the table
|
||||
/// must be defined in a platform specific manner.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 LocalApicAddress;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
|
||||
|
||||
///
|
||||
/// MADT Revision (as defined in ACPI 3.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x02
|
||||
#define EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x02
|
||||
|
||||
///
|
||||
/// Multiple APIC Flags
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_3_0_PCAT_COMPAT BIT0
|
||||
#define EFI_ACPI_3_0_PCAT_COMPAT BIT0
|
||||
|
||||
//
|
||||
// Multiple APIC Description Table APIC structure types
|
||||
@ -334,57 +340,57 @@ typedef struct {
|
||||
/// Processor Local APIC Structure Definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC Flags. All other bits are reserved and must be 0.
|
||||
///
|
||||
#define EFI_ACPI_3_0_LOCAL_APIC_ENABLED BIT0
|
||||
#define EFI_ACPI_3_0_LOCAL_APIC_ENABLED BIT0
|
||||
|
||||
///
|
||||
/// IO APIC Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 IoApicAddress;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
} EFI_ACPI_3_0_IO_APIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Interrupt Source Override Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT16 Flags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Bus;
|
||||
UINT8 Source;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT16 Flags;
|
||||
} EFI_ACPI_3_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Platform Interrupt Sources Structure Definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 PlatformInterruptSourceFlags;
|
||||
UINT8 CpeiProcessorOverride;
|
||||
UINT8 Reserved[31];
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 PlatformInterruptSourceFlags;
|
||||
UINT8 CpeiProcessorOverride;
|
||||
UINT8 Reserved[31];
|
||||
} EFI_ACPI_3_0_PLATFORM_INTERRUPT_APIC_STRUCTURE;
|
||||
|
||||
//
|
||||
@ -398,43 +404,43 @@ typedef struct {
|
||||
/// Non-Maskable Interrupt Source Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
} EFI_ACPI_3_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC NMI Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicLint;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT16 Flags;
|
||||
UINT8 LocalApicLint;
|
||||
} EFI_ACPI_3_0_LOCAL_APIC_NMI_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC Address Override Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Reserved;
|
||||
UINT64 LocalApicAddress;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Reserved;
|
||||
UINT64 LocalApicAddress;
|
||||
} EFI_ACPI_3_0_LOCAL_APIC_ADDRESS_OVERRIDE_STRUCTURE;
|
||||
|
||||
///
|
||||
/// IO SAPIC Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT64 IoSapicAddress;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 IoApicId;
|
||||
UINT8 Reserved;
|
||||
UINT32 GlobalSystemInterruptBase;
|
||||
UINT64 IoSapicAddress;
|
||||
} EFI_ACPI_3_0_IO_SAPIC_STRUCTURE;
|
||||
|
||||
///
|
||||
@ -442,51 +448,51 @@ typedef struct {
|
||||
/// This struct followed by a null-terminated ASCII string - ACPI Processor UID String
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 LocalSapicId;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 Reserved[3];
|
||||
UINT32 Flags;
|
||||
UINT32 ACPIProcessorUIDValue;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 AcpiProcessorId;
|
||||
UINT8 LocalSapicId;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 Reserved[3];
|
||||
UINT32 Flags;
|
||||
UINT32 ACPIProcessorUIDValue;
|
||||
} EFI_ACPI_3_0_PROCESSOR_LOCAL_SAPIC_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Platform Interrupt Sources Structure
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 PlatformInterruptSourceFlags;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Flags;
|
||||
UINT8 InterruptType;
|
||||
UINT8 ProcessorId;
|
||||
UINT8 ProcessorEid;
|
||||
UINT8 IoSapicVector;
|
||||
UINT32 GlobalSystemInterrupt;
|
||||
UINT32 PlatformInterruptSourceFlags;
|
||||
} EFI_ACPI_3_0_PLATFORM_INTERRUPT_SOURCES_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Platform Interrupt Source Flags.
|
||||
/// All other bits are reserved and must be set to 0.
|
||||
///
|
||||
#define EFI_ACPI_3_0_CPEI_PROCESSOR_OVERRIDE BIT0
|
||||
#define EFI_ACPI_3_0_CPEI_PROCESSOR_OVERRIDE BIT0
|
||||
|
||||
///
|
||||
/// Smart Battery Description Table (SBST)
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 WarningEnergyLevel;
|
||||
UINT32 LowEnergyLevel;
|
||||
UINT32 CriticalEnergyLevel;
|
||||
} EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE;
|
||||
|
||||
///
|
||||
/// SBST Version (as defined in ACPI 3.0 spec.)
|
||||
///
|
||||
#define EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
|
||||
#define EFI_ACPI_3_0_SMART_BATTERY_DESCRIPTION_TABLE_REVISION 0x01
|
||||
|
||||
///
|
||||
/// Embedded Controller Boot Resources Table (ECDT)
|
||||
@ -494,11 +500,11 @@ typedef struct {
|
||||
/// a fully qualified reference to the name space object.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcControl;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcData;
|
||||
UINT32 Uid;
|
||||
UINT8 GpeBit;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcControl;
|
||||
EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE EcData;
|
||||
UINT32 Uid;
|
||||
UINT8 GpeBit;
|
||||
} EFI_ACPI_3_0_EMBEDDED_CONTROLLER_BOOT_RESOURCES_TABLE;
|
||||
|
||||
///
|
||||
@ -511,9 +517,9 @@ typedef struct {
|
||||
/// must be defined in a platform specific manner.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 Reserved1; ///< Must be set to 1
|
||||
UINT64 Reserved2;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT32 Reserved1; ///< Must be set to 1
|
||||
UINT64 Reserved2;
|
||||
} EFI_ACPI_3_0_SYSTEM_RESOURCE_AFFINITY_TABLE_HEADER;
|
||||
|
||||
///
|
||||
@ -533,52 +539,52 @@ typedef struct {
|
||||
/// Processor Local APIC/SAPIC Affinity Structure Definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 ProximityDomain7To0;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 ProximityDomain31To8[3];
|
||||
UINT8 Reserved[4];
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 ProximityDomain7To0;
|
||||
UINT8 ApicId;
|
||||
UINT32 Flags;
|
||||
UINT8 LocalSapicEid;
|
||||
UINT8 ProximityDomain31To8[3];
|
||||
UINT8 Reserved[4];
|
||||
} EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_AFFINITY_STRUCTURE;
|
||||
|
||||
///
|
||||
/// Local APIC/SAPIC Flags. All other bits are reserved and must be 0.
|
||||
///
|
||||
#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED (1 << 0)
|
||||
#define EFI_ACPI_3_0_PROCESSOR_LOCAL_APIC_SAPIC_ENABLED (1 << 0)
|
||||
|
||||
///
|
||||
/// Memory Affinity Structure Definition
|
||||
///
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT32 ProximityDomain;
|
||||
UINT16 Reserved1;
|
||||
UINT32 AddressBaseLow;
|
||||
UINT32 AddressBaseHigh;
|
||||
UINT32 LengthLow;
|
||||
UINT32 LengthHigh;
|
||||
UINT32 Reserved2;
|
||||
UINT32 Flags;
|
||||
UINT64 Reserved3;
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT32 ProximityDomain;
|
||||
UINT16 Reserved1;
|
||||
UINT32 AddressBaseLow;
|
||||
UINT32 AddressBaseHigh;
|
||||
UINT32 LengthLow;
|
||||
UINT32 LengthHigh;
|
||||
UINT32 Reserved2;
|
||||
UINT32 Flags;
|
||||
UINT64 Reserved3;
|
||||
} EFI_ACPI_3_0_MEMORY_AFFINITY_STRUCTURE;
|
||||
|
||||
//
|
||||
// Memory Flags. All other bits are reserved and must be 0.
|
||||
//
|
||||
#define EFI_ACPI_3_0_MEMORY_ENABLED (1 << 0)
|
||||
#define EFI_ACPI_3_0_MEMORY_HOT_PLUGGABLE (1 << 1)
|
||||
#define EFI_ACPI_3_0_MEMORY_NONVOLATILE (1 << 2)
|
||||
#define EFI_ACPI_3_0_MEMORY_ENABLED (1 << 0)
|
||||
#define EFI_ACPI_3_0_MEMORY_HOT_PLUGGABLE (1 << 1)
|
||||
#define EFI_ACPI_3_0_MEMORY_NONVOLATILE (1 << 2)
|
||||
|
||||
///
|
||||
/// System Locality Distance Information Table (SLIT).
|
||||
/// The rest of the table is a matrix.
|
||||
///
|
||||
typedef struct {
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT64 NumberOfSystemLocalities;
|
||||
EFI_ACPI_DESCRIPTION_HEADER Header;
|
||||
UINT64 NumberOfSystemLocalities;
|
||||
} EFI_ACPI_3_0_SYSTEM_LOCALITY_DISTANCE_INFORMATION_TABLE_HEADER;
|
||||
|
||||
///
|
||||
@ -686,7 +692,7 @@ typedef struct {
|
||||
#define EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE SIGNATURE_32('M', 'C', 'F', 'G')
|
||||
|
||||
///
|
||||
/// "SPCR" Serial Port Console Redirection Table
|
||||
/// "SPCR" Serial Port Concole Redirection Table
|
||||
///
|
||||
#define EFI_ACPI_3_0_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE SIGNATURE_32('S', 'P', 'C', 'R')
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user