2 Commits
Author SHA1 Message Date
Michael Brown 6039deb163 [console] Avoid overlap between special keys and Unicode characters
The special key range (from KEY_MIN upwards) currently overlaps with
the valid range for Unicode characters, and therefore prohibits the
use of Unicode key values outside the ASCII range.

Create space for Unicode key values by moving the special keys to the
range immediately above the maximum valid Unicode character.  This
allows the existing encoding of special keys as an efficiently packed
representation of the equivalent ANSI escape sequence to be maintained
almost as-is.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-06-13 19:43:50 +01:00
Michael Brown 24eecdb7e2 [console] Avoid overlap between remapping flags and character values
The keyboard remapping flags currently occupy bits 8 and upwards of
the to-be-mapped character value.  This overlaps the range used for
special keys (KEY_MIN and upwards) and also overlaps the valid Unicode
character range.

No conflict is created by this overlap, since by design only ASCII
character values (as generated by an ASCII-only keyboard driver) are
subject to remapping, and so the to-be-remapped character values exist
in a conceptually separate namespace from either special keys or
non-ASCII Unicode characters.  However, the overlap is potentially
confusing for readers of the code.

Minimise cognitive load by using bits 24 and upwards for the keyboard
remapping flags.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2023-06-13 19:35:57 +01:00
61 changed files with 161 additions and 632 deletions
+1 -5
View File
@@ -50,10 +50,6 @@ $(BIN)/efidrv.cab : $(BIN)/alldrv.efis # $(ALL_drv.efi) is not yet defined
$(QM)$(ECHO) " [CAB] $@"
$(Q)$(LCAB) -n -q $(ALL_drv.efi) $@
$(BIN)/%.iso : $(BIN)/%.efi util/genfsimg
$(QM)$(ECHO) " [GENFSIMG] $@"
$(Q)util/genfsimg -o $@ $<
$(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
$(BIN)/%.iso $(BIN)/%.usb : $(BIN)/%.efi util/genfsimg
$(QM)$(ECHO) " [GENFSIMG] $@"
$(Q)util/genfsimg -o $@ $<
+1 -9
View File
@@ -502,13 +502,6 @@ LDFLAGS += --gc-sections
#
LDFLAGS += -static
# Use separate code segment if supported by linker
#
ZSC_TEST = $(LD) -z separate-code --version 2>&1 > /dev/null
ZSC_FLAGS := $(shell [ -z "`$(ZSC_TEST)`" ] && \
$(ECHO) '-z separate-code -z max-page-size=4096')
LDFLAGS += $(ZSC_FLAGS)
# compiler.h is needed for our linking and debugging system
#
CFLAGS += -include include/compiler.h
@@ -1009,7 +1002,6 @@ endif
# Device ID tables (using IDs from ROM definition file)
#
define obj_pci_id_asm
.section ".note.GNU-stack", "", $(ASM_TCHAR)progbits
.section ".pci_devlist.$(1)", "a", $(ASM_TCHAR)progbits
.globl pci_devlist_$(1)
pci_devlist_$(1):
@@ -1179,7 +1171,7 @@ BLIB = $(BIN)/blib.a
$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
$(Q)$(RM) $(BLIB)
$(QM)$(ECHO) " [AR] $@"
$(Q)$(AR) rcD $@ $(sort $(BLIB_OBJS))
$(Q)$(AR) rD $@ $(sort $(BLIB_OBJS))
$(Q)$(OBJCOPY) --enable-deterministic-archives \
--prefix-symbols=$(SYMBOL_PREFIX) $@
$(Q)$(RANLIB) -D $@
-1
View File
@@ -9,5 +9,4 @@ INCDIRS += arch/arm/include
# ARM-specific directories containing source files
#
SRCDIRS += arch/arm/core
SRCDIRS += arch/arm/interface/efi
+3 -4
View File
@@ -46,7 +46,7 @@ union arm32_io_qword {
*
* This is not atomic for ARM32.
*/
static __unused uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
static uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
volatile union arm32_io_qword *ptr =
container_of ( io_addr, union arm32_io_qword, qword );
union arm32_io_qword tmp;
@@ -64,8 +64,7 @@ static __unused uint64_t arm32_readq ( volatile uint64_t *io_addr ) {
*
* This is not atomic for ARM32.
*/
static __unused void arm32_writeq ( uint64_t data,
volatile uint64_t *io_addr ) {
static void arm32_writeq ( uint64_t data, volatile uint64_t *io_addr ) {
volatile union arm32_io_qword *ptr =
container_of ( io_addr, union arm32_io_qword, qword );
union arm32_io_qword tmp;
@@ -83,6 +82,7 @@ PROVIDE_IOAPI_INLINE ( arm, readl );
PROVIDE_IOAPI_INLINE ( arm, writeb );
PROVIDE_IOAPI_INLINE ( arm, writew );
PROVIDE_IOAPI_INLINE ( arm, writel );
PROVIDE_IOAPI_INLINE ( arm, iodelay );
PROVIDE_IOAPI_INLINE ( arm, mb );
#ifdef __aarch64__
PROVIDE_IOAPI_INLINE ( arm, readq );
@@ -91,4 +91,3 @@ PROVIDE_IOAPI_INLINE ( arm, writeq );
PROVIDE_IOAPI ( arm, readq, arm32_readq );
PROVIDE_IOAPI ( arm, writeq, arm32_writeq );
#endif
PROVIDE_DUMMY_PIO ( arm );
+2
View File
@@ -9,4 +9,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/io.h>
#endif /* _BITS_PCI_IO_H */
+49 -5
View File
@@ -15,8 +15,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define IOAPI_PREFIX_arm __arm_
#endif
#include <ipxe/dummy_pio.h>
/*
* Memory space mappings
*
@@ -79,6 +77,55 @@ ARM_WRITEX ( w, uint16_t, "h", "" );
ARM_WRITEX ( l, uint32_t, "", "" );
#endif
/*
* Dummy PIO reads and writes up to 32 bits
*
* There is no common standard for I/O-space access for ARM, and
* non-MMIO peripherals are vanishingly rare. Provide dummy
* implementations that will allow code to link and should cause
* drivers to simply fail to detect hardware at runtime.
*
*/
#define ARM_INX( _suffix, _type ) \
static inline __always_inline _type \
IOAPI_INLINE ( arm, in ## _suffix ) ( volatile _type *io_addr __unused) { \
return ~( (_type) 0 ); \
} \
static inline __always_inline void \
IOAPI_INLINE ( arm, ins ## _suffix ) ( volatile _type *io_addr __unused, \
_type *data, unsigned int count ) { \
memset ( data, 0xff, count * sizeof ( *data ) ); \
}
ARM_INX ( b, uint8_t );
ARM_INX ( w, uint16_t );
ARM_INX ( l, uint32_t );
#define ARM_OUTX( _suffix, _type ) \
static inline __always_inline void \
IOAPI_INLINE ( arm, out ## _suffix ) ( _type data __unused, \
volatile _type *io_addr __unused ) { \
/* Do nothing */ \
} \
static inline __always_inline void \
IOAPI_INLINE ( arm, outs ## _suffix ) ( volatile _type *io_addr __unused, \
const _type *data __unused, \
unsigned int count __unused ) { \
/* Do nothing */ \
}
ARM_OUTX ( b, uint8_t );
ARM_OUTX ( w, uint16_t );
ARM_OUTX ( l, uint32_t );
/*
* Slow down I/O
*
*/
static inline __always_inline void
IOAPI_INLINE ( arm, iodelay ) ( void ) {
/* Nothing to do */
}
/*
* Memory barrier
*
@@ -93,7 +140,4 @@ IOAPI_INLINE ( arm, mb ) ( void ) {
#endif
}
/* Dummy PIO */
DUMMY_PIO ( arm );
#endif /* _IPXE_ARM_IO_H */
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", %progbits
.text
/* Must match jmp_buf structure layout */
-1
View File
@@ -9,7 +9,6 @@
* Interrupt handlers
****************************************************************************
*/
.section ".note.GNU-stack", "", @progbits
.section ".text", "ax", @progbits
.code32
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code32
-1
View File
@@ -1,4 +1,3 @@
.section ".note.GNU-stack", "", @progbits
.arch i386
.section ".data", "aw", @progbits
-1
View File
@@ -20,7 +20,6 @@ CFLAGS += -fshort-wchar
# LoongArch64-specific directories containing source files
SRCDIRS += arch/loong64/core
SRCDIRS += arch/loong64/interface/efi
# Include platform-specific Makefile
MAKEDEPS += arch/loong64/Makefile.$(PLATFORM)
-14
View File
@@ -1,14 +0,0 @@
# -*- makefile -*- : Force emacs to use Makefile mode
# Specify EFI image builder
#
ELF2EFI = $(ELF2EFI64)
# Specify EFI boot file
#
EFI_BOOT_FILE = bootloongarch64.efi
# Include generic EFI Makefile
#
MAKEDEPS += Makefile.efi
include Makefile.efi
-46
View File
@@ -1,46 +0,0 @@
/*
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/io.h>
#include <ipxe/loong64_io.h>
/** @file
*
* iPXE I/O API for LoongArch64
*
*/
PROVIDE_IOAPI_INLINE ( loong64, phys_to_bus );
PROVIDE_IOAPI_INLINE ( loong64, bus_to_phys );
PROVIDE_IOAPI_INLINE ( loong64, readb );
PROVIDE_IOAPI_INLINE ( loong64, readw );
PROVIDE_IOAPI_INLINE ( loong64, readl );
PROVIDE_IOAPI_INLINE ( loong64, readq );
PROVIDE_IOAPI_INLINE ( loong64, writeb );
PROVIDE_IOAPI_INLINE ( loong64, writew );
PROVIDE_IOAPI_INLINE ( loong64, writel );
PROVIDE_IOAPI_INLINE ( loong64, writeq );
PROVIDE_IOAPI_INLINE ( loong64, mb );
PROVIDE_DUMMY_PIO ( loong64 );
-2
View File
@@ -12,6 +12,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** Page shift */
#define PAGE_SHIFT 12
#include <ipxe/loong64_io.h>
#endif /* _BITS_IO_H */
+1 -3
View File
@@ -9,6 +9,4 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/efi/efiloong64_nap.h>
#endif /* _BITS_NAP_H */
#endif /* _BITS_MAP_H */
@@ -1,18 +0,0 @@
#ifndef _IPXE_EFILOONG64_NAP_H
#define _IPXE_EFILOONG64_NAP_H
/** @file
*
* EFI CPU sleeping
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifdef NAP_EFILOONG64
#define NAP_PREFIX_efiloong64
#else
#define NAP_PREFIX_efiloong64 __efiloong64_
#endif
#endif /* _IPXE_EFILOONG64_NAP_H */
@@ -1,82 +0,0 @@
#ifndef _IPXE_LOONG64_IO_H
#define _IPXE_LOONG64_IO_H
/** @file
*
* iPXE I/O API for LoongArch64
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifdef IOAPI_LOONG64
#define IOAPI_PREFIX_loong64
#else
#define IOAPI_PREFIX_loong64 __loong64_
#endif
#include <ipxe/dummy_pio.h>
/*
* Memory space mappings
*
*/
/*
* Physical<->Bus address mappings
*
*/
static inline __always_inline unsigned long
IOAPI_INLINE ( loong64, phys_to_bus ) ( unsigned long phys_addr ) {
return phys_addr;
}
static inline __always_inline unsigned long
IOAPI_INLINE ( loong64, bus_to_phys ) ( unsigned long bus_addr ) {
return bus_addr;
}
/*
* MMIO reads and writes up to native word size
*
*/
#define LOONG64_READX( _suffix, _type, _insn_suffix ) \
static inline __always_inline _type \
IOAPI_INLINE ( loong64, read ## _suffix ) ( volatile _type *io_addr ) { \
_type data; \
__asm__ __volatile__ ( "ld." _insn_suffix " %0, %1" \
: "=r" ( data ) : "m" ( *io_addr ) ); \
return data; \
}
LOONG64_READX ( b, uint8_t, "bu");
LOONG64_READX ( w, uint16_t, "hu");
LOONG64_READX ( l, uint32_t, "wu");
LOONG64_READX ( q, uint64_t, "d");
#define LOONG64_WRITEX( _suffix, _type, _insn_suffix ) \
static inline __always_inline void \
IOAPI_INLINE ( loong64, write ## _suffix ) ( _type data, \
volatile _type *io_addr ) { \
__asm__ __volatile__ ( "st." _insn_suffix " %0, %1" \
: : "r" ( data ), "m" ( *io_addr ) ); \
}
LOONG64_WRITEX ( b, uint8_t, "b");
LOONG64_WRITEX ( w, uint16_t, "h");
LOONG64_WRITEX ( l, uint32_t, "w" );
LOONG64_WRITEX ( q, uint64_t, "d");
/*
* Memory barrier
*
*/
static inline __always_inline void
IOAPI_INLINE ( loong64, mb ) ( void ) {
__asm__ __volatile__ ( "dbar 0" );
}
/* Dummy PIO */
DUMMY_PIO ( loong64 );
#endif /* _IPXE_LOONG64_IO_H */
@@ -1,53 +0,0 @@
/*
* Copyright (c) 2023, Xiaotian Wu <wuxiaotian@loongson.cn>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/nap.h>
#include <ipxe/efi/efi.h>
/** @file
*
* iPXE CPU sleeping API for EFI
*
*/
/**
* Sleep until next interrupt
*
*/
static void efiloong64_cpu_nap ( void ) {
/*
* I can't find any EFI API that allows us to put the CPU to
* sleep. The CpuSleep() function is defined in CpuLib.h, but
* isn't part of any exposed protocol so we have no way to
* call it.
*
* The EFI shell doesn't seem to bother sleeping the CPU; it
* just sits there idly burning power.
*
*/
__asm__ __volatile__ ( "idle 0" );
}
PROVIDE_NAP ( efiloong64, cpu_nap, efiloong64_cpu_nap );
+2 -15
View File
@@ -13,13 +13,6 @@ LDSCRIPT_PREFIX = arch/x86/scripts/prefixonly.lds
#
LDFLAGS += -N --no-check-sections
# Do not warn about RWX segments (required by most prefixes)
#
WRWX_TEST = $(LD) --warn-rwx-segments --version 2>&1 > /dev/null
WRWX_FLAGS := $(shell [ -z "`$(WRWX_TEST)`" ] && \
$(ECHO) '--no-warn-rwx-segments')
LDFLAGS += $(WRWX_FLAGS)
# Media types.
#
MEDIA += rom
@@ -61,15 +54,9 @@ LIST_NAME_mrom := ROMS
LIST_NAME_pcirom := ROMS
LIST_NAME_isarom := ROMS
# ISO images
# ISO or FAT filesystem images
NON_AUTO_MEDIA += iso
$(BIN)/%.iso : $(BIN)/%.lkrn util/genfsimg
$(QM)$(ECHO) " [GENFSIMG] $@"
$(Q)util/genfsimg -o $@ $<
# FAT filesystem images (via syslinux)
NON_AUTO_MEDIA += sdsk
$(BIN)/%.sdsk : $(BIN)/%.lkrn util/genfsimg
$(BIN)/%.iso $(BIN)/%.sdsk: $(BIN)/%.lkrn util/genfsimg
$(QM)$(ECHO) " [GENFSIMG] $@"
$(Q)util/genfsimg -o $@ $<
-1
View File
@@ -22,7 +22,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.arch i386
#ifdef __x86_64__
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.arch i386
/****************************************************************************
-1
View File
@@ -10,7 +10,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
#define PIC1_ICR 0x20
#define PIC2_ICR 0xa0
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
@@ -23,7 +23,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
-1
View File
@@ -26,7 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
.arch i386
/****************************************************************************
@@ -21,7 +21,6 @@ FILE_LICENCE ( GPL2_OR_LATER )
#include "librm.h"
.section ".note.GNU-stack", "", @progbits
.text
.code32
-1
View File
@@ -5,7 +5,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define STACK_SEG 0x0200
#define STACK_SIZE 0x2000
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.section ".prefix", "awx", @progbits
-1
View File
@@ -24,7 +24,6 @@ FILE_LICENCE ( GPL2_ONLY )
.equ SYSSEG, 0x1000 /* system loaded at SYSSEG<<4 */
.section ".note.GNU-stack", "", @progbits
.org 0
.arch i386
.text
-1
View File
@@ -36,7 +36,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define PSP_CMDLINE_LEN 0x80
#define PSP_CMDLINE_START 0x81
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.org 0
-1
View File
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.section ".prefix", "awx", @progbits
-1
View File
@@ -26,7 +26,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
.arch i386
/* Image compression enabled */
-1
View File
@@ -4,7 +4,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define BZI_LOAD_HIGH_ADDR 0x100000
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.section ".prefix", "awx", @progbits
-1
View File
@@ -41,7 +41,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define _pcirom_start _mrom_start
#include "pciromprefix.S"
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
-1
View File
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.code16
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.org 0
.text
.arch i386
-1
View File
@@ -11,7 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define PXE_HACK_EB54 0x0001
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.org 0
-1
View File
@@ -8,7 +8,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.org 0
-1
View File
@@ -54,7 +54,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define BUSTYPE "PCIR"
#endif
.section ".note.GNU-stack", "", @progbits
.text
.code16
.arch i386
-1
View File
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <librm.h>
.section ".note.GNU-stack", "", @progbits
.text
.code16
.arch i386
-1
View File
@@ -43,7 +43,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
****************************************************************************
*/
.section ".note.GNU-stack", "", @progbits
.text
.arch i486
.section ".prefix.lib", "ax", @progbits
-1
View File
@@ -2,7 +2,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#include <config/console.h>
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.section ".prefix", "awx", @progbits
-1
View File
@@ -24,7 +24,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.arch i386
/****************************************************************************
-1
View File
@@ -31,7 +31,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
/* Breakpoint for when debugging under bochs */
#define BOCHSBP xchgw %bx, %bx
.section ".note.GNU-stack", "", @progbits
.text
.arch i386
.section ".text16", "awx", @progbits
-2
View File
@@ -83,8 +83,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
#define if64 if 0
#endif
.section ".note.GNU-stack", "", @progbits
/****************************************************************************
* Global descriptor table
*
-1
View File
@@ -38,7 +38,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define SIGFPE 8
#define SIGSTKFLT 16
.section ".note.GNU-stack", "", @progbits
.section ".text.gdbmach_interrupt", "ax", @progbits
.code64
-1
View File
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
.section ".note.GNU-stack", "", @progbits
.text
.code64
-5
View File
@@ -67,9 +67,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define IMAGE_GZIP /* GZIP image support */
#endif
#if defined ( __loongarch__ )
#define IOAPI_LOONG64
#define NAP_EFILOONG64
#endif
#endif /* CONFIG_DEFAULTS_EFI_H */
-1
View File
@@ -285,7 +285,6 @@ void intf_shutdown ( struct interface *intf, int rc ) {
intf_nullify ( intf );
/* Transfer destination to temporary interface */
intf_temp_init ( &tmp, intf );
tmp.dest = intf->dest;
intf->dest = &null_intf;
+1 -14
View File
@@ -28,7 +28,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
#include <ipxe/netdevice.h>
@@ -36,7 +35,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/settings.h>
#include <ipxe/params.h>
#include <ipxe/timer.h>
#include <ipxe/keys.h>
#include <ipxe/parseopt.h>
#include <config/branding.h>
@@ -215,7 +213,6 @@ int parse_flag ( char *text __unused, int *flag ) {
* @ret rc Return status code
*/
int parse_key ( char *text, unsigned int *key ) {
int rc;
/* Interpret single characters as being a literal key character */
if ( text[0] && ! text[1] ) {
@@ -224,17 +221,7 @@ int parse_key ( char *text, unsigned int *key ) {
}
/* Otherwise, interpret as an integer */
if ( ( rc = parse_integer ( text, key ) ) < 0 )
return rc;
/* For backwards compatibility with existing scripts, treat
* integers between the ASCII range and special key range as
* being relative special key values.
*/
if ( ( ! isascii ( *key ) ) && ( *key < KEY_MIN ) )
*key += KEY_MIN;
return 0;
return parse_integer ( text, key );
}
/**
+1 -2
View File
@@ -60,7 +60,7 @@ static struct xfer_metadata dummy_metadata;
* @ret rc Return status code
*/
int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
struct interface tmp;
struct interface tmp = INTF_INIT ( null_intf_desc );
struct interface *dest;
xfer_vredirect_TYPE ( void * ) *op =
intf_get_dest_op_no_passthru ( intf, xfer_vredirect, &dest );
@@ -85,7 +85,6 @@ int xfer_vredirect ( struct interface *intf, int type, va_list args ) {
* If redirection fails, then send intf_close() to the
* parent interface.
*/
intf_temp_init ( &tmp, intf );
intf_plug ( &tmp, dest );
rc = xfer_vreopen ( dest, type, args );
if ( rc == 0 ) {
+1 -1
View File
@@ -300,9 +300,9 @@ static int af_packet_nic_probe ( struct linux_device *device,
return 0;
err_settings:
unregister_netdev(netdev);
err_register:
err_settings:
netdev_nullify(netdev);
netdev_put(netdev);
return rc;
+1 -6
View File
@@ -56,10 +56,6 @@ struct tap_nic {
int fd;
};
/** Default MAC address */
static const uint8_t tap_default_mac[ETH_ALEN] =
{ 0x52, 0x54, 0x00, 0x12, 0x34, 0x56 };
/** Open the TAP device */
static int tap_open(struct net_device * netdev)
{
@@ -206,7 +202,6 @@ static int tap_probe(struct linux_device *device, struct linux_device_request *r
nic = netdev->priv;
linux_set_drvdata(device, netdev);
netdev->dev = &device->dev;
memcpy ( netdev->hw_addr, tap_default_mac, ETH_ALEN );
memset(nic, 0, sizeof(*nic));
/* Look for the mandatory if setting */
@@ -236,9 +231,9 @@ static int tap_probe(struct linux_device *device, struct linux_device_request *r
return 0;
err_settings:
unregister_netdev(netdev);
err_register:
err_settings:
netdev_nullify(netdev);
netdev_put(netdev);
return rc;
+5 -5
View File
@@ -1032,9 +1032,8 @@ static void nii_poll_tx ( struct net_device *netdev, unsigned int stat ) {
if ( stat & PXE_STATFLAGS_GET_STATUS_NO_TXBUFS_WRITTEN )
return;
/* Ignore spurious completions reported by some devices */
if ( ! nii->txbuf )
return;
/* Sanity check */
assert ( nii->txbuf != NULL );
/* Complete transmission */
iobuf = nii->txbuf;
@@ -1132,7 +1131,7 @@ static void nii_poll ( struct net_device *netdev ) {
/* Get status */
op = NII_OP ( PXE_OPCODE_GET_STATUS,
( PXE_OPFLAGS_GET_INTERRUPT_STATUS |
PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS |
( nii->txbuf ? PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS : 0)|
( nii->media ? PXE_OPFLAGS_GET_MEDIA_STATUS : 0 ) ) );
if ( ( stat = nii_issue_db ( nii, op, &db, sizeof ( db ) ) ) < 0 ) {
rc = -EIO_STAT ( stat );
@@ -1142,7 +1141,8 @@ static void nii_poll ( struct net_device *netdev ) {
}
/* Process any TX completions */
nii_poll_tx ( netdev, stat );
if ( nii->txbuf )
nii_poll_tx ( netdev, stat );
/* Process any RX completions */
nii_poll_rx ( netdev );
-11
View File
@@ -9,17 +9,6 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Check if character is ASCII
*
* @v character Character
* @ret is_ascii Character is an ASCII character
*/
static inline int isascii ( int character ) {
return ( character <= '\x7f' );
}
/**
* Check if character is a decimal digit
*
-64
View File
@@ -1,64 +0,0 @@
#ifndef _IPXE_DUMMY_PIO_H
#define _IPXE_DUMMY_PIO_H
/** @file
*
* Dummy PIO reads and writes up to 32 bits
*
* There is no common standard for I/O-space access for non-x86 CPU
* families, and non-MMIO peripherals are vanishingly rare. Provide
* dummy implementations that will allow code to link and should cause
* drivers to simply fail to detect hardware at runtime.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define DUMMY_INX( _prefix, _suffix, _type ) \
static inline __always_inline _type \
IOAPI_INLINE ( _prefix, in ## _suffix ) ( volatile _type *io_addr __unused) { \
return ~( (_type) 0 ); \
} \
static inline __always_inline void \
IOAPI_INLINE ( _prefix, ins ## _suffix ) ( volatile _type *io_addr __unused, \
_type *data, unsigned int count ) {\
memset ( data, 0xff, count * sizeof ( *data ) ); \
}
#define DUMMY_OUTX( _prefix, _suffix, _type ) \
static inline __always_inline void \
IOAPI_INLINE ( _prefix, out ## _suffix ) ( _type data __unused, \
volatile _type *io_addr __unused ){\
/* Do nothing */ \
} \
static inline __always_inline void \
IOAPI_INLINE ( _prefix, outs ## _suffix ) ( volatile _type *io_addr __unused, \
const _type *data __unused, \
unsigned int count __unused ) { \
/* Do nothing */ \
}
#define DUMMY_IODELAY( _prefix ) \
static inline __always_inline void \
IOAPI_INLINE ( _prefix, iodelay ) ( void ) { \
/* Nothing to do */ \
}
#define DUMMY_PIO( _prefix ) \
DUMMY_INX ( _prefix, b, uint8_t ); \
DUMMY_INX ( _prefix, w, uint16_t ); \
DUMMY_INX ( _prefix, l, uint32_t ); \
DUMMY_OUTX ( _prefix, b, uint8_t ); \
DUMMY_OUTX ( _prefix, w, uint16_t ); \
DUMMY_OUTX ( _prefix, l, uint32_t ); \
DUMMY_IODELAY ( _prefix );
#define PROVIDE_DUMMY_PIO( _prefix ) \
PROVIDE_IOAPI_INLINE ( _prefix, inb ); \
PROVIDE_IOAPI_INLINE ( _prefix, inw ); \
PROVIDE_IOAPI_INLINE ( _prefix, inl ); \
PROVIDE_IOAPI_INLINE ( _prefix, outb ); \
PROVIDE_IOAPI_INLINE ( _prefix, outw ); \
PROVIDE_IOAPI_INLINE ( _prefix, outl ); \
PROVIDE_IOAPI_INLINE ( _prefix, iodelay );
#endif /* _IPXE_DUMMY_PIO_H */
+17 -57
View File
@@ -133,30 +133,17 @@ struct interface {
struct interface *dest;
/** Reference counter
*
* If this interface is not part of a reference-counted object
* then this field is NULL.
* If this interface is not part of a reference-counted
* object, this field may be NULL.
*/
struct refcnt *refcnt;
/** Interface descriptor
*
* If this is a temporary outbound-only interface created by
* intf_temp_init() then this field is NULL.
*/
/** Interface descriptor */
struct interface_descriptor *desc;
/** Original interface properties */
union {
/** Original interface descriptor
*
* Used by intf_reinit().
*/
struct interface_descriptor *desc;
/** Original interface
*
* Used for temporary outbound-only interfaces created
* by intf_temp_init().
*/
struct interface *intf;
} original;
/** Original interface descriptor
*
* Used by intf_reinit().
*/
struct interface_descriptor *original;
};
extern void intf_plug ( struct interface *intf, struct interface *dest );
@@ -206,7 +193,7 @@ static inline void intf_init ( struct interface *intf,
intf->dest = &null_intf;
intf->refcnt = refcnt;
intf->desc = desc;
intf->original.desc = desc;
intf->original = desc;
}
/**
@@ -214,38 +201,13 @@ static inline void intf_init ( struct interface *intf,
*
* @v descriptor Object interface descriptor
*/
#define INTF_INIT( descriptor ) { \
.dest = &null_intf, \
.refcnt = NULL, \
.desc = &(descriptor), \
.original = { \
.desc = &(descriptor), \
}, \
#define INTF_INIT( descriptor ) { \
.dest = &null_intf, \
.refcnt = NULL, \
.desc = &(descriptor), \
.original = &(descriptor), \
}
/**
* Initialise a temporary outbound-only object interface
*
* @v intf Temporary outbound-only object interface
* @v original Original object interface
*/
static inline void intf_temp_init ( struct interface *intf,
struct interface *original ) {
intf->dest = &null_intf;
intf->desc = NULL;
intf->original.intf = original;
}
/**
* Get original interface
*
* @v intf Object interface (possibly a temporary interface)
* @ret intf Original object interface
*/
static inline struct interface * intf_origin ( struct interface *intf ) {
return ( intf->desc ? intf : intf->original.intf );
}
/**
* Get object interface destination and operation method (without pass-through)
*
@@ -278,7 +240,7 @@ static inline struct interface * intf_origin ( struct interface *intf ) {
*
* Use as the first argument to DBGC() or equivalent macro.
*/
#define INTF_COL( intf ) intf_object ( intf_origin ( intf ) )
#define INTF_COL( intf ) intf_object ( intf )
/** printf() format string for INTF_DBG() */
#define INTF_FMT "%p+%zx"
@@ -289,9 +251,7 @@ static inline struct interface * intf_origin ( struct interface *intf ) {
* @v intf Object interface
* @ret args printf() argument list corresponding to INTF_FMT
*/
#define INTF_DBG( intf ) \
intf_object ( intf_origin ( intf ) ), \
intf_origin ( intf )->desc->offset
#define INTF_DBG( intf ) intf_object ( intf ), (intf)->desc->offset
/** printf() format string for INTF_INTF_DBG() */
#define INTF_INTF_FMT INTF_FMT "->" INTF_FMT
@@ -313,7 +273,7 @@ static inline struct interface * intf_origin ( struct interface *intf ) {
static inline void intf_reinit ( struct interface *intf ) {
/* Restore original interface descriptor */
intf->desc = intf->original.desc;
intf->desc = intf->original;
}
#endif /* _IPXE_INTERFACE_H */
+3 -7
View File
@@ -54,9 +54,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* The names are chosen to match those used by curses. The values are
* chosen to facilitate easy conversion from a received ANSI escape
* sequence to a KEY_XXX constant.
*
* Note that the values are exposed to iPXE commands via parse_key()
* and therefore may not be changed without breaking existing scripts.
*/
/**
@@ -68,7 +65,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define KEY_MIN 0x110000
/**
* Construct relative key value for special key
* Construct relative key value
*
* @v key Key value
* @ret rkey Relative key value
@@ -82,8 +79,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @v terminator ANSI escape sequence terminating character
* @ret key Key value
*/
#define KEY_ANSI( n, terminator ) \
( KEY_MIN + ( ( (n) + 1 ) << 8 ) + (terminator) )
#define KEY_ANSI( n, terminator ) ( KEY_MIN + ( (n) << 8 ) + (terminator) )
/**
* Extract ANSI escape sequence numeric portion
@@ -91,7 +87,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @v key Key value (or relative key value)
* @ret n ANSI escape sequence numeric portion, or 0 for none
*/
#define KEY_ANSI_N( key ) ( ( ( (key) >> 8 ) & 0xff ) - 1 )
#define KEY_ANSI_N( key ) ( ( (key) >> 8 ) & 0xff )
/**
* Extract ANSI escape sequence terminating character
+46 -79
View File
@@ -37,8 +37,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
/** A driver veto candidate */
struct efi_veto_candidate {
/** A driver veto */
struct efi_veto {
/** Veto name (for debugging) */
const char *name;
/**
@@ -57,38 +57,22 @@ struct efi_veto_candidate {
const char *manufacturer, const CHAR16 *name );
};
/** A driver veto */
struct efi_veto {
/** Driver binding handle */
EFI_HANDLE driver;
/** Driving binding protocol */
EFI_DRIVER_BINDING_PROTOCOL *binding;
/** Image handle */
EFI_HANDLE image;
/** Loaded image protocol */
EFI_LOADED_IMAGE_PROTOCOL *loaded;
};
/**
* Unload an EFI driver
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_unload ( struct efi_veto *veto ) {
static int efi_veto_unload ( EFI_HANDLE driver ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
EFI_HANDLE image = veto->image;
EFI_STATUS efirc;
int rc;
/* Unload the driver */
if ( ( efirc = bs->UnloadImage ( image ) ) != 0 ) {
if ( ( efirc = bs->UnloadImage ( driver ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( driver, "EFIVETO %s could not unload",
efi_handle_name ( driver ) );
DBGC ( driver, " %s: %s\n", efi_handle_name ( image ),
strerror ( rc ) );
DBGC ( driver, "EFIVETO %s could not unload: %s\n",
efi_handle_name ( driver ), strerror ( rc ) );
return rc;
}
@@ -98,12 +82,11 @@ static int efi_veto_unload ( struct efi_veto *veto ) {
/**
* Disconnect an EFI driver from all handles
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_disconnect ( struct efi_veto *veto ) {
static int efi_veto_disconnect ( EFI_HANDLE driver ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
EFI_HANDLE *handles;
EFI_HANDLE handle;
UINTN count;
@@ -148,12 +131,11 @@ static int efi_veto_disconnect ( struct efi_veto *veto ) {
/**
* Uninstall an EFI driver binding protocol
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_uninstall ( struct efi_veto *veto ) {
static int efi_veto_uninstall ( EFI_HANDLE driver ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
union {
EFI_DRIVER_BINDING_PROTOCOL *binding;
void *interface;
@@ -196,16 +178,14 @@ static int efi_veto_uninstall ( struct efi_veto *veto ) {
/**
* Close protocol on handle potentially opened by an EFI driver
*
* @v veto Driver veto
* @v driver Driver binding handle
* @v handle Potentially opened handle
* @v protocol Opened protocol
* @ret rc Return status code
*/
static int efi_veto_close_protocol ( struct efi_veto *veto, EFI_HANDLE handle,
static int efi_veto_close_protocol ( EFI_HANDLE driver, EFI_HANDLE handle,
EFI_GUID *protocol ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
EFI_HANDLE image = veto->image;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *openers;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *opener;
EFI_HANDLE controller;
@@ -227,11 +207,9 @@ static int efi_veto_close_protocol ( struct efi_veto *veto, EFI_HANDLE handle,
/* Close anything opened by this driver */
for ( i = 0 ; i < count ; i++ ) {
opener = &openers[ count - i - 1 ];
if ( ( opener->AgentHandle != driver ) &&
( opener->AgentHandle != image ) ) {
opener = &openers[i];
if ( opener->AgentHandle != driver )
continue;
}
controller = opener->ControllerHandle;
DBGC_EFI_OPENER ( driver, handle, protocol, opener );
if ( ( efirc = bs->CloseProtocol ( handle, protocol, driver,
@@ -257,15 +235,13 @@ static int efi_veto_close_protocol ( struct efi_veto *veto, EFI_HANDLE handle,
/**
* Close handle potentially opened by an EFI driver
*
* @v veto Driver veto
* @v driver Driver binding handle
* @v handle Potentially opened handle
* @ret rc Return status code
*/
static int efi_veto_close_handle ( struct efi_veto *veto, EFI_HANDLE handle ) {
static int efi_veto_close_handle ( EFI_HANDLE driver, EFI_HANDLE handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
EFI_GUID **protocols;
EFI_GUID *protocol;
UINTN count;
unsigned int i;
EFI_STATUS efirc;
@@ -284,9 +260,8 @@ static int efi_veto_close_handle ( struct efi_veto *veto, EFI_HANDLE handle ) {
/* Close each protocol */
for ( i = 0 ; i < count ; i++ ) {
protocol = protocols[ count - i - 1];
if ( ( rc = efi_veto_close_protocol ( veto, handle,
protocol ) ) != 0 )
if ( ( rc = efi_veto_close_protocol ( driver, handle,
protocols[i] ) ) != 0 )
goto err_close;
}
@@ -302,14 +277,12 @@ static int efi_veto_close_handle ( struct efi_veto *veto, EFI_HANDLE handle ) {
/**
* Close all remaining handles opened by an EFI driver
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_close ( struct efi_veto *veto ) {
static int efi_veto_close ( EFI_HANDLE driver ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE driver = veto->driver;
EFI_HANDLE *handles;
EFI_HANDLE handle;
UINTN count;
unsigned int i;
EFI_STATUS efirc;
@@ -326,8 +299,8 @@ static int efi_veto_close ( struct efi_veto *veto ) {
/* Close each handle */
for ( i = 0 ; i < count ; i++ ) {
handle = handles[ count - i - 1 ];
if ( ( rc = efi_veto_close_handle ( veto, handle ) ) != 0 )
if ( ( rc = efi_veto_close_handle ( driver,
handles[i] ) ) != 0 )
goto err_close;
}
@@ -345,23 +318,22 @@ static int efi_veto_close ( struct efi_veto *veto ) {
/**
* Terminate an EFI driver with extreme prejudice
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_destroy ( struct efi_veto *veto ) {
EFI_HANDLE driver = veto->driver;
static int efi_veto_destroy ( EFI_HANDLE driver ) {
int rc;
/* Disconnect driver from all handles */
if ( ( rc = efi_veto_disconnect ( veto ) ) != 0 )
if ( ( rc = efi_veto_disconnect ( driver ) ) != 0 )
return rc;
/* Uninstall driver binding protocol */
if ( ( rc = efi_veto_uninstall ( veto ) ) != 0 )
if ( ( rc = efi_veto_uninstall ( driver ) ) != 0 )
return rc;
/* Close any remaining opened handles */
if ( ( rc = efi_veto_close ( veto ) ) != 0 )
if ( ( rc = efi_veto_close ( driver ) ) != 0 )
return rc;
DBGC ( driver, "EFIVETO %s forcibly removed\n",
@@ -372,18 +344,18 @@ static int efi_veto_destroy ( struct efi_veto *veto ) {
/**
* Veto an EFI driver
*
* @v veto Driver veto
* @v driver Driver binding handle
* @ret rc Return status code
*/
static int efi_veto_driver ( struct efi_veto *veto ) {
static int efi_veto_driver ( EFI_HANDLE driver ) {
int rc;
/* Try gracefully unloading the driver */
if ( ( rc = efi_veto_unload ( veto ) ) == 0 )
if ( ( rc = efi_veto_unload ( driver ) ) == 0 )
return 0;
/* If that fails, use a hammer */
if ( ( rc = efi_veto_destroy ( veto ) ) == 0 )
if ( ( rc = efi_veto_destroy ( driver ) ) == 0 )
return 0;
return rc;
@@ -495,7 +467,7 @@ efi_veto_vmware_uefipxebc ( EFI_DRIVER_BINDING_PROTOCOL *binding __unused,
}
/** Driver vetoes */
static struct efi_veto_candidate efi_vetoes[] = {
static struct efi_veto efi_vetoes[] = {
{
.name = "Ip4Config",
.veto = efi_veto_ip4config,
@@ -515,11 +487,11 @@ static struct efi_veto_candidate efi_vetoes[] = {
*
* @v driver Driver binding handle
* @v manufacturer Manufacturer name, if present
* @ret veto Driver veto to fill in
* @ret veto Driver veto, or NULL
* @ret rc Return status code
*/
static int efi_veto_find ( EFI_HANDLE driver, const char *manufacturer,
struct efi_veto *veto ) {
struct efi_veto **veto ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
union {
EFI_DRIVER_BINDING_PROTOCOL *binding;
@@ -543,7 +515,7 @@ static int efi_veto_find ( EFI_HANDLE driver, const char *manufacturer,
efi_handle_name ( driver ) );
/* Mark as not vetoed */
memset ( veto, 0, sizeof ( *veto ) );
*veto = NULL;
/* Open driver binding protocol */
if ( ( efirc = bs->OpenProtocol (
@@ -595,13 +567,7 @@ static int efi_veto_find ( EFI_HANDLE driver, const char *manufacturer,
sizeof ( efi_vetoes[0] ) ) ; i++ ) {
if ( efi_vetoes[i].veto ( binding.binding, loaded.loaded,
wtf.wtf, manufacturer, name ) ) {
DBGC ( driver, "EFIVETO %s is vetoed (%s)\n",
efi_handle_name ( driver ),
efi_vetoes[i].name );
veto->driver = driver;
veto->binding = binding.binding;
veto->image = image;
veto->loaded = loaded.loaded;
*veto = &efi_vetoes[i];
break;
}
}
@@ -629,10 +595,10 @@ static int efi_veto_find ( EFI_HANDLE driver, const char *manufacturer,
*/
void efi_veto ( void ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct efi_veto veto;
struct efi_veto *veto;
EFI_HANDLE *drivers;
EFI_HANDLE driver;
UINTN count;
UINTN num_drivers;
unsigned int i;
char *manufacturer;
EFI_STATUS efirc;
@@ -641,7 +607,7 @@ void efi_veto ( void ) {
/* Locate all driver binding protocol handles */
if ( ( efirc = bs->LocateHandleBuffer (
ByProtocol, &efi_driver_binding_protocol_guid,
NULL, &count, &drivers ) ) != 0 ) {
NULL, &num_drivers, &drivers ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( &efi_vetoes, "EFIVETO could not list all drivers: "
"%s\n", strerror ( rc ) );
@@ -651,11 +617,10 @@ void efi_veto ( void ) {
/* Get manufacturer name */
fetch_string_setting_copy ( NULL, &manufacturer_setting,
&manufacturer );
DBGC ( &efi_vetoes, "EFIVETO manufacturer is \"%s\"\n", manufacturer );
/* Unload any vetoed drivers */
for ( i = 0 ; i < count ; i++ ) {
driver = drivers[ count - i - 1 ];
for ( i = 0 ; i < num_drivers ; i++ ) {
driver = drivers[i];
if ( ( rc = efi_veto_find ( driver, manufacturer,
&veto ) ) != 0 ) {
DBGC ( driver, "EFIVETO %s could not determine "
@@ -663,9 +628,11 @@ void efi_veto ( void ) {
efi_handle_name ( driver ), strerror ( rc ) );
continue;
}
if ( ! veto.driver )
if ( ! veto )
continue;
if ( ( rc = efi_veto_driver ( &veto ) ) != 0 ) {
DBGC ( driver, "EFIVETO %s is vetoed (%s)\n",
efi_handle_name ( driver ), veto->name );
if ( ( rc = efi_veto_driver ( driver ) ) != 0 ) {
DBGC ( driver, "EFIVETO %s could not veto: %s\n",
efi_handle_name ( driver ), strerror ( rc ) );
}
+1 -4
View File
@@ -656,7 +656,7 @@ static void free_netdev ( struct refcnt *refcnt ) {
struct net_device *netdev =
container_of ( refcnt, struct net_device, refcnt );
assert ( ! timer_running ( &netdev->link_block ) );
stop_timer ( &netdev->link_block );
netdev_tx_flush ( netdev );
netdev_rx_flush ( netdev );
clear_settings ( netdev_settings ( netdev ) );
@@ -879,9 +879,6 @@ void netdev_close ( struct net_device *netdev ) {
/* Close the device */
netdev->op->close ( netdev );
/* Stop link block timer */
stop_timer ( &netdev->link_block );
/* Flush TX and RX queues */
netdev_tx_flush ( netdev );
netdev_rx_flush ( netdev );
+26 -85
View File
@@ -4,7 +4,6 @@
set -e
set -u
set -x
# Print usage message
#
@@ -18,58 +17,28 @@ help() {
echo " -s SCRIPT use executable script"
}
# Get big-endian hex value from binary file
#
get_be() {
local FILENAME
local OFFSET
local LEN
FILENAME="${1}"
OFFSET="${2}"
LEN="${3}"
od -j "${OFFSET}" -N "${LEN}" -A n -t x1 -- "${FILENAME}" | tr -d " "
}
# Get little-endian hex value from binary file
#
get_le() {
local FILENAME
local OFFSET
local LEN
local BYTE
local VALUE
FILENAME="${1}"
OFFSET="${2}"
LEN="${3}"
VALUE=""
while [ "${LEN}" -gt 0 ] ; do
LEN=$(( "${LEN}" - 1 ))
BYTE=$(get_be "${FILENAME}" $(( "${OFFSET}" + "${LEN}" )) 1)
VALUE="${VALUE}${BYTE}"
done
echo "${VALUE}"
}
# Get hex byte from binary file
#
get_byte() {
get_be "${1}" "${2}" 1
local FILENAME
local OFFSET
FILENAME="${1}"
OFFSET="${2}"
od -j "${OFFSET}" -N 1 -A n -t x1 -- "${FILENAME}" | tr -d " "
}
# Get little-endian hex word from binary file
# Get hex word from binary file
#
get_word() {
get_le "${1}" "${2}" 2
}
local FILENAME
local OFFSET
# Get little-endian hex dword from binary file
#
get_dword() {
get_le "${1}" "${2}" 4
FILENAME="${1}"
OFFSET="${2}"
od -j "${OFFSET}" -N 2 -A n -t x1 -- "${FILENAME}" | tr -d " "
}
# Get appropriate EFI boot filename for CPU architecture
@@ -82,31 +51,31 @@ efi_boot_name() {
FILENAME="${1}"
MZSIG=$(get_word "${FILENAME}" 0)
if [ "${MZSIG}" != "5a4d" ] ; then
if [ "${MZSIG}" != "4d5a" ] ; then
echo "${FILENAME}: invalid MZ header" >&2
exit 1
fi
PEOFF=$(get_byte "${FILENAME}" 0x3c)
PESIG=$(get_word "${FILENAME}" 0x${PEOFF})
if [ "${PESIG}" != "4550" ] ; then
if [ "${PESIG}" != "5045" ] ; then
echo "${FILENAME}: invalid PE header" >&2
exit 1
fi
ARCH=$(get_word "${FILENAME}" $(( 0x${PEOFF} + 4 )) )
case "${ARCH}" in
"014c" )
"4c01" )
echo "BOOTIA32.EFI"
;;
"8664" )
"6486" )
echo "BOOTX64.EFI"
;;
"01c2" )
"c201" )
echo "BOOTARM.EFI"
;;
"6264" )
"6462" )
echo "BOOTLOONGARCH64.EFI"
;;
"aa64" )
"64aa" )
echo "BOOTAA64.EFI"
;;
* )
@@ -148,28 +117,6 @@ copy_syslinux_file() {
return 1
}
# Create EFI boot partition
#
create_esp() {
local FILENAME
local BOOTCAT
local PLATFORM
local START
local COUNT
FILENAME="${1}"
BOOTCAT=$(( 0x$(get_dword "${FILENAME}" 0x8847) * 0x800 ))
PLATFORM=$(get_byte "${FILENAME}" $(( ${BOOTCAT} + 0x01 )) )
if [ "${PLATFORM}" != "ef" ] ; then
echo "${FILENAME}: missing EFI boot catalog" >&2
exit 1
fi
START=$(( 0x$(get_dword "${FILENAME}" $(( ${BOOTCAT} + 0x28 )) ) * 4 ))
COUNT=$(( 0x$(get_word "${FILENAME}" $(( ${BOOTCAT} + 0x26 )) ) * 4 ))
echo "${START},${COUNT},0xef;" | sfdisk -f -w never "${FILENAME}"
}
# Parse command-line options
#
OUTFILE=
@@ -287,17 +234,12 @@ done
#
if [ -n "${ISOIMG}" ] ; then
ISOARGS="-J -R -l"
if [ -n "${LKRN}" ] ; then
copy_syslinux_file "isolinux.bin" "${ISODIR}"
copy_syslinux_file "ldlinux.c32" "${ISODIR}" 2>/dev/null || true
ISOARGS="${ISOARGS} -no-emul-boot -eltorito-boot isolinux.bin"
ISOARGS="${ISOARGS} -boot-load-size 4 -boot-info-table"
fi
if [ -n "${LKRN}" -a -n "${EFI}" ] ; then
ISOARGS="${ISOARGS} -eltorito-alt-boot"
fi
copy_syslinux_file "isolinux.bin" "${ISODIR}"
copy_syslinux_file "ldlinux.c32" "${ISODIR}" 2>/dev/null || true
ISOARGS="${ISOARGS} -no-emul-boot -eltorito-boot isolinux.bin"
ISOARGS="${ISOARGS} -boot-load-size 4 -boot-info-table"
if [ -n "${EFI}" ] ; then
ISOARGS="${ISOARGS} -no-emul-boot -e esp.img"
ISOARGS="${ISOARGS} -eltorito-alt-boot -no-emul-boot -e esp.img"
else
FATIMG=
fi
@@ -367,7 +309,6 @@ if [ -n "${ISOIMG}" ] ; then
-appid "iPXE - Open Source Network Boot Firmware" \
-publisher "ipxe.org" -sysid "iPXE" -o "${ISOIMG}" \
${ISOARGS} "${ISODIR}"
create_esp "${ISOIMG}"
if isohybrid --version >/dev/null 2>&1 ; then
ISOHYBRIDARGS=
if [ -n "${EFI}" ] ; then