Compare commits

..

1 Commits

Author SHA1 Message Date
ea7646be89 [efi] Record cached ProxyDHCPOFFER and PXEBSACK, if present
Commit cd3de55 ("[efi] Record cached DHCPACK from loaded image's
device handle, if present") added the ability for a chainloaded UEFI
iPXE to reuse an IPv4 address and DHCP options previously obtained by
a built-in PXE stack, without needing to perform a second DHCP
request.

Extend this to also record the cached ProxyDHCPOFFER and PXEBSACK
obtained from the EFI_PXE_BASE_CODE_PROTOCOL instance installed on the
loaded image's device handle, if present.

This allows a chainloaded UEFI iPXE to reuse a boot filename or other
options that were provided via a ProxyDHCP or PXE boot server
mechanism, rather than by standard DHCP.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-07-23 11:32:04 +01:00
122 changed files with 1030 additions and 4125 deletions

View File

@ -16,7 +16,7 @@ BLOCKSIZE = 512 * 1024
def detect_architecture(image):
"""Detect CPU architecture"""
mdir = subprocess.run(['mdir', '-b', '-i', image, '::/EFI/BOOT'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
capture_output=True)
if any(b'BOOTAA64.EFI' in x for x in mdir.stdout.splitlines()):
return 'arm64'
return 'x86_64'

View File

@ -24,7 +24,6 @@ CP := cp
ECHO := echo
PRINTF := printf
PERL := perl
PYTHON := python
TRUE := true
CC := $(CROSS_COMPILE)gcc
CPP := $(CC) -E
@ -51,7 +50,7 @@ ELF2EFI64 := ./util/elf2efi64
EFIROM := ./util/efirom
EFIFATBIN := ./util/efifatbin
EINFO := ./util/einfo
GENKEYMAP := ./util/genkeymap.py
GENKEYMAP := ./util/genkeymap.pl
DOXYGEN := doxygen
LCAB := lcab
QEMUIMG := qemu-img
@ -191,7 +190,7 @@ vmware : bin/8086100f.mrom bin/808610d3.mrom bin/10222000.rom bin/15ad07b0.rom
@$(ECHO) ' bin/10222000.rom -- vlance/pcnet32'
@$(ECHO) ' bin/15ad07b0.rom -- vmxnet3'
@$(ECHO)
@$(ECHO) 'For more information, see https://ipxe.org/howto/vmware'
@$(ECHO) 'For more information, see http://ipxe.org/howto/vmware'
@$(ECHO)
@$(ECHO) '==========================================================='

View File

@ -43,8 +43,7 @@ $(BIN)/%.drv.efi : $(BIN)/%.efidrv
$(BIN)/%.efirom : $(BIN)/%.efidrv $(EFIROM)
$(QM)$(ECHO) " [FINISH] $@"
$(Q)$(EFIROM) -v $(firstword $(TGT_PCI_VENDOR) 0) \
-d $(firstword $(TGT_PCI_DEVICE) 0) -c $< $@
$(Q)$(EFIROM) -v $(TGT_PCI_VENDOR) -d $(TGT_PCI_DEVICE) -c $< $@
$(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
$(QM)$(ECHO) " [CAB] $@"

View File

@ -918,7 +918,7 @@ $(BIN)/deps/%.d : % $(MAKEDEPS)
# Calculate list of dependency files
#
AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS) core/version.c)
AUTO_DEPS = $(patsubst %,$(BIN)/deps/%.d,$(AUTO_SRCS))
autodeps :
@$(ECHO) $(AUTO_DEPS)
VERYCLEANUP += $(BIN)/deps
@ -1202,7 +1202,7 @@ endif
# Build version
#
GIT_INDEX := $(if $(GITVERSION),$(if $(wildcard ../.git/index),../.git/index))
$(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(version_DEPS) $(GIT_INDEX)
$(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
$(QM)$(ECHO) " [VERSION] $@"
$(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
@ -1563,7 +1563,7 @@ endif # defined(BIN)
#
hci/keymap/keymap_%.c :
$(Q)$(PYTHON) $(GENKEYMAP) $* > $@
$(Q)$(PERL) $(GENKEYMAP) $* > $@
###############################################################################
#

View File

@ -136,8 +136,6 @@ SECTIONS {
*(.note.*)
*(.discard)
*(.discard.*)
*(.sbat)
*(.sbat.*)
}
/*

View File

@ -100,7 +100,5 @@ SECTIONS {
*(.rel.*)
*(.discard)
*(.discard.*)
*(.sbat)
*(.sbat.*)
}
}

View File

@ -6,11 +6,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define BDA_SEG 0x0040
#define BDA_EBDA 0x000e
#define BDA_EQUIPMENT_WORD 0x0010
#define BDA_KB0 0x0017
#define BDA_KB0_RSHIFT 0x01
#define BDA_KB0_LSHIFT 0x02
#define BDA_KB0_CTRL 0x04
#define BDA_KB0_CAPSLOCK 0x040
#define BDA_FBMS 0x0013
#define BDA_TICKS 0x006c
#define BDA_MIDNIGHT 0x0070
@ -18,7 +13,5 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define BDA_REBOOT_WARM 0x1234
#define BDA_NUM_DRIVES 0x0075
#define BDA_CHAR_HEIGHT 0x0085
#define BDA_KB2 0x0096
#define BDA_KB2_RALT 0x08
#endif /* BIOS_H */

View File

@ -107,7 +107,7 @@ static int acpi_timer_probe ( void ) {
unsigned int pm_tmr_blk;
/* Locate FADT */
fadt = acpi_table ( FADT_SIGNATURE, 0 );
fadt = acpi_find ( FADT_SIGNATURE, 0 );
if ( ! fadt ) {
DBGC ( &acpi_timer, "ACPI could not find FADT\n" );
return -ENOENT;

View File

@ -42,69 +42,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** _S5_ signature */
#define S5_SIGNATURE ACPI_SIGNATURE ( '_', 'S', '5', '_' )
/**
* Extract \_Sx value from DSDT/SSDT
*
* @v zsdt DSDT or SSDT
* @v len Length of DSDT/SSDT
* @v offset Offset of signature within DSDT/SSDT
* @v data Data buffer
* @ret rc Return status code
*
* In theory, extracting the \_Sx value from the DSDT/SSDT requires a
* full ACPI parser plus some heuristics to work around the various
* broken encodings encountered in real ACPI implementations.
*
* In practice, we can get the same result by scanning through the
* DSDT/SSDT for the signature (e.g. "_S5_"), extracting the first
* four bytes, removing any bytes with bit 3 set, and treating
* whatever is left as a little-endian value. This is one of the
* uglier hacks I have ever implemented, but it's still prettier than
* the ACPI specification itself.
*/
static int acpi_extract_sx ( userptr_t zsdt, size_t len, size_t offset,
void *data ) {
unsigned int *sx = data;
uint8_t bytes[4];
uint8_t *byte;
/* Skip signature and package header */
offset += ( 4 /* signature */ + 3 /* package header */ );
/* Sanity check */
if ( ( offset + sizeof ( bytes ) /* value */ ) > len ) {
return -EINVAL;
}
/* Read first four bytes of value */
copy_from_user ( bytes, zsdt, offset, sizeof ( bytes ) );
DBGC ( colour, "ACPI found \\_Sx containing %02x:%02x:%02x:%02x\n",
bytes[0], bytes[1], bytes[2], bytes[3] );
/* Extract \Sx value. There are three potential encodings
* that we might encounter:
*
* - SLP_TYPa, SLP_TYPb, rsvd, rsvd
*
* - <byteprefix>, SLP_TYPa, <byteprefix>, SLP_TYPb, ...
*
* - <dwordprefix>, SLP_TYPa, SLP_TYPb, 0, 0
*
* Since <byteprefix> and <dwordprefix> both have bit 3 set,
* and valid SLP_TYPx must have bit 3 clear (since SLP_TYPx is
* a 3-bit field), we can just skip any bytes with bit 3 set.
*/
byte = bytes;
if ( *byte & 0x08 )
byte++;
*sx = *(byte++);
if ( *byte & 0x08 )
byte++;
*sx |= ( *byte << 8 );
return 0;
}
/**
* Power off the computer using ACPI
*
@ -119,11 +56,11 @@ int acpi_poweroff ( void ) {
unsigned int pm1b_cnt;
unsigned int slp_typa;
unsigned int slp_typb;
unsigned int s5;
int s5;
int rc;
/* Locate FADT */
fadt = acpi_table ( FADT_SIGNATURE, 0 );
fadt = acpi_find ( FADT_SIGNATURE, 0 );
if ( ! fadt ) {
DBGC ( colour, "ACPI could not find FADT\n" );
return -ENOENT;
@ -137,8 +74,9 @@ int acpi_poweroff ( void ) {
pm1b_cnt = ( pm1b_cnt_blk + ACPI_PM1_CNT );
/* Extract \_S5 from DSDT or any SSDT */
if ( ( rc = acpi_extract ( S5_SIGNATURE, &s5,
acpi_extract_sx ) ) != 0 ) {
s5 = acpi_sx ( S5_SIGNATURE );
if ( s5 < 0 ) {
rc = s5;
DBGC ( colour, "ACPI could not extract \\_S5: %s\n",
strerror ( rc ) );
return rc;

View File

@ -60,21 +60,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ATTR_DEFAULT ATTR_FCOL_WHITE
/** Maximum keycode subject to remapping
*
* This allows us to avoid remapping the numeric keypad, which is
* necessary for keyboard layouts such as "fr" that swap the shifted
* and unshifted digit keys.
*/
#define SCANCODE_RSHIFT 0x36
/** Scancode for the "non-US \ and |" key
*
* This is the key that appears between Left Shift and Z on non-US
* keyboards.
*/
#define SCANCODE_NON_US 0x56
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_PCBIOS ) && CONSOLE_EXPLICIT ( CONSOLE_PCBIOS ) )
#undef CONSOLE_PCBIOS
@ -354,6 +339,22 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
return NULL;
}
/**
* Map a key
*
* @v character Character read from console
* @ret character Mapped character
*/
static int bios_keymap ( unsigned int character ) {
struct key_mapping *mapping;
for_each_table_entry ( mapping, KEYMAP ) {
if ( mapping->from == character )
return mapping->to;
}
return character;
}
/**
* Get character from BIOS console
*
@ -361,9 +362,6 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
*/
static int bios_getchar ( void ) {
uint16_t keypress;
uint8_t kb0;
uint8_t kb2;
unsigned int scancode;
unsigned int character;
const char *ansi_seq;
@ -385,42 +383,11 @@ static int bios_getchar ( void ) {
: "=a" ( keypress )
: "a" ( 0x1000 ), "m" ( bios_inject_lock ) );
bios_inject_lock--;
scancode = ( keypress >> 8 );
character = ( keypress & 0xff );
get_real ( kb0, BDA_SEG, BDA_KB0 );
get_real ( kb2, BDA_SEG, BDA_KB2 );
/* If it's a normal character, map (if applicable) and return it */
if ( character && ( character < 0x80 ) ) {
/* Handle special scancodes */
if ( scancode == SCANCODE_NON_US ) {
/* Treat as "\|" with high bit set */
character |= KEYMAP_PSEUDO;
} else if ( scancode >= SCANCODE_RSHIFT ) {
/* Non-remappable scancode (e.g. numeric keypad) */
return character;
}
/* Apply modifiers */
if ( kb0 & BDA_KB0_CTRL )
character |= KEYMAP_CTRL;
if ( kb0 & BDA_KB0_CAPSLOCK )
character |= KEYMAP_CAPSLOCK_REDO;
if ( kb2 & BDA_KB2_RALT )
character |= KEYMAP_ALTGR;
/* Treat LShift+RShift as AltGr since many BIOSes will
* not return ASCII characters when AltGr is pressed.
*/
if ( ( kb0 & ( BDA_KB0_LSHIFT | BDA_KB0_RSHIFT ) ) ==
( BDA_KB0_LSHIFT | BDA_KB0_RSHIFT ) ) {
character |= KEYMAP_ALTGR;
}
/* Map and return */
return key_remap ( character );
}
/* If it's a normal character, just map and return it */
if ( character && ( character < 0x80 ) )
return bios_keymap ( character );
/* Otherwise, check for a special key that we know about */
if ( ( ansi_seq = bios_ansi_seq ( keypress >> 8 ) ) ) {

View File

@ -78,15 +78,6 @@ struct console_driver bios_console __attribute__ (( weak ));
/** Font corresponding to selected character width and height */
#define VESAFB_FONT VBE_FONT_8x16
/** Number of ASCII glyphs within the font */
#define VESAFB_ASCII 128
/** Glyph to render for non-ASCII characters
*
* We choose to use one of the box-drawing glyphs.
*/
#define VESAFB_UNKNOWN 0xfe
/* Forward declaration */
struct console_driver vesafb_console __console_driver;
@ -139,24 +130,12 @@ static int vesafb_rc ( unsigned int status ) {
/**
* Get character glyph
*
* @v character Unicode character
* @v character Character
* @v glyph Character glyph to fill in
*/
static void vesafb_glyph ( unsigned int character, uint8_t *glyph ) {
unsigned int index;
size_t offset;
size_t offset = ( character * VESAFB_CHAR_HEIGHT );
/* Identify glyph */
if ( character < VESAFB_ASCII ) {
/* ASCII character: use corresponding glyph */
index = character;
} else {
/* Non-ASCII character: use "unknown" glyph */
index = VESAFB_UNKNOWN;
}
/* Copy glyph from BIOS font table */
offset = ( index * VESAFB_CHAR_HEIGHT );
copy_from_real ( glyph, vesafb.glyphs.segment,
( vesafb.glyphs.offset + offset ), VESAFB_CHAR_HEIGHT);
}

View File

@ -47,7 +47,7 @@ static char __bss16_array ( syslinux_version, [32] );
#define syslinux_version __use_data16 ( syslinux_version )
/** The "SYSLINUX" copyright string */
static char __data16_array ( syslinux_copyright, [] ) = " https://ipxe.org";
static char __data16_array ( syslinux_copyright, [] ) = " http://ipxe.org";
#define syslinux_copyright __use_data16 ( syslinux_copyright )
static char __data16_array ( syslinux_configuration_file, [] ) = "";

View File

@ -380,11 +380,6 @@ process_bytes:
pushl %eax
pushl %ebp
/* Construct ljmp code on stack (since .prefix may not be writable) */
.equ LJMP_LEN, 0x06
pushw %cs /* "nop ; ljmp %cs, $2f" */
pushw $2f
pushw $0xea90
/* Construct GDT on stack (since .prefix may not be writable) */
.equ GDT_LEN, 0x20
.equ PM_DS, 0x18 /* Flat data segment */
@ -415,9 +410,8 @@ process_bytes:
pushw %es
pushw %ds
pushw %ss
pushw %ss /* Far pointer to ljmp code on stack */
leaw (GDT_LEN + 1)(%bp), %ax
pushw %ax
pushw %cs
pushw $2f
cli
data32 lgdt (%bp)
movl %cr0, %eax
@ -444,7 +438,7 @@ process_bytes:
popfw
movl %eax, %cr0
lret
2: /* lret will ljmp to here (via constructed ljmp on stack) */
2: /* lret will ljmp to here */
popw %ss
popw %ds
popw %es
@ -467,7 +461,7 @@ process_bytes:
/* Restore GDT */
data32 lgdt -8(%bp)
leaw (GDT_LEN + LJMP_LEN)(%bp), %sp
leaw GDT_LEN(%bp), %sp
/* Restore registers and return */
popl %ebp

View File

@ -161,7 +161,7 @@ pnpheader:
/* Manufacturer string */
mfgstr:
.asciz "https://ipxe.org"
.asciz "http://ipxe.org"
.size mfgstr, . - mfgstr
/* Product string
@ -607,7 +607,7 @@ get_pmm_decompress_to:
* strings PRODUCT_NAME and PRODUCT_SHORT_NAME in config/branding.h.
*
* While nothing in the GPL prevents you from removing all references
* to iPXE or https://ipxe.org, we prefer you not to do so.
* to iPXE or http://ipxe.org, we prefer you not to do so.
*
* If you have an OEM-mandated branding requirement that cannot be
* satisfied simply by defining PRODUCT_NAME and PRODUCT_SHORT_NAME,

View File

@ -229,8 +229,6 @@ SECTIONS {
*(.einfo.*)
*(.discard)
*(.discard.*)
*(.sbat)
*(.sbat.*)
}
/*

View File

@ -24,8 +24,6 @@ SECTIONS {
*(.einfo.*)
*(.discard)
*(.discard.*)
*(.sbat)
*(.sbat.*)
}
}

View File

@ -100,7 +100,5 @@ SECTIONS {
*(.rel.*)
*(.discard)
*(.discard.*)
*(.sbat)
*(.sbat.*)
}
}

View File

@ -26,7 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define PRODUCT_NAME ""
#define PRODUCT_SHORT_NAME "iPXE"
#define PRODUCT_URI "https://ipxe.org"
#define PRODUCT_URI "http://ipxe.org"
/*
* Tag line
@ -44,15 +44,15 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* (e.g. "Permission denied") and a 32-bit error number. This number
* is incorporated into an error URI such as
*
* "No such file or directory (https://ipxe.org/2d0c613b)"
* "No such file or directory (http://ipxe.org/2d0c613b)"
*
* or
*
* "Operation not supported (https://ipxe.org/3c092003)"
* "Operation not supported (http://ipxe.org/3c092003)"
*
* Users may browse to the URI within the error message, which is
* provided by a database running on the iPXE web site
* (https://ipxe.org). This database provides details for all possible
* (http://ipxe.org). This database provides details for all possible
* errors generated by iPXE, including:
*
* - the detailed error message (e.g. "Not an OCSP signing
@ -74,13 +74,13 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
* If you have a customer support team and would like your customers
* to contact your support team for all problems, instead of using the
* existing support infrastructure provided by https://ipxe.org, then
* existing support infrastructure provided by http://ipxe.org, then
* you may define a custom URI to be included within error messages.
*
* Note that the custom URI is a printf() format string which must
* include a format specifier for the 32-bit error number.
*/
#define PRODUCT_ERROR_URI "https://ipxe.org/%08x"
#define PRODUCT_ERROR_URI "http://ipxe.org/%08x"
/*
* Command help messages
@ -88,7 +88,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* iPXE command help messages include a URI constructed from the
* command name, such as
*
* "See https://ipxe.org/cmd/vcreate for further information"
* "See http://ipxe.org/cmd/vcreate for further information"
*
* The iPXE web site includes documentation for the commands provided
* by the iPXE shell, including:
@ -113,7 +113,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
* If you want to provide your own documentation for all of the
* commands provided by the iPXE shell, rather than using the existing
* support infrastructure provided by https://ipxe.org, then you may
* support infrastructure provided by http://ipxe.org, then you may
* define a custom URI to be included within command help messages.
*
* Note that the custom URI is a printf() format string which must
@ -124,7 +124,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* iPXE project and prohibit the alteration or removal of any
* references to "iPXE". ]
*/
#define PRODUCT_COMMAND_URI "https://ipxe.org/cmd/%s"
#define PRODUCT_COMMAND_URI "http://ipxe.org/cmd/%s"
/*
* Setting help messages
@ -132,7 +132,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* iPXE setting help messages include a URI constructed from the
* setting name, such as
*
* "https://ipxe.org/cfg/initiator-iqn"
* "http://ipxe.org/cfg/initiator-iqn"
*
* The iPXE web site includes documentation for the settings used by
* iPXE, including:
@ -156,7 +156,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
* If you want to provide your own documentation for all of the
* settings used by iPXE, rather than using the existing support
* infrastructure provided by https://ipxe.org, then you may define a
* infrastructure provided by http://ipxe.org, then you may define a
* custom URI to be included within setting help messages.
*
* Note that the custom URI is a printf() format string which must
@ -167,25 +167,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* iPXE project and prohibit the alteration or removal of any
* references to "iPXE". ]
*/
#define PRODUCT_SETTING_URI "https://ipxe.org/cfg/%s"
/*
* Product security name suffix
*
* Vendors creating signed iPXE binaries must set this to a non-empty
* value (e.g. "2pint").
*/
#define PRODUCT_SBAT_NAME ""
/*
* Product security generation
*
* Vendors creating signed iPXE binaries must set this to a non-zero
* value, and must increment the value whenever a Secure Boot exploit
* is fixed (unless the upstream IPXE_SBAT_GENERATION has already been
* incremented as part of that fix).
*/
#define PRODUCT_SBAT_GENERATION 0
#define PRODUCT_SETTING_URI "http://ipxe.org/cfg/%s"
#include <config/local/branding.h>

View File

@ -58,8 +58,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define NAP_EFIARM
#endif
#if defined ( __aarch64__ )
#define IMAGE_GZIP /* GZIP image support */
#endif
#endif /* CONFIG_DEFAULTS_EFI_H */

View File

@ -38,12 +38,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** Colour for debug messages */
#define colour FADT_SIGNATURE
/** ACPI table finder
*
* May be overridden at link time to inject tables for testing.
*/
typeof ( acpi_find ) *acpi_finder __attribute__ (( weak )) = acpi_find;
/******************************************************************************
*
* Utility functions
@ -88,18 +82,6 @@ void acpi_fix_checksum ( struct acpi_header *acpi ) {
acpi->checksum -= acpi_checksum ( virt_to_user ( acpi ) );
}
/**
* Locate ACPI table
*
* @v signature Requested table signature
* @v index Requested index of table with this signature
* @ret table Table, or UNULL if not found
*/
userptr_t acpi_table ( uint32_t signature, unsigned int index ) {
return ( *acpi_finder ) ( signature, index );
}
/**
* Locate ACPI table via RSDT
*
@ -187,22 +169,33 @@ userptr_t acpi_find_via_rsdt ( uint32_t signature, unsigned int index ) {
}
/**
* Extract value from DSDT/SSDT
* Extract \_Sx value from DSDT/SSDT
*
* @v zsdt DSDT or SSDT
* @v signature Signature (e.g. "_S5_")
* @v data Data buffer
* @v extract Extraction method
* @ret rc Return status code
* @ret sx \_Sx value, or negative error
*
* In theory, extracting the \_Sx value from the DSDT/SSDT requires a
* full ACPI parser plus some heuristics to work around the various
* broken encodings encountered in real ACPI implementations.
*
* In practice, we can get the same result by scanning through the
* DSDT/SSDT for the signature (e.g. "_S5_"), extracting the first
* four bytes, removing any bytes with bit 3 set, and treating
* whatever is left as a little-endian value. This is one of the
* uglier hacks I have ever implemented, but it's still prettier than
* the ACPI specification itself.
*/
static int acpi_zsdt ( userptr_t zsdt, uint32_t signature, void *data,
int ( * extract ) ( userptr_t zsdt, size_t len,
size_t offset, void *data ) ) {
static int acpi_sx_zsdt ( userptr_t zsdt, uint32_t signature ) {
struct acpi_header acpi;
uint32_t buf;
union {
uint32_t dword;
uint8_t byte[4];
} buf;
size_t offset;
size_t len;
int rc;
unsigned int sx;
uint8_t *byte;
/* Read table header */
copy_from_user ( &acpi, zsdt, 0, sizeof ( acpi ) );
@ -210,64 +203,87 @@ static int acpi_zsdt ( userptr_t zsdt, uint32_t signature, void *data,
/* Locate signature */
for ( offset = sizeof ( acpi ) ;
( ( offset + sizeof ( buf ) /* signature */ ) < len ) ;
( ( offset + sizeof ( buf ) /* signature */ + 3 /* pkg header */
+ sizeof ( buf ) /* value */ ) < len ) ;
offset++ ) {
/* Check signature */
copy_from_user ( &buf, zsdt, offset, sizeof ( buf ) );
if ( buf != cpu_to_le32 ( signature ) )
if ( buf.dword != cpu_to_le32 ( signature ) )
continue;
DBGC ( zsdt, "DSDT/SSDT %#08lx found %s at offset %#zx\n",
user_to_phys ( zsdt, 0 ), acpi_name ( signature ),
offset );
offset += sizeof ( buf );
/* Attempt to extract data */
if ( ( rc = extract ( zsdt, len, offset, data ) ) == 0 )
return 0;
/* Read first four bytes of value */
copy_from_user ( &buf, zsdt, ( offset + 3 /* pkg header */ ),
sizeof ( buf ) );
DBGC ( zsdt, "DSDT/SSDT %#08lx found %s containing "
"%02x:%02x:%02x:%02x\n", user_to_phys ( zsdt, 0 ),
acpi_name ( signature ), buf.byte[0], buf.byte[1],
buf.byte[2], buf.byte[3] );
/* Extract \Sx value. There are three potential
* encodings that we might encounter:
*
* - SLP_TYPa, SLP_TYPb, rsvd, rsvd
*
* - <byteprefix>, SLP_TYPa, <byteprefix>, SLP_TYPb, ...
*
* - <dwordprefix>, SLP_TYPa, SLP_TYPb, 0, 0
*
* Since <byteprefix> and <dwordprefix> both have bit
* 3 set, and valid SLP_TYPx must have bit 3 clear
* (since SLP_TYPx is a 3-bit field), we can just skip
* any bytes with bit 3 set.
*/
byte = &buf.byte[0];
if ( *byte & 0x08 )
byte++;
sx = *(byte++);
if ( *byte & 0x08 )
byte++;
sx |= ( *byte << 8 );
return sx;
}
return -ENOENT;
}
/**
* Extract value from DSDT/SSDT
* Extract \_Sx value from DSDT/SSDT
*
* @v signature Signature (e.g. "_S5_")
* @v data Data buffer
* @v extract Extraction method
* @ret rc Return status code
* @ret sx \_Sx value, or negative error
*/
int acpi_extract ( uint32_t signature, void *data,
int ( * extract ) ( userptr_t zsdt, size_t len,
size_t offset, void *data ) ) {
int acpi_sx ( uint32_t signature ) {
struct acpi_fadt fadtab;
userptr_t fadt;
userptr_t dsdt;
userptr_t ssdt;
unsigned int i;
int rc;
int sx;
/* Try DSDT first */
fadt = acpi_table ( FADT_SIGNATURE, 0 );
fadt = acpi_find ( FADT_SIGNATURE, 0 );
if ( fadt ) {
copy_from_user ( &fadtab, fadt, 0, sizeof ( fadtab ) );
dsdt = phys_to_user ( fadtab.dsdt );
if ( ( rc = acpi_zsdt ( dsdt, signature, data,
extract ) ) == 0 )
return 0;
if ( ( sx = acpi_sx_zsdt ( dsdt, signature ) ) >= 0 )
return sx;
}
/* Try all SSDTs */
for ( i = 0 ; ; i++ ) {
ssdt = acpi_table ( SSDT_SIGNATURE, i );
ssdt = acpi_find ( SSDT_SIGNATURE, i );
if ( ! ssdt )
break;
if ( ( rc = acpi_zsdt ( ssdt, signature, data,
extract ) ) == 0 )
return 0;
if ( ( sx = acpi_sx_zsdt ( ssdt, signature ) ) >= 0 )
return sx;
}
DBGC ( colour, "ACPI could not find \"%s\"\n",
DBGC ( colour, "ACPI could not find \\_Sx \"%s\"\n",
acpi_name ( signature ) );
return -ENOENT;
}

View File

@ -88,7 +88,7 @@ static int acpi_settings_fetch ( struct settings *settings,
acpi_name ( tag_signature ), tag_index, tag_offset, tag_len );
/* Locate ACPI table */
table = acpi_table ( tag_signature, tag_index );
table = acpi_find ( tag_signature, tag_index );
if ( ! table )
return -ENOENT;

View File

@ -1,251 +0,0 @@
/*
* Copyright (C) 2021 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <errno.h>
#include <ipxe/acpi.h>
#include <ipxe/base16.h>
#include <ipxe/ethernet.h>
#include <ipxe/if_ether.h>
#include <ipxe/acpimac.h>
/** @file
*
* ACPI MAC address
*
*/
/** Colour for debug messages */
#define colour FADT_SIGNATURE
/** AMAC signature */
#define AMAC_SIGNATURE ACPI_SIGNATURE ( 'A', 'M', 'A', 'C' )
/** MACA signature */
#define MACA_SIGNATURE ACPI_SIGNATURE ( 'M', 'A', 'C', 'A' )
/** RTMA signature */
#define RTMA_SIGNATURE ACPI_SIGNATURE ( 'R', 'T', 'M', 'A' )
/** Maximum number of bytes to skip after ACPI signature
*
* This is entirely empirical.
*/
#define ACPIMAC_MAX_SKIP 8
/** An ACPI MAC extraction mechanism */
struct acpimac_extractor {
/** Prefix string */
const char *prefix;
/** Encoded MAC length */
size_t len;
/** Decode MAC
*
* @v mac Encoded MAC
* @v hw_addr MAC address to fill in
* @ret rc Return status code
*/
int ( * decode ) ( const char *mac, uint8_t *hw_addr );
};
/**
* Decode Base16-encoded MAC address
*
* @v mac Encoded MAC
* @v hw_addr MAC address to fill in
* @ret rc Return status code
*/
static int acpimac_decode_base16 ( const char *mac, uint8_t *hw_addr ) {
int len;
int rc;
/* Attempt to base16-decode MAC address */
len = base16_decode ( mac, hw_addr, ETH_ALEN );
if ( len < 0 ) {
rc = len;
DBGC ( colour, "ACPI could not decode base16 MAC \"%s\": %s\n",
mac, strerror ( rc ) );
return rc;
}
return 0;
}
/**
* Decode raw MAC address
*
* @v mac Encoded MAC
* @v hw_addr MAC address to fill in
* @ret rc Return status code
*/
static int acpimac_decode_raw ( const char *mac, uint8_t *hw_addr ) {
memcpy ( hw_addr, mac, ETH_ALEN );
return 0;
}
/** "_AUXMAC_" extraction mechanism */
static struct acpimac_extractor acpimac_auxmac = {
.prefix = "_AUXMAC_#",
.len = ( ETH_ALEN * 2 ),
.decode = acpimac_decode_base16,
};
/** "_RTXMAC_" extraction mechanism */
static struct acpimac_extractor acpimac_rtxmac = {
.prefix = "_RTXMAC_#",
.len = ETH_ALEN,
.decode = acpimac_decode_raw,
};
/**
* Extract MAC address from DSDT/SSDT
*
* @v zsdt DSDT or SSDT
* @v len Length of DSDT/SSDT
* @v offset Offset of signature within DSDT/SSDT
* @v data Data buffer
* @v extractor ACPI MAC address extractor
* @ret rc Return status code
*
* Some vendors provide a "system MAC address" within the DSDT/SSDT,
* to be used to override the MAC address for a USB docking station.
*
* A full implementation would require an ACPI bytecode interpreter,
* since at least one OEM allows the MAC address to be constructed by
* executable ACPI bytecode (rather than a fixed data structure).
*
* We instead attempt to extract a plausible-looking "_AUXMAC_#.....#"
* string that appears shortly after an "AMAC" or "MACA" signature.
* This should work for most implementations encountered in practice.
*/
static int acpimac_extract ( userptr_t zsdt, size_t len, size_t offset,
void *data, struct acpimac_extractor *extractor ){
size_t prefix_len = strlen ( extractor->prefix );
uint8_t *hw_addr = data;
size_t skip = 0;
char buf[ prefix_len + extractor->len + 1 /* "#" */ + 1 /* NUL */ ];
char *mac = &buf[prefix_len];
int rc;
/* Skip signature and at least one tag byte */
offset += ( 4 /* signature */ + 1 /* tag byte */ );
/* Scan for suitable string close to signature */
for ( skip = 0 ;
( ( skip < ACPIMAC_MAX_SKIP ) &&
( offset + skip + sizeof ( buf ) ) <= len ) ;
skip++ ) {
/* Read value */
copy_from_user ( buf, zsdt, ( offset + skip ),
sizeof ( buf ) );
/* Check for expected format */
if ( memcmp ( buf, extractor->prefix, prefix_len ) != 0 )
continue;
if ( buf[ sizeof ( buf ) - 2 ] != '#' )
continue;
if ( buf[ sizeof ( buf ) - 1 ] != '\0' )
continue;
DBGC ( colour, "ACPI found MAC:\n" );
DBGC_HDA ( colour, ( offset + skip ), buf, sizeof ( buf ) );
/* Terminate MAC address string */
mac[extractor->len] = '\0';
/* Decode MAC address */
if ( ( rc = extractor->decode ( mac, hw_addr ) ) != 0 )
return rc;
/* Check MAC address validity */
if ( ! is_valid_ether_addr ( hw_addr ) ) {
DBGC ( colour, "ACPI has invalid MAC %s\n",
eth_ntoa ( hw_addr ) );
return -EINVAL;
}
return 0;
}
return -ENOENT;
}
/**
* Extract "_AUXMAC_" MAC address from DSDT/SSDT
*
* @v zsdt DSDT or SSDT
* @v len Length of DSDT/SSDT
* @v offset Offset of signature within DSDT/SSDT
* @v data Data buffer
* @ret rc Return status code
*/
static int acpimac_extract_auxmac ( userptr_t zsdt, size_t len, size_t offset,
void *data ) {
return acpimac_extract ( zsdt, len, offset, data, &acpimac_auxmac );
}
/**
* Extract "_RTXMAC_" MAC address from DSDT/SSDT
*
* @v zsdt DSDT or SSDT
* @v len Length of DSDT/SSDT
* @v offset Offset of signature within DSDT/SSDT
* @v data Data buffer
* @ret rc Return status code
*/
static int acpimac_extract_rtxmac ( userptr_t zsdt, size_t len, size_t offset,
void *data ) {
return acpimac_extract ( zsdt, len, offset, data, &acpimac_rtxmac );
}
/**
* Extract MAC address from DSDT/SSDT
*
* @v hw_addr MAC address to fill in
* @ret rc Return status code
*/
int acpi_mac ( uint8_t *hw_addr ) {
int rc;
/* Look for an "AMAC" address */
if ( ( rc = acpi_extract ( AMAC_SIGNATURE, hw_addr,
acpimac_extract_auxmac ) ) == 0 )
return 0;
/* Look for a "MACA" address */
if ( ( rc = acpi_extract ( MACA_SIGNATURE, hw_addr,
acpimac_extract_auxmac ) ) == 0 )
return 0;
/* Look for a "RTMA" address */
if ( ( rc = acpi_extract ( RTMA_SIGNATURE, hw_addr,
acpimac_extract_rtxmac ) ) == 0 )
return 0;
return -ENOENT;
}

View File

@ -90,63 +90,30 @@ static void cachedhcp_free ( struct cached_dhcp_packet *cache ) {
*/
static int cachedhcp_apply ( struct cached_dhcp_packet *cache,
struct net_device *netdev ) {
struct settings *settings = NULL;
struct ll_protocol *ll_protocol;
const uint8_t *chaddr;
uint8_t *hw_addr;
uint8_t *ll_addr;
size_t ll_addr_len;
struct settings *settings;
int rc;
/* Do nothing if cache is empty */
if ( ! cache->dhcppkt )
return 0;
chaddr = cache->dhcppkt->dhcphdr->chaddr;
/* Handle association with network device, if specified */
/* Do nothing unless cached packet's MAC address matches this
* network device, if specified.
*/
if ( netdev ) {
hw_addr = netdev->hw_addr;
ll_addr = netdev->ll_addr;
ll_protocol = netdev->ll_protocol;
ll_addr_len = ll_protocol->ll_addr_len;
/* If cached packet's MAC address matches the network
* device's permanent MAC address, then assume that
* the permanent MAC address ought to be the network
* device's current link-layer address.
*
* This situation can arise when the PXE ROM does not
* understand the system-specific mechanism for
* overriding the MAC address, and so uses the
* permanent MAC address instead. We choose to match
* this behaviour in order to minimise surprise.
*/
if ( memcmp ( hw_addr, chaddr, ll_addr_len ) == 0 ) {
if ( memcmp ( hw_addr, ll_addr, ll_addr_len ) != 0 ) {
DBGC ( colour, "CACHEDHCP %s resetting %s MAC "
"%s ", cache->name, netdev->name,
ll_protocol->ntoa ( ll_addr ) );
DBGC ( colour, "-> %s\n",
ll_protocol->ntoa ( hw_addr ) );
}
memcpy ( ll_addr, hw_addr, ll_addr_len );
}
/* Do nothing unless cached packet's MAC address
* matches this network device.
*/
if ( memcmp ( ll_addr, chaddr, ll_addr_len ) != 0 ) {
if ( memcmp ( netdev->ll_addr, cache->dhcppkt->dhcphdr->chaddr,
netdev->ll_protocol->ll_addr_len ) != 0 ) {
DBGC ( colour, "CACHEDHCP %s does not match %s\n",
cache->name, netdev->name );
return 0;
}
DBGC ( colour, "CACHEDHCP %s is for %s\n",
cache->name, netdev->name );
/* Use network device's settings block */
settings = netdev_settings ( netdev );
}
/* Select appropriate parent settings block */
settings = ( netdev ? netdev_settings ( netdev ) : NULL );
/* Register settings */
if ( ( rc = register_settings ( &cache->dhcppkt->settings, settings,
cache->name ) ) != 0 ) {

View File

@ -1,131 +0,0 @@
/*
* Copyright (C) 2022 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
*
* Dynamic keyboard mappings
*
*/
#include <stdlib.h>
#include <errno.h>
#include <ipxe/settings.h>
#include <ipxe/keymap.h>
/**
* Require a keyboard map
*
* @v name Keyboard map name
*/
#define REQUIRE_KEYMAP( name ) REQUIRE_OBJECT ( keymap_ ## name )
/** Keyboard map setting */
const struct setting keymap_setting __setting ( SETTING_MISC, keymap ) = {
.name = "keymap",
.description = "Keyboard map",
.type = &setting_type_string,
};
/**
* Apply keyboard map settings
*
* @ret rc Return status code
*/
static int keymap_apply ( void ) {
struct keymap *keymap;
char *name;
int rc;
/* Fetch keyboard map name */
fetch_string_setting_copy ( NULL, &keymap_setting, &name );
/* Identify keyboard map */
if ( name ) {
/* Identify named keyboard map */
keymap = keymap_find ( name );
if ( ! keymap ) {
DBGC ( &keymap_setting, "KEYMAP could not identify "
"\"%s\"\n", name );
rc = -ENOENT;
goto err_unknown;
}
} else {
/* Use default keyboard map */
keymap = NULL;
}
/* Set keyboard map */
keymap_set ( keymap );
/* Success */
rc = 0;
err_unknown:
free ( name );
return rc;
}
/** Keyboard map setting applicator */
struct settings_applicator keymap_applicator __settings_applicator = {
.apply = keymap_apply,
};
/* Provide virtual "dynamic" keyboard map for linker */
PROVIDE_SYMBOL ( obj_keymap_dynamic );
/* Drag in keyboard maps via keymap_setting */
REQUIRING_SYMBOL ( keymap_setting );
/* Require all known keyboard maps */
REQUIRE_KEYMAP ( al );
REQUIRE_KEYMAP ( by );
REQUIRE_KEYMAP ( cf );
REQUIRE_KEYMAP ( cz );
REQUIRE_KEYMAP ( de );
REQUIRE_KEYMAP ( dk );
REQUIRE_KEYMAP ( es );
REQUIRE_KEYMAP ( et );
REQUIRE_KEYMAP ( fi );
REQUIRE_KEYMAP ( fr );
REQUIRE_KEYMAP ( gr );
REQUIRE_KEYMAP ( hu );
REQUIRE_KEYMAP ( il );
REQUIRE_KEYMAP ( it );
REQUIRE_KEYMAP ( lt );
REQUIRE_KEYMAP ( mk );
REQUIRE_KEYMAP ( mt );
REQUIRE_KEYMAP ( nl );
REQUIRE_KEYMAP ( no );
REQUIRE_KEYMAP ( no_latin1 );
REQUIRE_KEYMAP ( pl );
REQUIRE_KEYMAP ( pt );
REQUIRE_KEYMAP ( ro );
REQUIRE_KEYMAP ( ru );
REQUIRE_KEYMAP ( se );
REQUIRE_KEYMAP ( sg );
REQUIRE_KEYMAP ( sr_latin );
REQUIRE_KEYMAP ( ua );
REQUIRE_KEYMAP ( uk );
REQUIRE_KEYMAP ( us );

View File

@ -446,11 +446,6 @@ void fbcon_putchar ( struct fbcon *fbcon, int character ) {
if ( character < 0 )
return;
/* Accumulate Unicode characters */
character = utf8_accumulate ( &fbcon->utf8, character );
if ( character == 0 )
return;
/* Handle control characters */
switch ( character ) {
case '\r':

View File

@ -338,12 +338,9 @@ int image_exec ( struct image *image ) {
/* Sanity check */
assert ( image->flags & IMAGE_REGISTERED );
/* Switch current working directory to be that of the image
* itself, if applicable
*/
/* Switch current working directory to be that of the image itself */
old_cwuri = uri_get ( cwuri );
if ( image->uri )
churi ( image->uri );
churi ( image->uri );
/* Preserve record of any currently-running image */
saved_current_image = current_image;

View File

@ -1,131 +0,0 @@
/*
* Copyright (C) 2022 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <ctype.h>
#include <ipxe/keys.h>
#include <ipxe/keymap.h>
/** @file
*
* Keyboard mappings
*
*/
/** ASCII character mask */
#define ASCII_MASK 0x7f
/** Control character mask */
#define CTRL_MASK 0x1f
/** Upper case character mask */
#define UPPER_MASK 0x5f
/** Case toggle bit */
#define CASE_TOGGLE ( ASCII_MASK & ~UPPER_MASK )
/** Default keyboard mapping */
static TABLE_START ( keymap_start, KEYMAP );
/** Current keyboard mapping */
static struct keymap *keymap_current = keymap_start;
/**
* Remap a key
*
* @v character Character read from console
* @ret mapped Mapped character
*/
unsigned int key_remap ( unsigned int character ) {
struct keymap *keymap = keymap_current;
unsigned int mapped = ( character & KEYMAP_MASK );
struct keymap_key *key;
/* Invert case before remapping if applicable */
if ( ( character & KEYMAP_CAPSLOCK_UNDO ) && isalpha ( mapped ) )
mapped ^= CASE_TOGGLE;
/* Select remapping table */
key = ( ( character & KEYMAP_ALTGR ) ? keymap->altgr : keymap->basic );
/* Remap via table */
for ( ; key->from ; key++ ) {
if ( mapped == key->from ) {
mapped = key->to;
break;
}
}
/* Handle Ctrl-<key> and CapsLock */
if ( isalpha ( mapped ) ) {
if ( character & KEYMAP_CTRL ) {
mapped &= CTRL_MASK;
} else if ( character & KEYMAP_CAPSLOCK ) {
mapped ^= CASE_TOGGLE;
}
}
/* Clear flags */
mapped &= ASCII_MASK;
DBGC2 ( &keymap_current, "KEYMAP mapped %04x => %02x\n",
character, mapped );
return mapped;
}
/**
* Find keyboard map by name
*
* @v name Keyboard map name
* @ret keymap Keyboard map, or NULL if not found
*/
struct keymap * keymap_find ( const char *name ) {
struct keymap *keymap;
/* Find matching keyboard map */
for_each_table_entry ( keymap, KEYMAP ) {
if ( strcmp ( keymap->name, name ) == 0 )
return keymap;
}
return NULL;
}
/**
* Set keyboard map
*
* @v keymap Keyboard map, or NULL to use default
*/
void keymap_set ( struct keymap *keymap ) {
/* Use default keymap if none specified */
if ( ! keymap )
keymap = keymap_start;
/* Set new keyboard map */
if ( keymap != keymap_current )
DBGC ( &keymap_current, "KEYMAP using \"%s\"\n", keymap->name );
keymap_current = keymap;
}

View File

@ -411,8 +411,9 @@ struct settings * find_settings ( const char *name ) {
/**
* Apply all settings
*
* @ret rc Return status code
*/
static void apply_settings ( void ) {
static int apply_settings ( void ) {
struct settings_applicator *applicator;
int rc;
@ -421,9 +422,11 @@ static void apply_settings ( void ) {
if ( ( rc = applicator->apply() ) != 0 ) {
DBG ( "Could not apply settings using applicator "
"%p: %s\n", applicator, strerror ( rc ) );
/* Continue to apply remaining settings */
return rc;
}
}
return 0;
}
/**
@ -641,7 +644,8 @@ int store_setting ( struct settings *settings, const struct setting *setting,
*/
for ( ; settings ; settings = settings->parent ) {
if ( settings == &settings_root ) {
apply_settings();
if ( ( rc = apply_settings() ) != 0 )
return rc;
break;
}
}
@ -2195,7 +2199,7 @@ const struct setting_type setting_type_base64 __setting_type = {
};
/**
* Format UUID/GUID setting value
* Format UUID setting value
*
* @v type Setting type
* @v raw Raw setting value
@ -2204,24 +2208,17 @@ const struct setting_type setting_type_base64 __setting_type = {
* @v len Length of buffer
* @ret len Length of formatted value, or negative error
*/
static int format_uuid_setting ( const struct setting_type *type,
static int format_uuid_setting ( const struct setting_type *type __unused,
const void *raw, size_t raw_len, char *buf,
size_t len ) {
union uuid uuid;
const union uuid *uuid = raw;
/* Range check */
if ( raw_len != sizeof ( uuid ) )
if ( raw_len != sizeof ( *uuid ) )
return -ERANGE;
/* Copy value */
memcpy ( &uuid, raw, sizeof ( uuid ) );
/* Mangle GUID byte ordering */
if ( type == &setting_type_guid )
uuid_mangle ( &uuid );
/* Format value */
return snprintf ( buf, len, "%s", uuid_ntoa ( &uuid ) );
return snprintf ( buf, len, "%s", uuid_ntoa ( uuid ) );
}
/** UUID setting type */
@ -2230,12 +2227,6 @@ const struct setting_type setting_type_uuid __setting_type = {
.format = format_uuid_setting,
};
/** GUID setting type */
const struct setting_type setting_type_guid __setting_type = {
.name = "guid",
.format = format_uuid_setting,
};
/**
* Format PCI bus:dev.fn setting value
*

View File

@ -79,10 +79,12 @@ size_t uri_decode ( const char *encoded, void *buf, size_t len ) {
/**
* Decode URI field in-place
*
* @v encoded Encoded field, or NULL
* @v uri URI
* @v field URI field index
*/
static void uri_decode_inplace ( char *encoded ) {
char *decoded = encoded;
static void uri_decode_inplace ( struct uri *uri, unsigned int field ) {
const char *encoded = uri_field ( uri, field );
char *decoded = ( ( char * ) encoded );
size_t len;
/* Do nothing if field is not present */
@ -148,7 +150,7 @@ static int uri_character_escaped ( char c, unsigned int field ) {
* parser but for any other URI parsers (e.g. HTTP query
* string parsers, which care about '=' and '&').
*/
static const char *escaped[URI_EPATH] = {
static const char *escaped[URI_FIELDS] = {
/* Scheme or default: escape everything */
[URI_SCHEME] = "/#:@?=&",
/* Opaque part: escape characters which would affect
@ -170,21 +172,20 @@ static int uri_character_escaped ( char c, unsigned int field ) {
* appears within paths.
*/
[URI_PATH] = "#:@?",
/* Query: escape everything except '/', which
* sometimes appears within queries.
*/
[URI_QUERY] = "#:@?",
/* Fragment: escape everything */
[URI_FRAGMENT] = "/#:@?",
};
/* Always escape non-printing characters and whitespace */
if ( ( ! isprint ( c ) ) || ( c == ' ' ) )
return 1;
/* Escape nothing else in already-escaped fields */
if ( field >= URI_EPATH )
return 0;
/* Escape '%' and any field-specific characters */
if ( ( c == '%' ) || strchr ( escaped[field], c ) )
return 1;
return 0;
return ( /* Always escape non-printing characters and whitespace */
( ! isprint ( c ) ) || ( c == ' ' ) ||
/* Always escape '%' */
( c == '%' ) ||
/* Escape field-specific characters */
strchr ( escaped[field], c ) );
}
/**
@ -261,12 +262,10 @@ static void uri_dump ( const struct uri *uri ) {
DBGC ( uri, " port \"%s\"", uri->port );
if ( uri->path )
DBGC ( uri, " path \"%s\"", uri->path );
if ( uri->epath )
DBGC ( uri, " epath \"%s\"", uri->epath );
if ( uri->equery )
DBGC ( uri, " equery \"%s\"", uri->equery );
if ( uri->efragment )
DBGC ( uri, " efragment \"%s\"", uri->efragment );
if ( uri->query )
DBGC ( uri, " query \"%s\"", uri->query );
if ( uri->fragment )
DBGC ( uri, " fragment \"%s\"", uri->fragment );
if ( uri->params )
DBGC ( uri, " params \"%s\"", uri->params->name );
}
@ -299,19 +298,17 @@ struct uri * parse_uri ( const char *uri_string ) {
char *raw;
char *tmp;
char *path;
char *epath;
char *authority;
size_t raw_len;
unsigned int field;
/* Allocate space for URI struct and two copies of the string */
/* Allocate space for URI struct and a copy of the string */
raw_len = ( strlen ( uri_string ) + 1 /* NUL */ );
uri = zalloc ( sizeof ( *uri ) + ( 2 * raw_len ) );
uri = zalloc ( sizeof ( *uri ) + raw_len );
if ( ! uri )
return NULL;
ref_init ( &uri->refcnt, uri_free );
raw = ( ( ( void * ) uri ) + sizeof ( *uri ) );
path = ( raw + raw_len );
/* Copy in the raw string */
memcpy ( raw, uri_string, raw_len );
@ -331,62 +328,57 @@ struct uri * parse_uri ( const char *uri_string ) {
/* Chop off the fragment, if it exists */
if ( ( tmp = strchr ( raw, '#' ) ) ) {
*(tmp++) = '\0';
uri->efragment = tmp;
uri->fragment = tmp;
}
/* Identify absolute URIs */
epath = raw;
for ( tmp = raw ; ; tmp++ ) {
/* Possible scheme character (for our URI schemes) */
if ( isalpha ( *tmp ) || ( *tmp == '-' ) || ( *tmp == '_' ) )
continue;
/* Invalid scheme character or NUL: is a relative URI */
if ( *tmp != ':' )
break;
/* Identify absolute/relative URI */
if ( ( tmp = strchr ( raw, ':' ) ) ) {
/* Absolute URI: identify hierarchical/opaque */
uri->scheme = raw;
*(tmp++) = '\0';
if ( *tmp == '/' ) {
/* Absolute URI with hierarchical part */
epath = tmp;
path = tmp;
} else {
/* Absolute URI with opaque part */
uri->opaque = tmp;
epath = NULL;
path = NULL;
}
break;
} else {
/* Relative URI */
path = raw;
}
/* If we don't have a path (i.e. we have an absolute URI with
* an opaque portion, we're already finished processing
*/
if ( ! epath )
if ( ! path )
goto done;
/* Chop off the query, if it exists */
if ( ( tmp = strchr ( epath, '?' ) ) ) {
if ( ( tmp = strchr ( path, '?' ) ) ) {
*(tmp++) = '\0';
uri->equery = tmp;
uri->query = tmp;
}
/* If we have no path remaining, then we're already finished
* processing.
*/
if ( ! epath[0] )
if ( ! path[0] )
goto done;
/* Identify net/absolute/relative path */
if ( uri->scheme && ( strncmp ( epath, "//", 2 ) == 0 ) ) {
if ( uri->scheme && ( strncmp ( path, "//", 2 ) == 0 ) ) {
/* Net path. If this is terminated by the first '/'
* of an absolute path, then we have no space for a
* terminator after the authority field, so shuffle
* the authority down by one byte, overwriting one of
* the two slashes.
*/
authority = ( epath + 2 );
authority = ( path + 2 );
if ( ( tmp = strchr ( authority, '/' ) ) ) {
/* Shuffle down */
uri->epath = tmp;
uri->path = tmp;
memmove ( ( authority - 1 ), authority,
( tmp - authority ) );
authority--;
@ -394,14 +386,8 @@ struct uri * parse_uri ( const char *uri_string ) {
}
} else {
/* Absolute/relative path */
uri->epath = epath;
authority = NULL;
}
/* Create copy of path for decoding */
if ( uri->epath ) {
strcpy ( path, uri->epath );
uri->path = path;
authority = NULL;
}
/* If we don't have an authority (i.e. we have a non-net
@ -435,8 +421,8 @@ struct uri * parse_uri ( const char *uri_string ) {
done:
/* Decode fields in-place */
for ( field = 0 ; field < URI_EPATH ; field++ )
uri_decode_inplace ( ( char * ) uri_field ( uri, field ) );
for ( field = 0 ; field < URI_FIELDS ; field++ )
uri_decode_inplace ( uri, field );
DBGC ( uri, "URI parsed \"%s\" to", uri_string );
uri_dump ( uri );
@ -472,8 +458,8 @@ size_t format_uri ( const struct uri *uri, char *buf, size_t len ) {
static const char prefixes[URI_FIELDS] = {
[URI_PASSWORD] = ':',
[URI_PORT] = ':',
[URI_EQUERY] = '?',
[URI_EFRAGMENT] = '#',
[URI_QUERY] = '?',
[URI_FRAGMENT] = '#',
};
char prefix;
size_t used = 0;
@ -494,10 +480,6 @@ size_t format_uri ( const struct uri *uri, char *buf, size_t len ) {
if ( ! uri_field ( uri, field ) )
continue;
/* Skip path field if encoded path is present */
if ( ( field == URI_PATH ) && uri->epath )
continue;
/* Prefix this field, if applicable */
prefix = prefixes[field];
if ( ( field == URI_HOST ) && ( uri->user != NULL ) )
@ -694,7 +676,6 @@ char * resolve_path ( const char *base_path,
struct uri * resolve_uri ( const struct uri *base_uri,
struct uri *relative_uri ) {
struct uri tmp_uri;
char *tmp_epath = NULL;
char *tmp_path = NULL;
struct uri *new_uri;
@ -704,27 +685,20 @@ struct uri * resolve_uri ( const struct uri *base_uri,
/* Mangle URI */
memcpy ( &tmp_uri, base_uri, sizeof ( tmp_uri ) );
if ( relative_uri->epath ) {
tmp_epath = resolve_path ( ( base_uri->epath ?
base_uri->epath : "/" ),
relative_uri->epath );
if ( ! tmp_epath )
goto err_epath;
tmp_path = strdup ( tmp_epath );
if ( ! tmp_path )
goto err_path;
uri_decode_inplace ( tmp_path );
tmp_uri.epath = tmp_epath;
if ( relative_uri->path ) {
tmp_path = resolve_path ( ( base_uri->path ?
base_uri->path : "/" ),
relative_uri->path );
tmp_uri.path = tmp_path;
tmp_uri.equery = relative_uri->equery;
tmp_uri.efragment = relative_uri->efragment;
tmp_uri.query = relative_uri->query;
tmp_uri.fragment = relative_uri->fragment;
tmp_uri.params = relative_uri->params;
} else if ( relative_uri->equery ) {
tmp_uri.equery = relative_uri->equery;
tmp_uri.efragment = relative_uri->efragment;
} else if ( relative_uri->query ) {
tmp_uri.query = relative_uri->query;
tmp_uri.fragment = relative_uri->fragment;
tmp_uri.params = relative_uri->params;
} else if ( relative_uri->efragment ) {
tmp_uri.efragment = relative_uri->efragment;
} else if ( relative_uri->fragment ) {
tmp_uri.fragment = relative_uri->fragment;
tmp_uri.params = relative_uri->params;
} else if ( relative_uri->params ) {
tmp_uri.params = relative_uri->params;
@ -733,14 +707,7 @@ struct uri * resolve_uri ( const struct uri *base_uri,
/* Create demangled URI */
new_uri = uri_dup ( &tmp_uri );
free ( tmp_path );
free ( tmp_epath );
return new_uri;
free ( tmp_path );
err_path:
free ( tmp_epath );
err_epath:
return NULL;
}
/**
@ -779,7 +746,6 @@ static struct uri * tftp_uri ( struct sockaddr *sa_server,
if ( asprintf ( &path, "/%s", filename ) < 0 )
goto err_path;
tmp.path = path;
tmp.epath = path;
/* Demangle URI */
uri = uri_dup ( &tmp );

View File

@ -1,137 +0,0 @@
/*
* Copyright (C) 2022 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <assert.h>
#include <ipxe/utf8.h>
/** @file
*
* UTF-8 Unicode encoding
*
*/
/**
* Accumulate Unicode character from UTF-8 byte sequence
*
* @v utf8 UTF-8 accumulator
* @v byte UTF-8 byte
* @ret character Unicode character, or 0 if incomplete
*/
unsigned int utf8_accumulate ( struct utf8_accumulator *utf8, uint8_t byte ) {
static unsigned int min[] = {
UTF8_MIN_TWO,
UTF8_MIN_THREE,
UTF8_MIN_FOUR,
};
unsigned int shift;
unsigned int len;
uint8_t tmp;
/* Handle continuation bytes */
if ( UTF8_IS_CONTINUATION ( byte ) ) {
/* Fail if this is an unexpected continuation byte */
if ( utf8->remaining == 0 ) {
DBGC ( utf8, "UTF8 %p unexpected %02x\n", utf8, byte );
return UTF8_INVALID;
}
/* Apply continuation byte */
utf8->character <<= UTF8_CONTINUATION_BITS;
utf8->character |= ( byte & UTF8_CONTINUATION_MASK );
/* Return 0 if more continuation bytes are expected */
if ( --utf8->remaining != 0 )
return 0;
/* Fail if sequence is illegal */
if ( utf8->character < utf8->min ) {
DBGC ( utf8, "UTF8 %p illegal %02x\n", utf8,
utf8->character );
return UTF8_INVALID;
}
/* Sanity check */
assert ( utf8->character != 0 );
/* Return completed character */
DBGC2 ( utf8, "UTF8 %p accumulated %02x\n",
utf8, utf8->character );
return utf8->character;
}
/* Reset state and report failure if this is an unexpected
* non-continuation byte. Do not return UTF8_INVALID since
* doing so could cause us to drop a valid ASCII character.
*/
if ( utf8->remaining != 0 ) {
shift = ( utf8->remaining * UTF8_CONTINUATION_BITS );
DBGC ( utf8, "UTF8 %p unexpected %02x (partial %02x/%02x)\n",
utf8, byte, ( utf8->character << shift ),
( ( 1 << shift ) - 1 ) );
utf8->remaining = 0;
}
/* Handle initial bytes */
if ( ! UTF8_IS_ASCII ( byte ) ) {
/* Sanity check */
assert ( utf8->remaining == 0 );
/* Count total number of bytes in sequence */
tmp = byte;
len = 0;
while ( tmp & UTF8_HIGH_BIT ) {
tmp <<= 1;
len++;
}
/* Check for illegal length */
if ( len > UTF8_MAX_LEN ) {
DBGC ( utf8, "UTF8 %p illegal %02x length %d\n",
utf8, byte, len );
return UTF8_INVALID;
}
/* Store initial bits of character */
utf8->character = ( tmp >> len );
/* Store number of bytes remaining */
len--;
utf8->remaining = len;
assert ( utf8->remaining > 0 );
/* Store minimum legal value */
utf8->min = min[ len - 1 ];
assert ( utf8->min > 0 );
/* Await continuation bytes */
return 0;
}
/* Handle ASCII bytes */
return byte;
}

View File

@ -32,7 +32,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <wchar.h>
#include <ipxe/features.h>
#include <ipxe/version.h>
#include <ipxe/sbat.h>
#include <config/general.h>
#include <config/branding.h>
@ -93,32 +92,3 @@ const wchar_t build_wname[] = WSTRING ( BUILD_NAME );
/** Copy of build name string within ".prefix" */
const char build_name_prefix[] __attribute__ (( section ( ".prefix.name" ) ))
= BUILD_NAME;
/** SBAT upstream iPXE line
*
* This line represents the security generation of the upstream
* codebase from which this build is derived.
*/
#define SBAT_IPXE \
SBAT_LINE ( "ipxe", IPXE_SBAT_GENERATION, \
"iPXE", BUILD_NAME, VERSION, "https://ipxe.org" )
/** SBAT local build line
*
* This line states the security generation of the local build, which
* may include non-default features or non-upstreamed modifications.
*/
#if PRODUCT_SBAT_GENERATION
#define SBAT_PRODUCT \
SBAT_LINE ( "ipxe." PRODUCT_SBAT_NAME, PRODUCT_SBAT_GENERATION, \
PRODUCT_SHORT_NAME, BUILD_NAME, VERSION, \
PRODUCT_URI )
#else
#define SBAT_PRODUCT ""
#endif
/** SBAT data */
#define SBAT_DATA SBAT_HEADER "" SBAT_IPXE "" SBAT_PRODUCT
/** SBAT data (without any NUL terminator) */
const char sbat[ sizeof ( SBAT_DATA ) - 1 ] __sbat = SBAT_DATA;

View File

@ -121,11 +121,6 @@ static void pci_read_bases ( struct pci_device *pci ) {
unsigned long bar;
int reg;
/* Clear any existing base addresses */
pci->ioaddr = 0;
pci->membase = 0;
/* Get first memory and I/O BAR addresses */
for ( reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4 ) {
bar = pci_bar ( pci, reg );
if ( bar & PCI_BASE_ADDRESS_SPACE_IO ) {

View File

@ -17,47 +17,37 @@
#include "ipxe/io.h"
#include "ipxe/iomap.h"
#include "ipxe/pci.h"
#include "ipxe/dma.h"
#include "ipxe/reboot.h"
#include "ipxe/virtio-pci.h"
#include "ipxe/virtio-ring.h"
static int vp_alloc_vq(struct vring_virtqueue *vq, u16 num, size_t header_size)
static int vp_alloc_vq(struct vring_virtqueue *vq, u16 num)
{
size_t ring_size = PAGE_MASK + vring_size(num);
size_t queue_size = PAGE_MASK + vring_size(num);
size_t vdata_size = num * sizeof(void *);
size_t queue_size = ring_size + vdata_size + header_size;
vq->queue = dma_alloc(vq->dma, &vq->map, queue_size, queue_size);
vq->queue = zalloc(queue_size + vdata_size);
if (!vq->queue) {
return -ENOMEM;
}
memset ( vq->queue, 0, queue_size );
vq->queue_size = queue_size;
/* vdata immediately follows the ring */
vq->vdata = (void **)(vq->queue + ring_size);
/* empty header immediately follows vdata */
vq->empty_header = (struct virtio_net_hdr_modern *)(vq->queue + ring_size + vdata_size);
vq->vdata = (void **)(vq->queue + queue_size);
return 0;
}
void vp_free_vq(struct vring_virtqueue *vq)
{
if (vq->queue && vq->queue_size) {
dma_free(&vq->map, vq->queue, vq->queue_size);
if (vq->queue) {
free(vq->queue);
vq->queue = NULL;
vq->vdata = NULL;
vq->queue_size = 0;
}
}
int vp_find_vq(unsigned int ioaddr, int queue_index,
struct vring_virtqueue *vq, struct dma_device *dma_dev,
size_t header_size)
struct vring_virtqueue *vq)
{
struct vring * vr = &vq->vring;
u16 num;
@ -83,10 +73,9 @@ int vp_find_vq(unsigned int ioaddr, int queue_index,
}
vq->queue_index = queue_index;
vq->dma = dma_dev;
/* initialize the queue */
rc = vp_alloc_vq(vq, num, header_size);
rc = vp_alloc_vq(vq, num);
if (rc) {
DBG("VIRTIO-PCI ERROR: failed to allocate queue memory\n");
return rc;
@ -98,7 +87,8 @@ int vp_find_vq(unsigned int ioaddr, int queue_index,
* NOTE: vr->desc is initialized by vring_init()
*/
outl(dma(&vq->map, vr->desc) >> PAGE_SHIFT, ioaddr + VIRTIO_PCI_QUEUE_PFN);
outl((unsigned long)virt_to_phys(vr->desc) >> PAGE_SHIFT,
ioaddr + VIRTIO_PCI_QUEUE_PFN);
return num;
}
@ -358,8 +348,7 @@ void vpm_notify(struct virtio_pci_modern_device *vdev,
}
int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
unsigned nvqs, struct vring_virtqueue *vqs,
struct dma_device *dma_dev, size_t header_size)
unsigned nvqs, struct vring_virtqueue *vqs)
{
unsigned i;
struct vring_virtqueue *vq;
@ -403,12 +392,11 @@ int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
vq = &vqs[i];
vq->queue_index = i;
vq->dma = dma_dev;
/* get offset of notification word for this vq */
off = vpm_ioread16(vdev, &vdev->common, COMMON_OFFSET(queue_notify_off));
err = vp_alloc_vq(vq, size, header_size);
err = vp_alloc_vq(vq, size);
if (err) {
DBG("VIRTIO-PCI %p: failed to allocate queue memory\n", vdev);
return err;
@ -418,16 +406,13 @@ int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
/* activate the queue */
vpm_iowrite16(vdev, &vdev->common, size, COMMON_OFFSET(queue_size));
vpm_iowrite64(vdev, &vdev->common,
dma(&vq->map, vq->vring.desc),
vpm_iowrite64(vdev, &vdev->common, virt_to_phys(vq->vring.desc),
COMMON_OFFSET(queue_desc_lo),
COMMON_OFFSET(queue_desc_hi));
vpm_iowrite64(vdev, &vdev->common,
dma(&vq->map, vq->vring.avail),
vpm_iowrite64(vdev, &vdev->common, virt_to_phys(vq->vring.avail),
COMMON_OFFSET(queue_avail_lo),
COMMON_OFFSET(queue_avail_hi));
vpm_iowrite64(vdev, &vdev->common,
dma(&vq->map, vq->vring.used),
vpm_iowrite64(vdev, &vdev->common, virt_to_phys(vq->vring.used),
COMMON_OFFSET(queue_used_lo),
COMMON_OFFSET(queue_used_hi));

View File

@ -98,7 +98,7 @@ void vring_add_buf(struct vring_virtqueue *vq,
for (i = head; out; i = vr->desc[i].next, out--) {
vr->desc[i].flags = VRING_DESC_F_NEXT;
vr->desc[i].addr = list->addr;
vr->desc[i].addr = (u64)virt_to_phys(list->addr);
vr->desc[i].len = list->length;
prev = i;
list++;
@ -106,7 +106,7 @@ void vring_add_buf(struct vring_virtqueue *vq,
for ( ; in; i = vr->desc[i].next, in--) {
vr->desc[i].flags = VRING_DESC_F_NEXT|VRING_DESC_F_WRITE;
vr->desc[i].addr = list->addr;
vr->desc[i].addr = (u64)virt_to_phys(list->addr);
vr->desc[i].len = list->length;
prev = i;
list++;

View File

@ -30,7 +30,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/if_ether.h>
#include <ipxe/base16.h>
#include <ipxe/profile.h>
#include <ipxe/acpimac.h>
#include <ipxe/usb.h>
#include "ecm.h"
@ -82,17 +81,14 @@ ecm_ethernet_descriptor ( struct usb_configuration_descriptor *config,
/**
* Get hardware MAC address
*
* @v func USB function
* @v usb USB device
* @v desc Ethernet functional descriptor
* @v netdev Network device
* @v hw_addr Hardware address to fill in
* @ret rc Return status code
*/
int ecm_fetch_mac ( struct usb_function *func,
struct ecm_ethernet_descriptor *desc,
struct net_device *netdev ) {
struct usb_device *usb = func->usb;
int ecm_fetch_mac ( struct usb_device *usb,
struct ecm_ethernet_descriptor *desc, uint8_t *hw_addr ) {
char buf[ base16_encoded_len ( ETH_ALEN ) + 1 /* NUL */ ];
uint8_t amac[ETH_ALEN];
int len;
int rc;
@ -107,29 +103,19 @@ int ecm_fetch_mac ( struct usb_function *func,
/* Sanity check */
if ( len != ( ( int ) ( sizeof ( buf ) - 1 /* NUL */ ) ) ) {
DBGC ( usb, "USB %s has invalid ECM MAC \"%s\"\n",
func->name, buf );
usb->name, buf );
return -EINVAL;
}
/* Decode MAC address */
len = base16_decode ( buf, netdev->hw_addr, ETH_ALEN );
len = base16_decode ( buf, hw_addr, ETH_ALEN );
if ( len < 0 ) {
rc = len;
DBGC ( usb, "USB %s could not decode ECM MAC \"%s\": %s\n",
func->name, buf, strerror ( rc ) );
usb->name, buf, strerror ( rc ) );
return rc;
}
/* Apply system-specific MAC address as current link-layer
* address, if present and not already used.
*/
if ( ( ( rc = acpi_mac ( amac ) ) == 0 ) &&
! find_netdev_by_ll_addr ( &ethernet_protocol, amac ) ) {
memcpy ( netdev->ll_addr, amac, ETH_ALEN );
DBGC ( usb, "USB %s using system-specific MAC %s\n",
func->name, eth_ntoa ( netdev->ll_addr ) );
}
return 0;
}
@ -478,7 +464,7 @@ static int ecm_probe ( struct usb_function *func,
}
/* Fetch MAC address */
if ( ( rc = ecm_fetch_mac ( func, ethernet, netdev ) ) != 0 ) {
if ( ( rc = ecm_fetch_mac ( usb, ethernet, netdev->hw_addr ) ) != 0 ) {
DBGC ( ecm, "ECM %p could not fetch MAC address: %s\n",
ecm, strerror ( rc ) );
goto err_fetch_mac;

View File

@ -86,8 +86,8 @@ struct ecm_device {
extern struct ecm_ethernet_descriptor *
ecm_ethernet_descriptor ( struct usb_configuration_descriptor *config,
struct usb_interface_descriptor *interface );
extern int ecm_fetch_mac ( struct usb_function *func,
extern int ecm_fetch_mac ( struct usb_device *usb,
struct ecm_ethernet_descriptor *desc,
struct net_device *netdev );
uint8_t *hw_addr );
#endif /* _ECM_H */

View File

@ -576,7 +576,7 @@ static int nii_issue_cpb_db ( struct nii_nic *nii, unsigned int op, void *cpb,
cdb.IFnum = nii->nii->IfNum;
/* Raise task priority level */
tpl = bs->RaiseTPL ( efi_internal_tpl );
tpl = bs->RaiseTPL ( TPL_CALLBACK );
/* Issue command */
DBGC2 ( nii, "NII %s issuing %02x:%04x ifnum %d%s%s\n",

View File

@ -164,10 +164,6 @@ static int snpnet_transmit ( struct net_device *netdev,
EFI_STATUS efirc;
int rc;
/* Do nothing if shutdown is in progress */
if ( efi_shutdown_in_progress )
return -ECANCELED;
/* Defer the packet if there is already a transmission in progress */
if ( snp->txbuf ) {
netdev_tx_defer ( netdev, iobuf );
@ -287,10 +283,6 @@ static void snpnet_poll_rx ( struct net_device *netdev ) {
*/
static void snpnet_poll ( struct net_device *netdev ) {
/* Do nothing if shutdown is in progress */
if ( efi_shutdown_in_progress )
return;
/* Process any TX completions */
snpnet_poll_tx ( netdev );
@ -434,9 +426,8 @@ static void snpnet_close ( struct net_device *netdev ) {
EFI_STATUS efirc;
int rc;
/* Shut down NIC (unless whole system shutdown is in progress) */
if ( ( ! efi_shutdown_in_progress ) &&
( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) ) {
/* Shut down NIC */
if ( ( efirc = snp->snp->Shutdown ( snp->snp ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( snp, "SNP %s could not shut down: %s\n",
netdev->name, strerror ( rc ) );
@ -598,9 +589,8 @@ void snpnet_stop ( struct efi_device *efidev ) {
/* Unregister network device */
unregister_netdev ( netdev );
/* Stop SNP protocol (unless whole system shutdown is in progress) */
if ( ( ! efi_shutdown_in_progress ) &&
( ( efirc = snp->snp->Stop ( snp->snp ) ) != 0 ) ) {
/* Stop SNP protocol */
if ( ( efirc = snp->snp->Stop ( snp->snp ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "SNP %s could not stop: %s\n",
efi_handle_name ( device ), strerror ( rc ) );

View File

@ -481,7 +481,6 @@ static struct pci_device_id intelx_nics[] = {
PCI_ROM ( 0x8086, 0x15ab, "x552", "X552", 0 ),
PCI_ROM ( 0x8086, 0x15c8, "x553t", "X553/X557-AT", 0 ),
PCI_ROM ( 0x8086, 0x15ce, "x553-sfp", "X553 (SFP+)", 0 ),
PCI_ROM ( 0x8086, 0x15e4, "x553a", "X553", 0 ),
PCI_ROM ( 0x8086, 0x15e5, "x553", "X553", 0 ),
};

View File

@ -598,7 +598,7 @@ static int ncm_probe ( struct usb_function *func,
}
/* Fetch MAC address */
if ( ( rc = ecm_fetch_mac ( func, ethernet, netdev ) ) != 0 ) {
if ( ( rc = ecm_fetch_mac ( usb, ethernet, netdev->hw_addr ) ) != 0 ) {
DBGC ( ncm, "NCM %p could not fetch MAC address: %s\n",
ncm, strerror ( rc ) );
goto err_fetch_mac;

View File

@ -29,7 +29,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/pci.h>
#include <ipxe/dma.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/virtio-pci.h>
@ -100,9 +99,8 @@ struct virtnet_nic {
/** Pending rx packet count */
unsigned int rx_num_iobufs;
/** DMA device */
struct dma_device *dma;
/** Virtio net dummy packet headers */
struct virtio_net_hdr_modern empty_header[QUEUE_NB];
};
/** Add an iobuf to a virtqueue
@ -117,7 +115,7 @@ static void virtnet_enqueue_iob ( struct net_device *netdev,
int vq_idx, struct io_buffer *iobuf ) {
struct virtnet_nic *virtnet = netdev->priv;
struct vring_virtqueue *vq = &virtnet->virtqueue[vq_idx];
struct virtio_net_hdr_modern *header = vq->empty_header;
struct virtio_net_hdr_modern *header = &virtnet->empty_header[vq_idx];
unsigned int out = ( vq_idx == TX_INDEX ) ? 2 : 0;
unsigned int in = ( vq_idx == TX_INDEX ) ? 0 : 2;
size_t header_len = ( virtnet->virtio_version ?
@ -134,11 +132,11 @@ static void virtnet_enqueue_iob ( struct net_device *netdev,
* to header->flags for received packets. Work around
* this by using separate RX and TX headers.
*/
.addr = dma ( &vq->map, header ),
.addr = ( char* ) header,
.length = header_len,
},
{
.addr = iob_dma ( iobuf ),
.addr = ( char* ) iobuf->data,
.length = iob_len ( iobuf ),
},
};
@ -163,7 +161,7 @@ static void virtnet_refill_rx_virtqueue ( struct net_device *netdev ) {
struct io_buffer *iobuf;
/* Try to allocate a buffer, stop for now if out of memory */
iobuf = alloc_rx_iob ( len, virtnet->dma );
iobuf = alloc_iob ( len );
if ( ! iobuf )
break;
@ -217,8 +215,7 @@ static int virtnet_open_legacy ( struct net_device *netdev ) {
/* Initialize rx/tx virtqueues */
for ( i = 0; i < QUEUE_NB; i++ ) {
if ( vp_find_vq ( ioaddr, i, &virtnet->virtqueue[i], virtnet->dma,
sizeof ( struct virtio_net_hdr_modern ) ) == -1 ) {
if ( vp_find_vq ( ioaddr, i, &virtnet->virtqueue[i] ) == -1 ) {
DBGC ( virtnet, "VIRTIO-NET %p cannot register queue %d\n",
virtnet, i );
virtnet_free_virtqueues ( netdev );
@ -283,8 +280,7 @@ static int virtnet_open_modern ( struct net_device *netdev ) {
}
/* Initialize rx/tx virtqueues */
if ( vpm_find_vqs ( &virtnet->vdev, QUEUE_NB, virtnet->virtqueue,
virtnet->dma, sizeof ( struct virtio_net_hdr_modern ) ) ) {
if ( vpm_find_vqs ( &virtnet->vdev, QUEUE_NB, virtnet->virtqueue ) ) {
DBGC ( virtnet, "VIRTIO-NET %p cannot register queues\n",
virtnet );
virtnet_free_virtqueues ( netdev );
@ -339,7 +335,7 @@ static void virtnet_close ( struct net_device *netdev ) {
/* Free rx iobufs */
list_for_each_entry_safe ( iobuf, next_iobuf, &virtnet->rx_iobufs, list ) {
free_rx_iob ( iobuf );
free_iob ( iobuf );
}
INIT_LIST_HEAD ( &virtnet->rx_iobufs );
virtnet->rx_num_iobufs = 0;
@ -482,12 +478,6 @@ static int virtnet_probe_legacy ( struct pci_device *pci ) {
/* Enable PCI bus master and reset NIC */
adjust_pci_device ( pci );
/* Configure DMA */
virtnet->dma = &pci->dma;
dma_set_mask_64bit ( virtnet->dma );
netdev->dma = virtnet->dma;
vp_reset ( ioaddr );
/* Load MAC address and MTU */
@ -516,7 +506,7 @@ static int virtnet_probe_legacy ( struct pci_device *pci ) {
return 0;
unregister_netdev ( netdev );
err_register_netdev:
err_register_netdev:
vp_reset ( ioaddr );
netdev_nullify ( netdev );
netdev_put ( netdev );
@ -596,11 +586,6 @@ static int virtnet_probe_modern ( struct pci_device *pci, int *found_dev ) {
/* Enable the PCI device */
adjust_pci_device ( pci );
/* Configure DMA */
virtnet->dma = &pci->dma;
dma_set_mask_64bit ( virtnet->dma );
netdev->dma = virtnet->dma;
/* Reset the device and set initial status bits */
vpm_reset ( &virtnet->vdev );
vpm_add_status ( &virtnet->vdev, VIRTIO_CONFIG_S_ACKNOWLEDGE );
@ -648,6 +633,7 @@ err_mac_address:
vpm_reset ( &virtnet->vdev );
netdev_nullify ( netdev );
netdev_put ( netdev );
virtio_pci_unmap_capability ( &virtnet->vdev.device );
err_map_device:
virtio_pci_unmap_capability ( &virtnet->vdev.isr );

View File

@ -25,12 +25,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/console.h>
#include <ipxe/keys.h>
#include <ipxe/keymap.h>
#include <ipxe/usb.h>
#include "usbkbd.h"
@ -71,7 +69,10 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers,
} else if ( keycode <= USBKBD_KEY_Z ) {
/* Alphabetic keys */
key = ( keycode - USBKBD_KEY_A + 'a' );
if ( modifiers & USBKBD_SHIFT ) {
if ( modifiers & USBKBD_CTRL ) {
key -= ( 'a' - CTRL_A );
} else if ( ( modifiers & USBKBD_SHIFT ) ||
( leds & USBKBD_LED_CAPS_LOCK ) ) {
key -= ( 'a' - 'A' );
}
} else if ( keycode <= USBKBD_KEY_0 ) {
@ -117,30 +118,10 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers,
};
key = keypad[ keycode - USBKBD_KEY_PAD_1 ];
};
} else if ( keycode == USBKBD_KEY_NON_US ) {
/* Non-US \ and | */
key = ( ( modifiers & USBKBD_SHIFT ) ?
( KEYMAP_PSEUDO | '|' ) : ( KEYMAP_PSEUDO | '\\' ) );
} else {
key = 0;
}
/* Remap key if applicable */
if ( ( keycode < USBKBD_KEY_CAPS_LOCK ) ||
( keycode == USBKBD_KEY_NON_US ) ) {
/* Apply modifiers */
if ( modifiers & USBKBD_CTRL )
key |= KEYMAP_CTRL;
if ( modifiers & USBKBD_ALT_RIGHT )
key |= KEYMAP_ALTGR;
if ( leds & USBKBD_LED_CAPS_LOCK )
key |= KEYMAP_CAPSLOCK;
/* Remap key */
key = key_remap ( key );
}
return key;
}

View File

@ -75,7 +75,6 @@ enum usb_keycode {
USBKBD_KEY_PAD_ENTER = 0x58,
USBKBD_KEY_PAD_1 = 0x59,
USBKBD_KEY_PAD_DOT = 0x63,
USBKBD_KEY_NON_US = 0x64,
};
/** USB keyboard LEDs */

View File

@ -1165,31 +1165,6 @@ static int xhci_reset ( struct xhci_device *xhci ) {
return -ETIMEDOUT;
}
/**
* Mark xHCI device as permanently failed
*
* @v xhci xHCI device
* @ret rc Return status code
*/
static int xhci_fail ( struct xhci_device *xhci ) {
size_t len;
int rc;
/* Mark command mechanism as permanently failed */
xhci->failed = 1;
/* Reset device */
if ( ( rc = xhci_reset ( xhci ) ) != 0 )
return rc;
/* Discard DCBAA entries since DCBAAP has been cleared */
assert ( xhci->dcbaa.context != NULL );
len = ( ( xhci->slots + 1 ) * sizeof ( xhci->dcbaa.context[0] ) );
memset ( xhci->dcbaa.context, 0, len );
return 0;
}
/******************************************************************************
*
* Transfer request blocks
@ -1745,10 +1720,6 @@ static void xhci_event_poll ( struct xhci_device *xhci ) {
unsigned int consumed;
unsigned int type;
/* Do nothing if device has permanently failed */
if ( xhci->failed )
return;
/* Poll for events */
profile_start ( &xhci_event_profiler );
for ( consumed = 0 ; ; consumed++ ) {
@ -1807,7 +1778,6 @@ static void xhci_event_poll ( struct xhci_device *xhci ) {
*/
static void xhci_abort ( struct xhci_device *xhci ) {
physaddr_t crp;
uint32_t crcr;
/* Abort the command */
DBGC2 ( xhci, "XHCI %s aborting command\n", xhci->name );
@ -1816,18 +1786,8 @@ static void xhci_abort ( struct xhci_device *xhci ) {
/* Allow time for command to abort */
mdelay ( XHCI_COMMAND_ABORT_DELAY_MS );
/* Check for failure to abort */
crcr = readl ( xhci->op + XHCI_OP_CRCR );
if ( crcr & XHCI_CRCR_CRR ) {
/* Device has failed to abort a command and is almost
* certainly beyond repair. Reset device, abandoning
* all state, and mark device as failed to avoid
* delays on any future command attempts.
*/
DBGC ( xhci, "XHCI %s failed to abort command\n", xhci->name );
xhci_fail ( xhci );
}
/* Sanity check */
assert ( ( readl ( xhci->op + XHCI_OP_CRCR ) & XHCI_CRCR_CRR ) == 0 );
/* Consume (and ignore) any final command status */
xhci_event_poll ( xhci );
@ -1853,12 +1813,6 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
unsigned int i;
int rc;
/* Immediately fail all commands if command mechanism has failed */
if ( xhci->failed ) {
rc = -EPIPE;
goto err_failed;
}
/* Sanity check */
if ( xhci->pending ) {
DBGC ( xhci, "XHCI %s command ring busy\n", xhci->name );
@ -1909,7 +1863,6 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
err_enqueue:
xhci->pending = NULL;
err_pending:
err_failed:
return rc;
}
@ -3459,36 +3412,14 @@ static int xhci_probe ( struct pci_device *pci ) {
static void xhci_remove ( struct pci_device *pci ) {
struct xhci_device *xhci = pci_get_drvdata ( pci );
struct usb_bus *bus = xhci->bus;
uint16_t command;
/* Some systems are observed to disable bus mastering on
* Thunderbolt controllers before we get a chance to shut
* down. Detect this and avoid attempting any DMA operations,
* which are guaranteed to fail and may end up spuriously
* completing after the operating system kernel starts up.
*/
pci_read_config_word ( pci, PCI_COMMAND, &command );
if ( ! ( command & PCI_COMMAND_MASTER ) ) {
DBGC ( xhci, "XHCI %s DMA was disabled\n", xhci->name );
xhci_fail ( xhci );
}
/* Unregister and free USB bus */
unregister_usb_bus ( bus );
free_usb_bus ( bus );
/* Reset device and undo any PCH-specific fixes */
xhci_reset ( xhci );
if ( xhci->quirks & XHCI_PCH )
xhci_pch_undo ( xhci, pci );
/* Release ownership back to BIOS */
xhci_legacy_release ( xhci );
/* Unmap registers */
iounmap ( xhci->regs );
/* Free device */
free ( xhci );
}

View File

@ -1115,8 +1115,6 @@ struct xhci_device {
struct xhci_event_ring event;
/** Current command (if any) */
union xhci_trb *pending;
/** Command mechanism has permanently failed */
int failed;
/** Device slots, indexed by slot ID */
struct xhci_slot **slot;

View File

@ -10,11 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "al" basic remapping */
static struct keymap_key al_basic[] = {
/** "al" keyboard mapping */
struct key_mapping al_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x5b }, /* '\'' => '[' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@ -30,29 +29,4 @@ static struct keymap_key al_basic[] = {
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x27 }, /* '}' => '\'' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "al" AltGr remapping */
static struct keymap_key al_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x56, 0x60 }, /* 'V' => '`' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "al" keyboard map */
struct keymap al_keymap __keymap = {
.name = "al",
.basic = al_basic,
.altgr = al_altgr,
};

View File

@ -0,0 +1,24 @@
/** @file
*
* "az" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "az" keyboard mapping */
struct key_mapping az_mapping[] __keymap = {
{ 0x23, 0x27 }, /* '#' => '\'' */
{ 0x24, 0x3b }, /* '$' => ';' */
{ 0x26, 0x3f }, /* '&' => '?' */
{ 0x2f, 0x2e }, /* '/' => '.' */
{ 0x3a, 0x49 }, /* ':' => 'I' */
{ 0x3f, 0x2c }, /* '?' => ',' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5e, 0x3a }, /* '^' => ':' */
{ 0x7c, 0x2f }, /* '|' => '/' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "bg" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "bg" keyboard mapping */
struct key_mapping bg_mapping[] __keymap = {
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "by" basic remapping */
static struct keymap_key by_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "by" AltGr remapping */
static struct keymap_key by_altgr[] = {
{ 0, 0 }
};
/** "by" keyboard map */
struct keymap by_keymap __keymap = {
.name = "by",
.basic = by_basic,
.altgr = by_altgr,
/** "by" keyboard mapping */
struct key_mapping by_mapping[] __keymap = {
};

View File

@ -10,43 +10,15 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cf" basic remapping */
static struct keymap_key cf_basic[] = {
{ 0x22, 0x60 }, /* '"' => '`' */
/** "cf" keyboard mapping */
struct key_mapping cf_mapping[] __keymap = {
{ 0x23, 0x2f }, /* '#' => '/' */
{ 0x27, 0x60 }, /* '\'' => '`' */
{ 0x3c, 0x27 }, /* '<' => '\'' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x5e }, /* '[' => '^' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5e, 0x3f }, /* '^' => '?' */
{ 0x60, 0x23 }, /* '`' => '#' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0, 0 }
};
/** "cf" AltGr remapping */
static struct keymap_key cf_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0, 0 }
};
/** "cf" keyboard map */
struct keymap cf_keymap __keymap = {
.name = "cf",
.basic = cf_basic,
.altgr = cf_altgr,
};

View File

@ -10,87 +10,18 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cz" basic remapping */
static struct keymap_key cz_basic[] = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1f, 0x1c }, /* 0x1f => 0x1c */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x22, 0x21 }, /* '"' => '!' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
{ 0x2b, 0x5e }, /* '+' => '^' */
/** "cz" keyboard mapping */
struct key_mapping cz_mapping[] __keymap = {
{ 0x21, 0x2b }, /* '!' => '+' */
{ 0x2d, 0x3d }, /* '-' => '=' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x31, 0x2b }, /* '1' => '+' */
{ 0x3a, 0x22 }, /* ':' => '"' */
{ 0x3c, 0x3f }, /* '<' => '?' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x3c, 0x2c }, /* '<' => ',' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x3f, 0x2d }, /* '?' => '-' */
{ 0x5d, 0x29 }, /* ']' => ')' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x5f, 0x25 }, /* '_' => '%' */
{ 0x5f, 0x3d }, /* '_' => '=' */
{ 0x60, 0x3b }, /* '`' => ';' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7b, 0x2f }, /* '{' => '/' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x28 }, /* '}' => '(' */
{ 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};
/** "cz" AltGr remapping */
static struct keymap_key cz_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x28, 0x7b }, /* '(' => '{' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3c }, /* ',' => '<' */
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x26 }, /* '7' => '&' */
{ 0x38, 0x2a }, /* '8' => '*' */
{ 0x39, 0x7b }, /* '9' => '{' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x41, 0x7e }, /* 'A' => '~' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x61, 0x7e }, /* 'a' => '~' */
{ 0x62, 0x7b }, /* 'b' => '{' */
{ 0x63, 0x26 }, /* 'c' => '&' */
{ 0x66, 0x5b }, /* 'f' => '[' */
{ 0x67, 0x5d }, /* 'g' => ']' */
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x78, 0x23 }, /* 'x' => '#' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0, 0 }
};
/** "cz" keyboard map */
struct keymap cz_keymap __keymap = {
.name = "cz",
.basic = cz_basic,
.altgr = cz_altgr,
{ 0x7d, 0x29 }, /* '}' => ')' */
{ 0x7e, 0x3b }, /* '~' => ';' */
};

View File

@ -10,25 +10,29 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "de" basic remapping */
static struct keymap_key de_basic[] = {
/** "de" keyboard mapping */
struct key_mapping de_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1c, 0x23 }, /* 0x1c => '#' */
{ 0x1d, 0x1e }, /* 0x1d => 0x1e */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x22, 0x7d }, /* '"' => '}' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x5d }, /* '\'' => ']' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3a, 0x7b }, /* ':' => '{' */
{ 0x3b, 0x5b }, /* ';' => '[' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5b, 0x40 }, /* '[' => '@' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
@ -36,39 +40,7 @@ static struct keymap_key de_basic[] = {
{ 0x60, 0x5e }, /* '`' => '^' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7b, 0x5c }, /* '{' => '\\' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "de" AltGr remapping */
static struct keymap_key de_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "de" keyboard map */
struct keymap de_keymap __keymap = {
.name = "de",
.basic = de_basic,
.altgr = de_altgr,
};

View File

@ -10,10 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "dk" basic remapping */
static struct keymap_key dk_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "dk" keyboard mapping */
struct key_mapping dk_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -30,38 +28,4 @@ static struct keymap_key dk_basic[] = {
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "dk" AltGr remapping */
static struct keymap_key dk_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7c }, /* '+' => '|' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3d, 0x7c }, /* '=' => '|' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};
/** "dk" keyboard map */
struct keymap dk_keymap __keymap = {
.name = "dk",
.basic = dk_basic,
.altgr = dk_altgr,
};

View File

@ -10,10 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "es" basic remapping */
static struct keymap_key es_basic[] = {
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "es" keyboard mapping */
struct key_mapping es_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -24,54 +22,8 @@ static struct keymap_key es_basic[] = {
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x60 }, /* '[' => '`' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "es" AltGr remapping */
static struct keymap_key es_altgr[] = {
{ 0x21, 0x7c }, /* '!' => '|' */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x31, 0x7c }, /* '1' => '|' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "es" keyboard map */
struct keymap es_keymap __keymap = {
.name = "es",
.basic = es_basic,
.altgr = es_altgr,
};

View File

@ -10,13 +10,12 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "et" basic remapping */
static struct keymap_key et_basic[] = {
/** "et" keyboard mapping */
struct key_mapping et_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@ -26,34 +25,6 @@ static struct keymap_key et_basic[] = {
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5e }, /* '`' => '^' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "et" AltGr remapping */
static struct keymap_key et_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "et" keyboard map */
struct keymap et_keymap __keymap = {
.name = "et",
.basic = et_basic,
.altgr = et_altgr,
{ 0x7f, 0x1b }, /* 0x7f => 0x1b */
};

View File

@ -10,51 +10,29 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fi" basic remapping */
static struct keymap_key fi_basic[] = {
/** "fi" keyboard mapping */
struct key_mapping fi_mapping[] __keymap = {
{ 0x22, 0x5b }, /* '"' => '[' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3a, 0x5c }, /* ':' => '\\' */
{ 0x3b, 0x7c }, /* ';' => '|' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x7d }, /* '[' => '}' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7b, 0x5d }, /* '{' => ']' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "fi" AltGr remapping */
static struct keymap_key fi_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x49, 0x7c }, /* 'I' => '|' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "fi" keyboard map */
struct keymap fi_keymap __keymap = {
.name = "fi",
.basic = fi_basic,
.altgr = fi_altgr,
};

View File

@ -10,22 +10,19 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fr" basic remapping */
static struct keymap_key fr_basic[] = {
/** "fr" keyboard mapping */
struct key_mapping fr_mapping[] __keymap = {
{ 0x01, 0x11 }, /* Ctrl-A => Ctrl-Q */
{ 0x11, 0x01 }, /* Ctrl-Q => Ctrl-A */
{ 0x17, 0x1a }, /* Ctrl-W => Ctrl-Z */
{ 0x1a, 0x17 }, /* Ctrl-Z => Ctrl-W */
{ 0x1c, 0x2a }, /* 0x1c => '*' */
{ 0x1d, 0x24 }, /* 0x1d => '$' */
{ 0x1e, 0x1c }, /* 0x1e => 0x1c */
{ 0x1f, 0x1d }, /* 0x1f => 0x1d */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x22, 0x25 }, /* '"' => '%' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x27, 0x7c }, /* '\'' => '|' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
@ -33,16 +30,21 @@ static struct keymap_key fr_basic[] = {
{ 0x2d, 0x29 }, /* '-' => ')' */
{ 0x2e, 0x3a }, /* '.' => ':' */
{ 0x2f, 0x21 }, /* '/' => '!' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x31, 0x26 }, /* '1' => '&' */
{ 0x32, 0x7b }, /* '2' => '{' */
{ 0x33, 0x22 }, /* '3' => '"' */
{ 0x34, 0x27 }, /* '4' => '\'' */
{ 0x35, 0x28 }, /* '5' => '(' */
{ 0x36, 0x2d }, /* '6' => '-' */
{ 0x37, 0x7d }, /* '7' => '}' */
{ 0x38, 0x5f }, /* '8' => '_' */
{ 0x39, 0x2f }, /* '9' => '/' */
{ 0x3a, 0x4d }, /* ':' => 'M' */
{ 0x3b, 0x6d }, /* ';' => 'm' */
{ 0x3c, 0x2e }, /* '<' => '.' */
{ 0x3e, 0x2f }, /* '>' => '/' */
{ 0x3f, 0x5c }, /* '?' => '\\' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x41, 0x51 }, /* 'A' => 'Q' */
{ 0x4d, 0x3f }, /* 'M' => '?' */
@ -53,44 +55,14 @@ static struct keymap_key fr_basic[] = {
{ 0x5c, 0x2a }, /* '\\' => '*' */
{ 0x5d, 0x24 }, /* ']' => '$' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x5f, 0x5d }, /* '_' => ']' */
{ 0x60, 0x2a }, /* '`' => '*' */
{ 0x61, 0x71 }, /* 'a' => 'q' */
{ 0x6d, 0x2c }, /* 'm' => ',' */
{ 0x71, 0x61 }, /* 'q' => 'a' */
{ 0x77, 0x7a }, /* 'w' => 'z' */
{ 0x7a, 0x77 }, /* 'z' => 'w' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "fr" AltGr remapping */
static struct keymap_key fr_altgr[] = {
{ 0x25, 0x5b }, /* '%' => '[' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x40 }, /* ')' => '@' */
{ 0x2a, 0x5c }, /* '*' => '\\' */
{ 0x2b, 0x7d }, /* '+' => '}' */
{ 0x2d, 0x5d }, /* '-' => ']' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x7b }, /* '4' => '{' */
{ 0x35, 0x5b }, /* '5' => '[' */
{ 0x36, 0x7c }, /* '6' => '|' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x38, 0x5c }, /* '8' => '\\' */
{ 0x3d, 0x7d }, /* '=' => '}' */
{ 0x41, 0x40 }, /* 'A' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5e, 0x7c }, /* '^' => '|' */
{ 0x5f, 0x5d }, /* '_' => ']' */
{ 0x61, 0x40 }, /* 'a' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "fr" keyboard map */
struct keymap fr_keymap __keymap = {
.name = "fr",
.basic = fr_basic,
.altgr = fr_altgr,
{ 0x7b, 0x3c }, /* '{' => '<' */
{ 0x7c, 0x23 }, /* '|' => '#' */
{ 0x7d, 0x3e }, /* '}' => '>' */
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "gr" basic remapping */
static struct keymap_key gr_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "gr" AltGr remapping */
static struct keymap_key gr_altgr[] = {
{ 0, 0 }
};
/** "gr" keyboard map */
struct keymap gr_keymap __keymap = {
.name = "gr",
.basic = gr_basic,
.altgr = gr_altgr,
/** "gr" keyboard mapping */
struct key_mapping gr_mapping[] __keymap = {
};

View File

@ -10,11 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "hu" basic remapping */
static struct keymap_key hu_basic[] = {
/** "hu" keyboard mapping */
struct key_mapping hu_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x21, 0x27 }, /* '!' => '\'' */
{ 0x23, 0x2b }, /* '#' => '+' */
{ 0x24, 0x21 }, /* '$' => '!' */
@ -32,60 +31,4 @@ static struct keymap_key hu_basic[] = {
{ 0x60, 0x30 }, /* '`' => '0' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0, 0 }
};
/** "hu" AltGr remapping */
static struct keymap_key hu_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x23, 0x5e }, /* '#' => '^' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
{ 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
{ 0x32, 0x5e }, /* '2' => '^' */
{ 0x33, 0x5e }, /* '3' => '^' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3a, 0x24 }, /* ':' => '$' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x40, 0x5e }, /* '@' => '^' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x4d, 0x3c }, /* 'M' => '<' */
{ 0x51, 0x5c }, /* 'Q' => '\\' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x57, 0x7c }, /* 'W' => '|' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x62, 0x7b }, /* 'b' => '{' */
{ 0x63, 0x26 }, /* 'c' => '&' */
{ 0x66, 0x5b }, /* 'f' => '[' */
{ 0x67, 0x5d }, /* 'g' => ']' */
{ 0x6d, 0x3c }, /* 'm' => '<' */
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x71, 0x5c }, /* 'q' => '\\' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x77, 0x7c }, /* 'w' => '|' */
{ 0x78, 0x23 }, /* 'x' => '#' */
{ 0x7a, 0x3e }, /* 'z' => '>' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "hu" keyboard map */
struct keymap hu_keymap __keymap = {
.name = "hu",
.basic = hu_basic,
.altgr = hu_altgr,
};

View File

@ -10,39 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "il" basic remapping */
static struct keymap_key il_basic[] = {
{ 0x1d, 0x1b }, /* 0x1d => 0x1b */
{ 0x27, 0x2c }, /* '\'' => ',' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x28 }, /* ')' => '(' */
{ 0x2f, 0x2e }, /* '/' => '.' */
{ 0x3c, 0x3e }, /* '<' => '>' */
{ 0x3e, 0x3c }, /* '>' => '<' */
{ 0x5b, 0x5d }, /* '[' => ']' */
{ 0x5d, 0x5b }, /* ']' => '[' */
{ 0x60, 0x3b }, /* '`' => ';' */
{ 0x7b, 0x7d }, /* '{' => '}' */
{ 0x7d, 0x7b }, /* '}' => '{' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "il" AltGr remapping */
static struct keymap_key il_altgr[] = {
{ 0x22, 0x27 }, /* '"' => '\'' */
{ 0x3f, 0x2f }, /* '?' => '/' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x71, 0x2f }, /* 'q' => '/' */
{ 0x77, 0x27 }, /* 'w' => '\'' */
{ 0x7c, 0x60 }, /* '|' => '`' */
{ 0, 0 }
};
/** "il" keyboard map */
struct keymap il_keymap __keymap = {
.name = "il",
.basic = il_basic,
.altgr = il_altgr,
/** "il" keyboard mapping */
struct key_mapping il_mapping[] __keymap = {
};

View File

@ -10,9 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "it" basic remapping */
static struct keymap_key it_basic[] = {
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "it" keyboard mapping */
struct key_mapping it_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -30,40 +29,4 @@ static struct keymap_key it_basic[] = {
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "it" AltGr remapping */
static struct keymap_key it_altgr[] = {
{ 0x22, 0x23 }, /* '"' => '#' */
{ 0x23, 0x7e }, /* '#' => '~' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x23 }, /* '\'' => '#' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x60 }, /* '-' => '`' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x40 }, /* ':' => '@' */
{ 0x3b, 0x40 }, /* ';' => '@' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x40, 0x7e }, /* '@' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5f, 0x60 }, /* '_' => '`' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "it" keyboard map */
struct keymap it_keymap __keymap = {
.name = "it",
.basic = it_basic,
.altgr = it_altgr,
};

View File

@ -10,24 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "lt" basic remapping */
static struct keymap_key lt_basic[] = {
{ 0, 0 }
};
/** "lt" AltGr remapping */
static struct keymap_key lt_altgr[] = {
{ 0x22, 0x5e }, /* '"' => '^' */
{ 0x27, 0x5e }, /* '\'' => '^' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};
/** "lt" keyboard map */
struct keymap lt_keymap __keymap = {
.name = "lt",
.basic = lt_basic,
.altgr = lt_altgr,
/** "lt" keyboard mapping */
struct key_mapping lt_mapping[] __keymap = {
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mk" basic remapping */
static struct keymap_key mk_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "mk" AltGr remapping */
static struct keymap_key mk_altgr[] = {
{ 0, 0 }
};
/** "mk" keyboard map */
struct keymap mk_keymap __keymap = {
.name = "mk",
.basic = mk_basic,
.altgr = mk_altgr,
/** "mk" keyboard mapping */
struct key_mapping mk_mapping[] __keymap = {
};

View File

@ -10,34 +10,11 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mt" basic remapping */
static struct keymap_key mt_basic[] = {
{ 0x1c, 0x1e }, /* 0x1c => 0x1e */
/** "mt" keyboard mapping */
struct key_mapping mt_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x23, 0x04 }, /* '#' => Ctrl-D */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "mt" AltGr remapping */
static struct keymap_key mt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};
/** "mt" keyboard map */
struct keymap mt_keymap __keymap = {
.name = "mt",
.basic = mt_basic,
.altgr = mt_altgr,
};

View File

@ -10,12 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "nl" basic remapping */
static struct keymap_key nl_basic[] = {
{ 0x1c, 0x3c }, /* 0x1c => '<' */
{ 0x1d, 0x1c }, /* 0x1d => 0x1c */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x22, 0x60 }, /* '"' => '`' */
/** "nl" keyboard mapping */
struct key_mapping nl_mapping[] __keymap = {
{ 0x26, 0x5f }, /* '&' => '_' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x27 }, /* ')' => '\'' */
@ -33,26 +29,6 @@ static struct keymap_key nl_basic[] = {
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x40 }, /* '`' => '@' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x7c }, /* '}' => '|' */
{ 0xdc, 0x5d }, /* Pseudo-'\\' => ']' */
{ 0xfc, 0x5b }, /* Pseudo-'|' => '[' */
{ 0, 0 }
};
/** "nl" AltGr remapping */
static struct keymap_key nl_altgr[] = {
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x38, 0x7b }, /* '8' => '{' */
{ 0x39, 0x7d }, /* '9' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0, 0 }
};
/** "nl" keyboard map */
struct keymap nl_keymap __keymap = {
.name = "nl",
.basic = nl_basic,
.altgr = nl_altgr,
};

View File

@ -10,9 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "no-latin1" basic remapping */
static struct keymap_key no_latin1_basic[] = {
{ 0x1d, 0x1e }, /* 0x1d => 0x1e */
/** "no-latin1" keyboard mapping */
struct key_mapping no_latin1_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -32,32 +31,4 @@ static struct keymap_key no_latin1_basic[] = {
{ 0x60, 0x7c }, /* '`' => '|' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "no-latin1" AltGr remapping */
static struct keymap_key no_latin1_altgr[] = {
{ 0x22, 0x5b }, /* '"' => '[' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5b, 0x7d }, /* '[' => '}' */
{ 0x7b, 0x5d }, /* '{' => ']' */
{ 0, 0 }
};
/** "no-latin1" keyboard map */
struct keymap no_latin1_keymap __keymap = {
.name = "no-latin1",
.basic = no_latin1_basic,
.altgr = no_latin1_altgr,
};

View File

@ -10,57 +10,96 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "no" basic remapping */
static struct keymap_key no_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "no" keyboard mapping */
struct key_mapping no_mapping[] __keymap = {
{ 0x02, 0x18 }, /* Ctrl-B => Ctrl-X */
{ 0x03, 0x0a }, /* Ctrl-C => Ctrl-J */
{ 0x04, 0x05 }, /* Ctrl-D => Ctrl-E */
{ 0x06, 0x15 }, /* Ctrl-F => Ctrl-U */
{ 0x07, 0x09 }, /* Ctrl-G => Ctrl-I */
{ 0x08, 0x04 }, /* Ctrl-H => Ctrl-D */
{ 0x0a, 0x08 }, /* Ctrl-J => Ctrl-H */
{ 0x0b, 0x14 }, /* Ctrl-K => Ctrl-T */
{ 0x0c, 0x0e }, /* Ctrl-L => Ctrl-N */
{ 0x0e, 0x02 }, /* Ctrl-N => Ctrl-B */
{ 0x0f, 0x12 }, /* Ctrl-O => Ctrl-R */
{ 0x10, 0x0c }, /* Ctrl-P => Ctrl-L */
{ 0x12, 0x10 }, /* Ctrl-R => Ctrl-P */
{ 0x13, 0x0f }, /* Ctrl-S => Ctrl-O */
{ 0x14, 0x19 }, /* Ctrl-T => Ctrl-Y */
{ 0x15, 0x07 }, /* Ctrl-U => Ctrl-G */
{ 0x16, 0x0b }, /* Ctrl-V => Ctrl-K */
{ 0x18, 0x11 }, /* Ctrl-X => Ctrl-Q */
{ 0x19, 0x06 }, /* Ctrl-Y => Ctrl-F */
{ 0x22, 0x5f }, /* '"' => '_' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x2d }, /* '\'' => '-' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2c, 0x77 }, /* ',' => 'w' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x2e, 0x76 }, /* '.' => 'v' */
{ 0x2f, 0x7a }, /* '/' => 'z' */
{ 0x3a, 0x53 }, /* ':' => 'S' */
{ 0x3b, 0x73 }, /* ';' => 's' */
{ 0x3c, 0x57 }, /* '<' => 'W' */
{ 0x3d, 0x5c }, /* '=' => '\\' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x3e, 0x56 }, /* '>' => 'V' */
{ 0x3f, 0x5a }, /* '?' => 'Z' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x42, 0x58 }, /* 'B' => 'X' */
{ 0x43, 0x4a }, /* 'C' => 'J' */
{ 0x44, 0x45 }, /* 'D' => 'E' */
{ 0x45, 0x3a }, /* 'E' => ':' */
{ 0x46, 0x55 }, /* 'F' => 'U' */
{ 0x47, 0x49 }, /* 'G' => 'I' */
{ 0x48, 0x44 }, /* 'H' => 'D' */
{ 0x49, 0x43 }, /* 'I' => 'C' */
{ 0x4a, 0x48 }, /* 'J' => 'H' */
{ 0x4b, 0x54 }, /* 'K' => 'T' */
{ 0x4c, 0x4e }, /* 'L' => 'N' */
{ 0x4e, 0x42 }, /* 'N' => 'B' */
{ 0x4f, 0x52 }, /* 'O' => 'R' */
{ 0x50, 0x4c }, /* 'P' => 'L' */
{ 0x52, 0x50 }, /* 'R' => 'P' */
{ 0x53, 0x4f }, /* 'S' => 'O' */
{ 0x54, 0x59 }, /* 'T' => 'Y' */
{ 0x55, 0x47 }, /* 'U' => 'G' */
{ 0x56, 0x4b }, /* 'V' => 'K' */
{ 0x57, 0x3b }, /* 'W' => ';' */
{ 0x58, 0x51 }, /* 'X' => 'Q' */
{ 0x59, 0x46 }, /* 'Y' => 'F' */
{ 0x5b, 0x27 }, /* '[' => '\'' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x7c }, /* '`' => '|' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x62, 0x78 }, /* 'b' => 'x' */
{ 0x63, 0x6a }, /* 'c' => 'j' */
{ 0x64, 0x65 }, /* 'd' => 'e' */
{ 0x65, 0x2e }, /* 'e' => '.' */
{ 0x66, 0x75 }, /* 'f' => 'u' */
{ 0x67, 0x69 }, /* 'g' => 'i' */
{ 0x68, 0x64 }, /* 'h' => 'd' */
{ 0x69, 0x63 }, /* 'i' => 'c' */
{ 0x6a, 0x68 }, /* 'j' => 'h' */
{ 0x6b, 0x74 }, /* 'k' => 't' */
{ 0x6c, 0x6e }, /* 'l' => 'n' */
{ 0x6e, 0x62 }, /* 'n' => 'b' */
{ 0x6f, 0x72 }, /* 'o' => 'r' */
{ 0x70, 0x6c }, /* 'p' => 'l' */
{ 0x72, 0x70 }, /* 'r' => 'p' */
{ 0x73, 0x6f }, /* 's' => 'o' */
{ 0x74, 0x79 }, /* 't' => 'y' */
{ 0x75, 0x67 }, /* 'u' => 'g' */
{ 0x76, 0x6b }, /* 'v' => 'k' */
{ 0x77, 0x2c }, /* 'w' => ',' */
{ 0x78, 0x71 }, /* 'x' => 'q' */
{ 0x79, 0x66 }, /* 'y' => 'f' */
{ 0x7b, 0x2a }, /* '{' => '*' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "no" AltGr remapping */
static struct keymap_key no_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "no" keyboard map */
struct keymap no_keymap __keymap = {
.name = "no",
.basic = no_basic,
.altgr = no_altgr,
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pl" basic remapping */
static struct keymap_key pl_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "pl" AltGr remapping */
static struct keymap_key pl_altgr[] = {
{ 0, 0 }
};
/** "pl" keyboard map */
struct keymap pl_keymap __keymap = {
.name = "pl",
.basic = pl_basic,
.altgr = pl_altgr,
/** "pl" keyboard mapping */
struct key_mapping pl_mapping[] __keymap = {
};

View File

@ -10,53 +10,20 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pt" basic remapping */
static struct keymap_key pt_basic[] = {
{ 0x1c, 0x7e }, /* 0x1c => '~' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x2b }, /* '[' => '+' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x2a }, /* '{' => '*' */
{ 0x7c, 0x5e }, /* '|' => '^' */
{ 0x7d, 0x60 }, /* '}' => '`' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "pt" AltGr remapping */
static struct keymap_key pt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};
/** "pt" keyboard map */
struct keymap pt_keymap __keymap = {
.name = "pt",
.basic = pt_basic,
.altgr = pt_altgr,
/** "pt" keyboard mapping */
struct key_mapping pt_mapping[] __keymap = {
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x1d, 0x1b }, /* 0x1d => 0x1b */
{ 0x22, 0x5e }, /* '"' => '^' */
{ 0x27, 0x7e }, /* '\'' => '~' */
{ 0x2f, 0x3b }, /* '/' => ';' */
{ 0x3f, 0x3a }, /* '?' => ':' */
{ 0x5b, 0x27 }, /* '[' => '\'' */
{ 0x5c, 0x5d }, /* '\\' => ']' */
{ 0x5d, 0x5b }, /* ']' => '[' */
{ 0x60, 0x27 }, /* '`' => '\'' */
{ 0x7b, 0x60 }, /* '{' => '`' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x7b }, /* '}' => '{' */
{ 0x7e, 0x22 }, /* '~' => '"' */
};

View File

@ -10,19 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ro" basic remapping */
static struct keymap_key ro_basic[] = {
{ 0, 0 }
};
/** "ro" AltGr remapping */
static struct keymap_key ro_altgr[] = {
{ 0, 0 }
};
/** "ro" keyboard map */
struct keymap ro_keymap __keymap = {
.name = "ro",
.basic = ro_basic,
.altgr = ro_altgr,
/** "ro" keyboard mapping */
struct key_mapping ro_mapping[] __keymap = {
};

View File

@ -10,22 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ru" basic remapping */
static struct keymap_key ru_basic[] = {
{ 0x0d, 0x0a }, /* Ctrl-M => Ctrl-J */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "ru" AltGr remapping */
static struct keymap_key ru_altgr[] = {
{ 0, 0 }
};
/** "ru" keyboard map */
struct keymap ru_keymap __keymap = {
.name = "ru",
.basic = ru_basic,
.altgr = ru_altgr,
/** "ru" keyboard mapping */
struct key_mapping ru_mapping[] __keymap = {
};

View File

@ -1,64 +0,0 @@
/** @file
*
* "se" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "se" basic remapping */
static struct keymap_key se_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "se" AltGr remapping */
static struct keymap_key se_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "se" keyboard map */
struct keymap se_keymap __keymap = {
.name = "se",
.basic = se_basic,
.altgr = se_altgr,
};

View File

@ -10,8 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sg" basic remapping */
static struct keymap_key sg_basic[] = {
/** "sg" keyboard mapping */
struct key_mapping sg_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x21, 0x2b }, /* '!' => '+' */
@ -38,32 +38,4 @@ static struct keymap_key sg_basic[] = {
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7c, 0x24 }, /* '|' => '$' */
{ 0x7d, 0x21 }, /* '}' => '!' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "sg" AltGr remapping */
static struct keymap_key sg_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7c }, /* '&' => '|' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x37, 0x7c }, /* '7' => '|' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};
/** "sg" keyboard map */
struct keymap sg_keymap __keymap = {
.name = "sg",
.basic = sg_basic,
.altgr = sg_altgr,
};

View File

@ -1,30 +0,0 @@
/** @file
*
* "sr-latin" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sr-latin" basic remapping */
static struct keymap_key sr_latin_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "sr-latin" AltGr remapping */
static struct keymap_key sr_latin_altgr[] = {
{ 0, 0 }
};
/** "sr-latin" keyboard map */
struct keymap sr_latin_keymap __keymap = {
.name = "sr-latin",
.basic = sr_latin_basic,
.altgr = sr_latin_altgr,
};

View File

@ -0,0 +1,35 @@
/** @file
*
* "sr" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sr" keyboard mapping */
struct key_mapping sr_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x2a }, /* '+' => '*' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3d, 0x2b }, /* '=' => '+' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "th" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "th" keyboard mapping */
struct key_mapping th_mapping[] __keymap = {
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ua" basic remapping */
static struct keymap_key ua_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "ua" AltGr remapping */
static struct keymap_key ua_altgr[] = {
{ 0, 0 }
};
/** "ua" keyboard map */
struct keymap ua_keymap __keymap = {
.name = "ua",
.basic = ua_basic,
.altgr = ua_altgr,
/** "ua" keyboard mapping */
struct key_mapping ua_mapping[] __keymap = {
};

View File

@ -10,23 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "uk" basic remapping */
static struct keymap_key uk_basic[] = {
/** "uk" keyboard mapping */
struct key_mapping uk_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "uk" AltGr remapping */
static struct keymap_key uk_altgr[] = {
{ 0, 0 }
};
/** "uk" keyboard map */
struct keymap uk_keymap __keymap = {
.name = "uk",
.basic = uk_basic,
.altgr = uk_altgr,
};

View File

@ -10,19 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "us" basic remapping */
static struct keymap_key us_basic[] = {
{ 0, 0 }
};
/** "us" AltGr remapping */
static struct keymap_key us_altgr[] = {
{ 0, 0 }
};
/** "us" keyboard map */
struct keymap us_keymap __keymap_default = {
.name = "us",
.basic = us_basic,
.altgr = us_altgr,
/** "us" keyboard mapping */
struct key_mapping us_mapping[] __keymap = {
};

View File

@ -0,0 +1,55 @@
/** @file
*
* "wo" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "wo" keyboard mapping */
struct key_mapping wo_mapping[] __keymap = {
{ 0x01, 0x11 }, /* Ctrl-A => Ctrl-Q */
{ 0x11, 0x01 }, /* Ctrl-Q => Ctrl-A */
{ 0x17, 0x1a }, /* Ctrl-W => Ctrl-Z */
{ 0x1a, 0x17 }, /* Ctrl-Z => Ctrl-W */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2d, 0x29 }, /* '-' => ')' */
{ 0x2e, 0x3a }, /* '.' => ':' */
{ 0x2f, 0x21 }, /* '/' => '!' */
{ 0x31, 0x26 }, /* '1' => '&' */
{ 0x33, 0x22 }, /* '3' => '"' */
{ 0x34, 0x27 }, /* '4' => '\'' */
{ 0x35, 0x28 }, /* '5' => '(' */
{ 0x36, 0x2d }, /* '6' => '-' */
{ 0x38, 0x5f }, /* '8' => '_' */
{ 0x3a, 0x4d }, /* ':' => 'M' */
{ 0x3b, 0x6d }, /* ';' => 'm' */
{ 0x3c, 0x2e }, /* '<' => '.' */
{ 0x3e, 0x2f }, /* '>' => '/' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x41, 0x51 }, /* 'A' => 'Q' */
{ 0x4d, 0x3f }, /* 'M' => '?' */
{ 0x51, 0x41 }, /* 'Q' => 'A' */
{ 0x57, 0x5a }, /* 'W' => 'Z' */
{ 0x5a, 0x57 }, /* 'Z' => 'W' */
{ 0x5d, 0x24 }, /* ']' => '$' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x61, 0x71 }, /* 'a' => 'q' */
{ 0x6d, 0x2c }, /* 'm' => ',' */
{ 0x71, 0x61 }, /* 'q' => 'a' */
{ 0x77, 0x7a }, /* 'w' => 'z' */
{ 0x7a, 0x77 }, /* 'z' => 'w' */
{ 0x7e, 0x25 }, /* '~' => '%' */
};

View File

@ -38,7 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
#define READLINE_MAX 1024
#define READLINE_MAX 256
/**
* Synchronise console with edited string
@ -258,8 +258,8 @@ void history_free ( struct readline_history *history ) {
int readline_history ( const char *prompt, const char *prefill,
struct readline_history *history, unsigned long timeout,
char **line ) {
char buf[READLINE_MAX];
struct edit_string string;
char *buf;
int key;
int move_by;
const char *new_string;
@ -275,14 +275,10 @@ int readline_history ( const char *prompt, const char *prefill,
/* Ensure cursor is visible */
printf ( "\033[?25h" );
/* Allocate buffer and initialise editable string */
buf = zalloc ( READLINE_MAX );
if ( ! buf ) {
rc = -ENOMEM;
goto done;
}
/* Initialise editable string */
memset ( &string, 0, sizeof ( string ) );
init_editstring ( &string, buf, READLINE_MAX );
init_editstring ( &string, buf, sizeof ( buf ) );
buf[0] = '\0';
/* Prefill string, if applicable */
if ( prefill ) {
@ -307,13 +303,8 @@ int readline_history ( const char *prompt, const char *prefill,
switch ( key ) {
case CR:
case LF:
/* Shrink string (ignoring failures) */
*line = realloc ( buf,
( strlen ( buf ) + 1 /* NUL */ ) );
if ( ! *line )
*line = buf;
buf = NULL;
rc = 0;
*line = strdup ( buf );
rc = ( ( *line ) ? 0 : -ENOMEM );
goto done;
case CTRL_C:
rc = -ECANCELED;
@ -341,7 +332,6 @@ int readline_history ( const char *prompt, const char *prefill,
done:
putchar ( '\n' );
free ( buf );
if ( history ) {
if ( *line && (*line)[0] )
history_append ( history, *line );

View File

@ -386,13 +386,8 @@ acpi_describe ( struct interface *interface );
#define acpi_describe_TYPE( object_type ) \
typeof ( struct acpi_descriptor * ( object_type ) )
extern userptr_t ( * acpi_finder ) ( uint32_t signature, unsigned int index );
extern void acpi_fix_checksum ( struct acpi_header *acpi );
extern userptr_t acpi_table ( uint32_t signature, unsigned int index );
extern int acpi_extract ( uint32_t signature, void *data,
int ( * extract ) ( userptr_t zsdt, size_t len,
size_t offset, void *data ) );
extern int acpi_sx ( uint32_t signature );
extern void acpi_add ( struct acpi_descriptor *desc );
extern void acpi_del ( struct acpi_descriptor *desc );
extern int acpi_install ( int ( * install ) ( struct acpi_header *acpi ) );

View File

@ -1,14 +0,0 @@
#ifndef _IPXE_ACPIMAC_H
#define _IPXE_ACPIMAC_H
/** @file
*
* ACPI MAC address
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
extern int acpi_mac ( uint8_t *hw_addr );
#endif /* _IPXE_ACPIMAC_H */

View File

@ -223,7 +223,6 @@ extern EFI_HANDLE efi_image_handle;
extern EFI_LOADED_IMAGE_PROTOCOL *efi_loaded_image;
extern EFI_DEVICE_PATH_PROTOCOL *efi_loaded_image_path;
extern EFI_SYSTEM_TABLE *efi_systab;
extern EFI_TPL efi_internal_tpl;
extern EFI_TPL efi_external_tpl;
extern int efi_shutdown_in_progress;

View File

@ -10,7 +10,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/efi/efi.h>
extern EFI_BOOT_SERVICES * efi_wrap_bs ( void );
extern EFI_SYSTEM_TABLE * efi_wrap_systab ( void );
extern void efi_wrap ( EFI_HANDLE handle );
#endif /* _IPXE_EFI_WRAP_H */

View File

@ -77,7 +77,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_fdt ( ERRFILE_CORE | 0x00250000 )
#define ERRFILE_dma ( ERRFILE_CORE | 0x00260000 )
#define ERRFILE_cachedhcp ( ERRFILE_CORE | 0x00270000 )
#define ERRFILE_acpimac ( ERRFILE_CORE | 0x00280000 )
#define ERRFILE_eisa ( ERRFILE_DRIVER | 0x00000000 )
#define ERRFILE_isa ( ERRFILE_DRIVER | 0x00010000 )
@ -395,7 +394,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_efi_cachedhcp ( ERRFILE_OTHER | 0x00550000 )
#define ERRFILE_linux_sysfs ( ERRFILE_OTHER | 0x00560000 )
#define ERRFILE_linux_acpi ( ERRFILE_OTHER | 0x00570000 )
#define ERRFILE_dynkeymap ( ERRFILE_OTHER | 0x00580000 )
/** @} */

View File

@ -11,7 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/ansiesc.h>
#include <ipxe/utf8.h>
#include <ipxe/uaccess.h>
#include <ipxe/console.h>
@ -37,7 +36,7 @@ struct fbcon_font {
/**
* Get character glyph
*
* @v character Unicode character
* @v character Character
* @v glyph Character glyph to fill in
*/
void ( * glyph ) ( unsigned int character, uint8_t *glyph );
@ -93,7 +92,7 @@ struct fbcon_text_cell {
uint32_t foreground;
/** Background colour */
uint32_t background;
/** Unicode character */
/** Character */
unsigned int character;
};
@ -139,8 +138,6 @@ struct fbcon {
unsigned int ypos;
/** ANSI escape sequence context */
struct ansiesc_context ctx;
/** UTF-8 accumulator */
struct utf8_accumulator utf8;
/** Text array */
struct fbcon_text text;
/** Background picture */

View File

@ -13,67 +13,18 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/tables.h>
/** A remapped key
*
* Represents a mapping from an ASCII character (as interpreted from a
* keyboard scancode by the US-only keyboard driver provided by the
* BIOS) to the appropriate ASCII value for the keyboard layout.
*/
struct keymap_key {
/** A keyboard mapping */
struct key_mapping {
/** Character read from keyboard */
uint8_t from;
/** Character to be used instead */
uint8_t to;
} __attribute__ (( packed ));
/** A keyboard mapping */
struct keymap {
/** Name */
const char *name;
/** Basic remapping table (zero-terminated) */
struct keymap_key *basic;
/** AltGr remapping table (zero-terminated) */
struct keymap_key *altgr;
};
/** Keyboard mapping table */
#define KEYMAP __table ( struct keymap, "keymap" )
/** Define a default keyboard mapping */
#define __keymap_default __table_entry ( KEYMAP, 01 )
#define KEYMAP __table ( struct key_mapping, "keymap" )
/** Define a keyboard mapping */
#define __keymap __table_entry ( KEYMAP, 02 )
/** Mappable character mask */
#define KEYMAP_MASK 0xff
/** Pseudo key flag */
#define KEYMAP_PSEUDO 0x80
/** Ctrl key flag */
#define KEYMAP_CTRL 0x0100
/** CapsLock key flag */
#define KEYMAP_CAPSLOCK 0x0200
/** Undo CapsLock key flag
*
* Used when the keyboard driver has already interpreted the CapsLock
* key, in which case the effect needs to be undone before remapping
* in order to correctly handle keyboard mappings that swap alphabetic
* and non-alphabetic keys.
*/
#define KEYMAP_CAPSLOCK_UNDO 0x0400
/** Undo and redo CapsLock key flags */
#define KEYMAP_CAPSLOCK_REDO ( KEYMAP_CAPSLOCK | KEYMAP_CAPSLOCK_UNDO )
/** AltGr key flag */
#define KEYMAP_ALTGR 0x0800
extern unsigned int key_remap ( unsigned int character );
extern struct keymap * keymap_find ( const char *name );
extern void keymap_set ( struct keymap *keymap );
#define __keymap __table_entry ( KEYMAP, 01 )
#endif /* _IPXE_KEYMAP_H */

View File

@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#endif
/**
* Convert user pointer to physical address
* Convert user buffer to physical address
*
* @v userptr User pointer
* @v offset Offset from user pointer
@ -46,19 +46,6 @@ UACCESS_INLINE ( linux, user_to_phys ) ( userptr_t userptr, off_t offset ) {
return ( userptr + offset );
}
/**
* Convert physical address to user pointer
*
* @v phys_addr Physical address
* @ret userptr User pointer
*/
static inline __always_inline userptr_t
UACCESS_INLINE ( linux, phys_to_user ) ( physaddr_t phys_addr ) {
/* For symmetry with the stub user_to_phys() */
return phys_addr;
}
static inline __always_inline userptr_t
UACCESS_INLINE ( linux, virt_to_user ) ( volatile const void *addr ) {
return trivial_virt_to_user ( addr );

View File

@ -1,68 +0,0 @@
#ifndef _IPXE_SBAT_H
#define _IPXE_SBAT_H
/** @file
*
* Secure Boot Advanced Targeting (SBAT)
*
* SBAT defines an encoding for security generation numbers stored as
* a CSV file within a special ".sbat" section in the signed binary.
* If a Secure Boot exploit is discovered then the generation number
* will be incremented alongside the corresponding fix.
*
* Platforms may then record the minimum generation number required
* for any given product. This allows for an efficient revocation
* mechanism that consumes minimal flash storage space (in contrast to
* the DBX mechanism, which allows for only a single-digit number of
* revocation events to ever take place across all possible signed
* binaries).
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* A single line within an SBAT CSV file
*
* @v name Machine-readable component name
* @v generation Security generation number
* @v vendor Human-readable vendor name
* @v package Human-readable package name
* @v version Human-readable package version
* @v uri Contact URI
* @ret line CSV line
*/
#define SBAT_LINE( name, generation, vendor, package, version, uri ) \
name "," _S2 ( generation ) "," vendor "," package "," \
version "," uri "\n"
/** SBAT format generation */
#define SBAT_GENERATION 1
/** Upstream security generation
*
* This represents the security generation of the upstream codebase.
* It will be incremented whenever a Secure Boot exploit is fixed in
* the upstream codebase.
*
* If you do not have commit access to the upstream iPXE repository,
* then you may not modify this value under any circumstances.
*/
#define IPXE_SBAT_GENERATION 1
/* Seriously, do not modify this value */
#if IPXE_SBAT_GENERATION != 1
#error "You may not modify IPXE_SBAT_GENERATION"
#endif
/** SBAT header line */
#define SBAT_HEADER \
SBAT_LINE ( "sbat", SBAT_GENERATION, "SBAT Version", "sbat", \
_S2 ( SBAT_GENERATION ), \
"https://github.com/rhboot/shim/blob/main/SBAT.md" )
/** Mark variable as being in the ".sbat" section */
#define __sbat __attribute__ (( section ( ".sbat" ), aligned ( 512 ) ))
extern const char sbat[] __sbat;
#endif /* _IPXE_SBAT_H */

View File

@ -426,7 +426,6 @@ extern const struct setting_type setting_type_hexhyp __setting_type;
extern const struct setting_type setting_type_hexraw __setting_type;
extern const struct setting_type setting_type_base64 __setting_type;
extern const struct setting_type setting_type_uuid __setting_type;
extern const struct setting_type setting_type_guid __setting_type;
extern const struct setting_type setting_type_busdevfn __setting_type;
extern const struct setting_type setting_type_dnssl __setting_type;

View File

@ -774,7 +774,7 @@ struct srp_aer_rsp {
* The working draft specification for the SRP boot firmware table can
* be found at
*
* https://ipxe.org/wiki/srp/sbft
* http://ipxe.org/wiki/srp/sbft
*
*****************************************************************************
*/

View File

@ -252,17 +252,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
__attribute__ (( unused )); \
__table_entries; } )
/**
* Declare start of linker table entries
*
* @v entries Start of entries
* @v table Linker table
* @v idx Sub-table index
*/
#define __TABLE_ENTRIES( entries, table, idx ) \
__table_type ( table ) entries[0] \
__table_entry ( table, idx )
/**
* Get start of linker table
*
@ -281,14 +270,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define table_start( table ) __table_entries ( table, 00 )
/**
* Declare start of linker table
*
* @v start Start of linker table
* @v table Linker table
*/
#define TABLE_START( start, table ) __TABLE_ENTRIES ( start, table, 00 )
/**
* Get end of linker table
*
@ -307,14 +288,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define table_end( table ) __table_entries ( table, 99 )
/**
* Declare end of linker table
*
* @v end End of linker table
* @v table Linker table
*/
#define TABLE_END( end, table ) __TABLE_ENTRIES ( end, table, 99 )
/**
* Get number of entries in linker table
*

View File

@ -46,20 +46,6 @@ struct parameters;
* scheme = "ftp", user = "joe", password = "secret",
* host = "insecure.org", port = "8081", path = "/hidden/path/to",
* query = "what=is", fragment = "this"
*
* The URI syntax includes a percent-encoding mechanism that can be
* used to represent characters that would otherwise not be possible,
* such as a '/' character within the password field. These encodings
* are decoded during the URI parsing stage, thereby allowing protocol
* implementations to consume the raw field values directly without
* further decoding.
*
* Some protocols (such as HTTP) communicate using URI-encoded values.
* For these protocols, the original encoded substring must be
* retained verbatim since the choice of whether or not to encode a
* particular character may have significance to the receiving
* application. We therefore retain the originally-encoded substrings
* for the path, query, and fragment fields.
*/
struct uri {
/** Reference count */
@ -76,14 +62,12 @@ struct uri {
const char *host;
/** Port number */
const char *port;
/** Path (after URI decoding) */
/** Path */
const char *path;
/** Path (with original URI encoding) */
const char *epath;
/** Query (with original URI encoding) */
const char *equery;
/** Fragment (with original URI encoding) */
const char *efragment;
/** Query */
const char *query;
/** Fragment */
const char *fragment;
/** Form parameters */
struct parameters *params;
} __attribute__ (( packed ));
@ -116,9 +100,8 @@ enum uri_fields {
URI_HOST = URI_FIELD ( host ),
URI_PORT = URI_FIELD ( port ),
URI_PATH = URI_FIELD ( path ),
URI_EPATH = URI_FIELD ( epath ),
URI_EQUERY = URI_FIELD ( equery ),
URI_EFRAGMENT = URI_FIELD ( efragment ),
URI_QUERY = URI_FIELD ( query ),
URI_FRAGMENT = URI_FIELD ( fragment ),
URI_FIELDS
};

View File

@ -1,69 +0,0 @@
#ifndef _IPXE_UTF8_H
#define _IPXE_UTF8_H
/** @file
*
* UTF-8 Unicode encoding
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
/** Maximum length of UTF-8 sequence */
#define UTF8_MAX_LEN 4
/** Minimum legal value for two-byte UTF-8 sequence */
#define UTF8_MIN_TWO 0x80
/** Minimum legal value for three-byte UTF-8 sequence */
#define UTF8_MIN_THREE 0x800
/** Minimum legal value for four-byte UTF-8 sequence */
#define UTF8_MIN_FOUR 0x10000
/** High bit of UTF-8 bytes */
#define UTF8_HIGH_BIT 0x80
/** Number of data bits in each continuation byte */
#define UTF8_CONTINUATION_BITS 6
/** Bit mask for data bits in a continuation byte */
#define UTF8_CONTINUATION_MASK ( ( 1 << UTF8_CONTINUATION_BITS ) - 1 )
/** Non-data bits in a continuation byte */
#define UTF8_CONTINUATION 0x80
/** Check for a continuation byte
*
* @v byte UTF-8 byte
* @ret is_continuation Byte is a continuation byte
*/
#define UTF8_IS_CONTINUATION( byte ) \
( ( (byte) & ~UTF8_CONTINUATION_MASK ) == UTF8_CONTINUATION )
/** Check for an ASCII byte
*
* @v byte UTF-8 byte
* @ret is_ascii Byte is an ASCII byte
*/
#define UTF8_IS_ASCII( byte ) ( ! ( (byte) & UTF8_HIGH_BIT ) )
/** Invalid character returned when decoding fails */
#define UTF8_INVALID 0xfffd
/** A UTF-8 character accumulator */
struct utf8_accumulator {
/** Character in progress */
unsigned int character;
/** Number of remaining continuation bytes */
unsigned int remaining;
/** Minimum legal character */
unsigned int min;
};
extern unsigned int utf8_accumulate ( struct utf8_accumulator *utf8,
uint8_t byte );
#endif /* _IPXE_UTF8_H */

View File

@ -1,8 +1,6 @@
#ifndef _VIRTIO_PCI_H_
# define _VIRTIO_PCI_H_
#include <ipxe/dma.h>
/* A 32-bit r/o bitmask of the features supported by the host */
#define VIRTIO_PCI_HOST_FEATURES 0
@ -200,8 +198,7 @@ struct vring_virtqueue;
void vp_free_vq(struct vring_virtqueue *vq);
int vp_find_vq(unsigned int ioaddr, int queue_index,
struct vring_virtqueue *vq, struct dma_device *dma_dev,
size_t header_size);
struct vring_virtqueue *vq);
/* Virtio 1.0 I/O routines abstract away the three possible HW access
@ -301,8 +298,7 @@ void vpm_notify(struct virtio_pci_modern_device *vdev,
struct vring_virtqueue *vq);
int vpm_find_vqs(struct virtio_pci_modern_device *vdev,
unsigned nvqs, struct vring_virtqueue *vqs,
struct dma_device *dma_dev, size_t header_size);
unsigned nvqs, struct vring_virtqueue *vqs);
int virtio_pci_find_capability(struct pci_device *pci, uint8_t cfg_type);

View File

@ -2,7 +2,6 @@
# define _VIRTIO_RING_H_
#include <ipxe/virtio-pci.h>
#include <ipxe/dma.h>
/* Status byte for guest to report progress, and synchronize features. */
/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
@ -75,21 +74,17 @@ struct vring {
struct vring_virtqueue {
unsigned char *queue;
size_t queue_size;
struct dma_mapping map;
struct dma_device *dma;
struct vring vring;
u16 free_head;
u16 last_used_idx;
void **vdata;
struct virtio_net_hdr_modern *empty_header;
/* PCI */
int queue_index;
struct virtio_pci_region notification;
};
struct vring_list {
physaddr_t addr;
char *addr;
unsigned int length;
};

View File

@ -24,14 +24,11 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <ipxe/image.h>
#include <ipxe/init.h>
#include <ipxe/in.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_autoexec.h>
#include <ipxe/efi/Protocol/PxeBaseCode.h>
#include <ipxe/efi/Protocol/SimpleFileSystem.h>
#include <ipxe/efi/Guid/FileInfo.h>
@ -42,10 +39,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
/** Autoexec script filename */
static wchar_t efi_autoexec_wname[] = L"autoexec.ipxe";
#define AUTOEXEC_FILENAME L"autoexec.ipxe"
/** Autoexec script image name */
static char efi_autoexec_name[] = "autoexec.ipxe";
#define AUTOEXEC_NAME "autoexec.ipxe"
/** Autoexec script (if any) */
static void *efi_autoexec;
@ -54,21 +51,21 @@ static void *efi_autoexec;
static size_t efi_autoexec_len;
/**
* Load autoexec script from filesystem
* Load autoexec script
*
* @v device Device handle
* @ret rc Return status code
*/
static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
int efi_autoexec_load ( EFI_HANDLE device ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
static wchar_t name[] = AUTOEXEC_FILENAME;
union {
void *interface;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *fs;
} u;
struct {
EFI_FILE_INFO info;
CHAR16 name[ sizeof ( efi_autoexec_wname ) /
sizeof ( efi_autoexec_wname[0] ) ];
CHAR16 name[ sizeof ( name ) / sizeof ( name[0] ) ];
} info;
EFI_FILE_PROTOCOL *root;
EFI_FILE_PROTOCOL *file;
@ -77,6 +74,10 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
EFI_STATUS efirc;
int rc;
/* Sanity check */
assert ( efi_autoexec == NULL );
assert ( efi_autoexec_len == 0 );
/* Open simple file system protocol */
if ( ( efirc = bs->OpenProtocol ( device,
&efi_simple_file_system_protocol_guid,
@ -98,12 +99,11 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
}
/* Open autoexec script */
if ( ( efirc = root->Open ( root, &file, efi_autoexec_wname,
if ( ( efirc = root->Open ( root, &file, name,
EFI_FILE_MODE_READ, 0 ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s has no %ls: %s\n",
efi_handle_name ( device ), efi_autoexec_wname,
strerror ( rc ) );
efi_handle_name ( device ), name, strerror ( rc ) );
goto err_open;
}
@ -113,8 +113,7 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
&info ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not get %ls info: %s\n",
efi_handle_name ( device ), efi_autoexec_wname,
strerror ( rc ) );
efi_handle_name ( device ), name, strerror ( rc ) );
goto err_getinfo;
}
size = info.info.FileSize;
@ -123,7 +122,7 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
if ( ! size ) {
rc = -EINVAL;
DBGC ( device, "EFI %s has zero-length %ls\n",
efi_handle_name ( device ), efi_autoexec_wname );
efi_handle_name ( device ), name );
goto err_empty;
}
@ -132,8 +131,7 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
&data ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not allocate %ls: %s\n",
efi_handle_name ( device ), efi_autoexec_wname,
strerror ( rc ) );
efi_handle_name ( device ), name, strerror ( rc ) );
goto err_alloc;
}
@ -141,8 +139,7 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
if ( ( efirc = file->Read ( file, &size, data ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not read %ls: %s\n",
efi_handle_name ( device ), efi_autoexec_wname,
strerror ( rc ) );
efi_handle_name ( device ), name, strerror ( rc ) );
goto err_read;
}
@ -151,7 +148,7 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
efi_autoexec_len = size;
data = NULL;
DBGC ( device, "EFI %s found %ls\n",
efi_handle_name ( device ), efi_autoexec_wname );
efi_handle_name ( device ), name );
/* Success */
rc = 0;
@ -172,199 +169,6 @@ static int efi_autoexec_filesystem ( EFI_HANDLE device ) {
return rc;
}
/**
* Load autoexec script from TFTP server
*
* @v device Device handle
* @ret rc Return status code
*/
static int efi_autoexec_tftp ( EFI_HANDLE device ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
union {
void *interface;
EFI_PXE_BASE_CODE_PROTOCOL *pxe;
} u;
EFI_PXE_BASE_CODE_MODE *mode;
EFI_PXE_BASE_CODE_PACKET *packet;
union {
struct in_addr in;
EFI_IP_ADDRESS ip;
} server;
size_t filename_max;
char *filename;
char *sep;
UINT64 size;
VOID *data;
EFI_STATUS efirc;
int rc;
/* Open PXE base code protocol */
if ( ( efirc = bs->OpenProtocol ( device,
&efi_pxe_base_code_protocol_guid,
&u.interface, efi_image_handle,
device,
EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s has no PXE base code instance: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
goto err_pxe;
}
/* Do not attempt to parse DHCPv6 packets */
mode = u.pxe->Mode;
if ( mode->UsingIpv6 ) {
rc = -ENOTSUP;
DBGC ( device, "EFI %s has IPv6 PXE base code\n",
efi_handle_name ( device ) );
goto err_ipv6;
}
/* Identify relevant reply packet */
if ( mode->PxeReplyReceived &&
mode->PxeReply.Dhcpv4.BootpBootFile[0] ) {
/* Use boot filename if present in PXE reply */
DBGC ( device, "EFI %s using PXE reply filename\n",
efi_handle_name ( device ) );
packet = &mode->PxeReply;
} else if ( mode->DhcpAckReceived &&
mode->DhcpAck.Dhcpv4.BootpBootFile[0] ) {
/* Otherwise, use boot filename if present in DHCPACK */
DBGC ( device, "EFI %s using DHCPACK filename\n",
efi_handle_name ( device ) );
packet = &mode->DhcpAck;
} else if ( mode->ProxyOfferReceived &&
mode->ProxyOffer.Dhcpv4.BootpBootFile[0] ) {
/* Otherwise, use boot filename if present in ProxyDHCPOFFER */
DBGC ( device, "EFI %s using ProxyDHCPOFFER filename\n",
efi_handle_name ( device ) );
packet = &mode->ProxyOffer;
} else {
/* No boot filename available */
rc = -ENOENT;
DBGC ( device, "EFI %s has no PXE boot filename\n",
efi_handle_name ( device ) );
goto err_packet;
}
/* Allocate filename */
filename_max = ( sizeof ( packet->Dhcpv4.BootpBootFile )
+ ( sizeof ( efi_autoexec_name ) - 1 /* NUL */ )
+ 1 /* NUL */ );
filename = zalloc ( filename_max );
if ( ! filename ) {
rc = -ENOMEM;
goto err_filename;
}
/* Extract next-server address and boot filename */
memset ( &server, 0, sizeof ( server ) );
memcpy ( &server.in, packet->Dhcpv4.BootpSiAddr,
sizeof ( server.in ) );
memcpy ( filename, packet->Dhcpv4.BootpBootFile,
sizeof ( packet->Dhcpv4.BootpBootFile ) );
/* Update filename to autoexec script name */
sep = strrchr ( filename, '/' );
if ( ! sep )
sep = strrchr ( filename, '\\' );
if ( ! sep )
sep = ( filename - 1 );
strcpy ( ( sep + 1 ), efi_autoexec_name );
/* Get file size */
if ( ( efirc = u.pxe->Mtftp ( u.pxe,
EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE,
NULL, FALSE, &size, NULL, &server.ip,
( ( UINT8 * ) filename ), NULL,
FALSE ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not get size of %s:%s: %s\n",
efi_handle_name ( device ), inet_ntoa ( server.in ),
filename, strerror ( rc ) );
goto err_size;
}
/* Ignore zero-length files */
if ( ! size ) {
rc = -EINVAL;
DBGC ( device, "EFI %s has zero-length %s:%s\n",
efi_handle_name ( device ), inet_ntoa ( server.in ),
filename );
goto err_empty;
}
/* Allocate temporary copy */
if ( ( efirc = bs->AllocatePool ( EfiBootServicesData, size,
&data ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not allocate %s:%s: %s\n",
efi_handle_name ( device ), inet_ntoa ( server.in ),
filename, strerror ( rc ) );
goto err_alloc;
}
/* Download file */
if ( ( efirc = u.pxe->Mtftp ( u.pxe, EFI_PXE_BASE_CODE_TFTP_READ_FILE,
data, FALSE, &size, NULL, &server.ip,
( ( UINT8 * ) filename ), NULL,
FALSE ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( device, "EFI %s could not download %s:%s: %s\n",
efi_handle_name ( device ), inet_ntoa ( server.in ),
filename, strerror ( rc ) );
goto err_download;
}
/* Record autoexec script */
efi_autoexec = data;
efi_autoexec_len = size;
data = NULL;
DBGC ( device, "EFI %s found %s:%s\n", efi_handle_name ( device ),
inet_ntoa ( server.in ), filename );
/* Success */
rc = 0;
err_download:
if ( data )
bs->FreePool ( data );
err_alloc:
err_empty:
err_size:
free ( filename );
err_filename:
err_packet:
err_ipv6:
bs->CloseProtocol ( device, &efi_pxe_base_code_protocol_guid,
efi_image_handle, device );
err_pxe:
return rc;
}
/**
* Load autoexec script
*
* @v device Device handle
* @ret rc Return status code
*/
int efi_autoexec_load ( EFI_HANDLE device ) {
int rc;
/* Sanity check */
assert ( efi_autoexec == NULL );
assert ( efi_autoexec_len == 0 );
/* Try loading from file system, if supported */
if ( ( rc = efi_autoexec_filesystem ( device ) ) == 0 )
return 0;
/* Try loading via TFTP, if supported */
if ( ( rc = efi_autoexec_tftp ( device ) ) == 0 )
return 0;
return -ENOENT;
}
/**
* Register autoexec script
*
@ -372,6 +176,7 @@ int efi_autoexec_load ( EFI_HANDLE device ) {
static void efi_autoexec_startup ( void ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE device = efi_loaded_image->DeviceHandle;
const char *name = AUTOEXEC_NAME;
struct image *image;
/* Do nothing if we have no autoexec script */
@ -379,16 +184,15 @@ static void efi_autoexec_startup ( void ) {
return;
/* Create autoexec image */
image = image_memory ( efi_autoexec_name,
virt_to_user ( efi_autoexec ),
image = image_memory ( name, virt_to_user ( efi_autoexec ),
efi_autoexec_len );
if ( ! image ) {
DBGC ( device, "EFI %s could not create %s\n",
efi_handle_name ( device ), efi_autoexec_name );
efi_handle_name ( device ), name );
return;
}
DBGC ( device, "EFI %s registered %s\n",
efi_handle_name ( device ), efi_autoexec_name );
efi_handle_name ( device ), name );
/* Free temporary copy */
bs->FreePool ( efi_autoexec );

View File

@ -26,9 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/ConsoleControl/ConsoleControl.h>
#include <ipxe/ansiesc.h>
#include <ipxe/utf8.h>
#include <ipxe/console.h>
#include <ipxe/keymap.h>
#include <ipxe/init.h>
#include <config/console.h>
@ -56,6 +54,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ATTR_DEFAULT ATTR_FCOL_WHITE
#define CTRL_MASK 0x1f
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_EFI ) && CONSOLE_EXPLICIT ( CONSOLE_EFI ) )
#undef CONSOLE_EFI
@ -202,9 +202,6 @@ static struct ansiesc_context efi_ansiesc_ctx = {
.handlers = efi_ansiesc_handlers,
};
/** EFI console UTF-8 accumulator */
static struct utf8_accumulator efi_utf8_acc;
/**
* Print a character to EFI console
*
@ -212,25 +209,13 @@ static struct utf8_accumulator efi_utf8_acc;
*/
static void efi_putchar ( int character ) {
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *conout = efi_systab->ConOut;
wchar_t wstr[2];
wchar_t wstr[] = { character, 0 };
/* Intercept ANSI escape sequences */
character = ansiesc_process ( &efi_ansiesc_ctx, character );
if ( character < 0 )
return;
/* Accumulate Unicode characters */
character = utf8_accumulate ( &efi_utf8_acc, character );
if ( character == 0 )
return;
/* Treat unrepresentable (non-UCS2) characters as invalid */
if ( character & ~( ( wchar_t ) -1UL ) )
character = UTF8_INVALID;
/* Output character */
wstr[0] = character;
wstr[1] = L'\0';
conout->OutputString ( conout, wstr );
}
@ -300,9 +285,6 @@ static int efi_getchar ( void ) {
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *conin = efi_systab->ConIn;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *conin_ex = efi_conin_ex;
const char *ansi_seq;
unsigned int character;
unsigned int shift;
unsigned int toggle;
EFI_KEY_DATA key;
EFI_STATUS efirc;
int rc;
@ -335,38 +317,17 @@ static int efi_getchar ( void ) {
key.KeyState.KeyToggleState, key.Key.UnicodeChar,
key.Key.ScanCode );
/* If key has a Unicode representation, remap and return it.
* There is unfortunately no way to avoid remapping the
* numeric keypad, since EFI destroys the scan code
* information that would allow us to differentiate between
* main keyboard and numeric keypad.
*/
if ( ( character = key.Key.UnicodeChar ) != 0 ) {
/* Apply shift state */
shift = key.KeyState.KeyShiftState;
if ( shift & EFI_SHIFT_STATE_VALID ) {
if ( shift & ( EFI_LEFT_CONTROL_PRESSED |
EFI_RIGHT_CONTROL_PRESSED ) ) {
character |= KEYMAP_CTRL;
}
if ( shift & EFI_RIGHT_ALT_PRESSED ) {
character |= KEYMAP_ALTGR;
}
}
/* Apply toggle state */
toggle = key.KeyState.KeyToggleState;
if ( toggle & EFI_TOGGLE_STATE_VALID ) {
if ( toggle & EFI_CAPS_LOCK_ACTIVE ) {
character |= KEYMAP_CAPSLOCK_REDO;
}
}
/* Remap and return key */
return key_remap ( character );
/* Translate Ctrl-<key> */
if ( ( key.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID ) &&
( key.KeyState.KeyShiftState & ( EFI_LEFT_CONTROL_PRESSED |
EFI_RIGHT_CONTROL_PRESSED ) ) ) {
key.Key.UnicodeChar &= CTRL_MASK;
}
/* If key has a Unicode representation, return it */
if ( key.Key.UnicodeChar )
return key.Key.UnicodeChar;
/* Otherwise, check for a special key that we know about */
if ( ( ansi_seq = scancode_to_ansi_seq ( key.Key.ScanCode ) ) ) {
/* Start of escape sequence: return ESC (0x1b) */

View File

@ -104,8 +104,8 @@ static void efi_entropy_disable ( void ) {
/* Close timer tick event */
bs->CloseEvent ( tick );
/* Return to internal TPL */
bs->RaiseTPL ( efi_internal_tpl );
/* Return to TPL_CALLBACK */
bs->RaiseTPL ( TPL_CALLBACK );
}
/**

Some files were not shown because too many files have changed in this diff Show More