:p
atchew
Login
Hi all, This series improved SeaBIOS build system in various aspects. Most notably, it makes cross compiling on MacOS Arm64 with x86_64-elf- toolchain possible. It also fixed various issues exposed when I was trying to clang build work. Although I eventually give up. Thanks Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Jiaxun Yang (7): Remove remaining ACPI tooling bits Makefile: Don't use $(CC) as default hostcc Makefile: Invoke AS, CPP and LD via CC Makefile: Allow more linux style knobs asm-offset: Refresh definations from Linux scripts: Use python3 as python Clear clang warnings Makefile | 47 ++--- scripts/acpi_extract.py | 366 ------------------------------------- scripts/acpi_extract_preprocess.py | 41 ----- scripts/buildrom.py | 2 +- scripts/buildversion.py | 2 +- scripts/checkrom.py | 2 +- scripts/checkstack.py | 2 +- scripts/checksum.py | 2 +- scripts/encodeint.py | 2 +- scripts/gen-offsets.sh | 7 +- scripts/kconfig/Makefile | 6 +- scripts/layoutrom.py | 2 +- scripts/ldnoexec.py | 2 +- scripts/readserial.py | 2 +- scripts/test-build.sh | 12 +- scripts/transdump.py | 2 +- scripts/vgafixup.py | 2 +- src/gen-defs.h | 8 +- src/hw/serialio.c | 1 + src/hw/usb-ohci.c | 2 +- src/hw/virtio-blk.c | 2 +- src/std/LegacyBios.h | 4 +- 22 files changed, 59 insertions(+), 459 deletions(-) --- base-commit: 9029a010ec413e6c3c0eb52c29c252a5b9a9f774 change-id: 20250528-build-eb5b4a8830b7 Best regards, -- Jiaxun Yang <jiaxun.yang@flygoat.com> _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Builtin ACPI support was removed before. Now clean remaining tooling bits. Fixes: a2725e2814f0 ("drop acpi tables and hex includes") Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 3 +- scripts/acpi_extract.py | 366 ------------------------------------- scripts/acpi_extract_preprocess.py | 41 ----- 3 files changed, 1 insertion(+), 409 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip PYTHON=python CPP=cpp -IASL:=iasl LD32BIT_FLAG:=-melf_i386 # Source files @@ -XXX,XX +XXX,XX @@ all: $(target-y) ################ Common build rules # Verify the build environment works. -TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" IASL="$(IASL)" scripts/test-build.sh) +TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" scripts/test-build.sh) ifeq "$(TESTGCC)" "-1" $(error "Please upgrade the build environment") endif diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py deleted file mode 100755 index XXXXXXX..XXXXXXX --- a/scripts/acpi_extract.py +++ /dev/null @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> -# -# This file may be distributed under the terms of the GNU GPLv3 license. - -# Process mixed ASL/AML listing (.lst file) produced by iasl -l -# Locate and execute ACPI_EXTRACT directives, output offset info -# -# Documentation of ACPI_EXTRACT_* directive tags: -# -# These directive tags output offset information from AML for BIOS runtime -# table generation. -# Each directive is of the form: -# ACPI_EXTRACT_<TYPE> <array_name> <Operator> (...) -# and causes the extractor to create an array -# named <array_name> with offset, in the generated AML, -# of an object of a given type in the following <Operator>. -# -# A directive must fit on a single code line. -# -# Object type in AML is verified, a mismatch causes a build failure. -# -# Directives and operators currently supported are: -# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name() -# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name() -# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name() -# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method() -# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name() -# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block -# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor() -# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1 -# ACPI_EXTRACT_DEVICE_START - start of Device() block -# ACPI_EXTRACT_DEVICE_STRING - extract a NameString from Device() -# ACPI_EXTRACT_DEVICE_END - offset at last byte of Device() + 1 -# ACPI_EXTRACT_PKG_START - start of Package block -# -# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode -# -# ACPI_EXTRACT is not allowed anywhere else in code, except in comments. - -import re -import sys -import fileinput - -aml = [] -asl = [] -output = {} -debug = "" - -class asl_line: - line = None - lineno = None - aml_offset = None - -def die(diag): - sys.stderr.write("Error: %s; %s\n" % (diag, debug)) - sys.exit(1) - -#Store an ASL command, matching AML offset, and input line (for debugging) -def add_asl(lineno, line): - l = asl_line() - l.line = line - l.lineno = lineno - l.aml_offset = len(aml) - asl.append(l) - -#Store an AML byte sequence -#Verify that offset output by iasl matches # of bytes so far -def add_aml(offset, line): - o = int(offset, 16) - # Sanity check: offset must match size of code so far - if (o != len(aml)): - die("Offset 0x%x != 0x%x" % (o, len(aml))) - # Strip any trailing dots and ASCII dump after " - line = re.sub(r'\s*\.*\s*".*$', "", line) - # Strip traling whitespace - line = re.sub(r'\s+$', "", line) - # Strip leading whitespace - line = re.sub(r'^\s+', "", line) - # Split on whitespace - code = re.split(r'\s+', line) - for c in code: - # Require a legal hex number, two digits - if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))): - die("Unexpected octet %s" % c) - aml.append(int(c, 16)) - -# Process aml bytecode array, decoding AML -def aml_pkglen_bytes(offset): - # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes. - pkglenbytes = aml[offset] >> 6 - return pkglenbytes + 1 - -def aml_pkglen(offset): - pkgstart = offset - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml[offset] & 0x3F - # If multibyte, first nibble only uses bits 0-3 - if ((pkglenbytes > 1) and (pkglen & 0x30)): - die("PkgLen bytes 0x%x but first nibble 0x%x expected 0x0X" % - (pkglen, pkglen)) - offset += 1 - pkglenbytes -= 1 - for i in range(pkglenbytes): - pkglen |= aml[offset + i] << (i * 8 + 4) - if (len(aml) < pkgstart + pkglen): - die("PckgLen 0x%x at offset 0x%x exceeds AML size 0x%x" % - (pkglen, offset, len(aml))) - return pkglen - -# Given method offset, find its NameString offset -def aml_method_string(offset): - #0x14 MethodOp PkgLength NameString MethodFlags TermList - if (aml[offset] != 0x14): - die( "Method offset 0x%x: expected 0x14 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -# Given name offset, find its NameString offset -def aml_name_string(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x08): - die( "Name offset 0x%x: expected 0x08 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - # Block Name Modifier. Skip it. - if (aml[offset] == 0x5c or aml[offset] == 0x5e): - offset += 1 - return offset - -# Given data offset, find 8 byte buffer offset -def aml_data_buffer8(offset): - #0x08 NameOp NameString DataRef - expect = [0x11, 0x0B, 0x0A, 0x08] - if (aml[offset:offset+4] != expect): - die( "Name offset 0x%x: expected %s actual %s" % - (offset, aml[offset:offset+4], expect)) - return offset + len(expect) - -# Given data offset, find dword const offset -def aml_data_dword_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0C): - die( "Name offset 0x%x: expected 0x0C actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Given data offset, find word const offset -def aml_data_word_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0B): - die( "Name offset 0x%x: expected 0x0B actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Given data offset, find byte const offset -def aml_data_byte_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0A): - die( "Name offset 0x%x: expected 0x0A actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Find name'd buffer8 -def aml_name_buffer8(offset): - return aml_data_buffer8(aml_name_string(offset) + 4) - -# Given name offset, find dword const offset -def aml_name_dword_const(offset): - return aml_data_dword_const(aml_name_string(offset) + 4) - -# Given name offset, find word const offset -def aml_name_word_const(offset): - return aml_data_word_const(aml_name_string(offset) + 4) - -# Given name offset, find byte const offset -def aml_name_byte_const(offset): - return aml_data_byte_const(aml_name_string(offset) + 4) - -def aml_device_start(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)): - die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])) - return offset - -def aml_device_string(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_device_end(offset): - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_processor_start(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)): - die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])) - return offset - -def aml_processor_string(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_processor_end(offset): - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_package_start(offset): - offset = aml_name_string(offset) + 4 - # 0x12 PkgLength NumElements PackageElementList - if (aml[offset] != 0x12): - die( "Name offset 0x%x: expected 0x12 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - return offset + aml_pkglen_bytes(offset) + 1 - -def get_value_type(maxvalue): - #Use type large enough to fit the table - if (maxvalue >= 0x10000): - return "int" - elif (maxvalue >= 0x100): - return "short" - else: - return "char" - -def main(): - global debug - lineno = 0 - for line in fileinput.input(): - # Strip trailing newline - line = line.rstrip() - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line) - #ASL listing: space, then line#, then ...., then code - pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*') - m = pasl.search(line) - if (m): - add_asl(lineno, pasl.sub("", line)) - # AML listing: offset in hex, then ...., then code - paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*') - m = paml.search(line) - if (m): - add_aml(m.group(1), paml.sub("", line)) - - # Now go over code - # Track AML offset of a previous non-empty ASL command - prev_aml_offset = -1 - for i in range(len(asl)): - debug = "input line %d: %s" % (asl[i].lineno, asl[i].line) - - l = asl[i].line - - # skip if not an extract directive - a = len(re.findall(r'ACPI_EXTRACT', l)) - if (not a): - # If not empty, store AML offset. Will be used for sanity checks - # IASL seems to put {}. at random places in the listing. - # Ignore any non-words for the purpose of this test. - m = re.search(r'\w+', l) - if (m): - prev_aml_offset = asl[i].aml_offset - continue - - if (a > 1): - die("Expected at most one ACPI_EXTRACT per line, actual %d" % a) - - mext = re.search(r''' - ^\s* # leading whitespace - /\*\s* # start C comment - (ACPI_EXTRACT_\w+) # directive: group(1) - \s+ # whitspace separates directive from array name - (\w+) # array name: group(2) - \s*\*/ # end of C comment - \s*$ # trailing whitespace - ''', l, re.VERBOSE) - if (not mext): - die("Stray ACPI_EXTRACT in input") - - # previous command must have produced some AML, - # otherwise we are in a middle of a block - if (prev_aml_offset == asl[i].aml_offset): - die("ACPI_EXTRACT directive in the middle of a block") - - directive = mext.group(1) - array = mext.group(2) - offset = asl[i].aml_offset - - if (directive == "ACPI_EXTRACT_ALL_CODE"): - if array in output: - die("%s directive used more than once" % directive) - output[array] = aml - continue - if (directive == "ACPI_EXTRACT_NAME_BUFFER8"): - offset = aml_name_buffer8(offset) - elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"): - offset = aml_name_dword_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"): - offset = aml_name_word_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_BYTE_CONST"): - offset = aml_name_byte_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_STRING"): - offset = aml_name_string(offset) - elif (directive == "ACPI_EXTRACT_METHOD_STRING"): - offset = aml_method_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_START"): - offset = aml_device_start(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_STRING"): - offset = aml_device_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_END"): - offset = aml_device_end(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_START"): - offset = aml_processor_start(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"): - offset = aml_processor_string(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_END"): - offset = aml_processor_end(offset) - elif (directive == "ACPI_EXTRACT_PKG_START"): - offset = aml_package_start(offset) - else: - die("Unsupported directive %s" % directive) - - if array not in output: - output[array] = [] - output[array].append(offset) - - debug = "at end of file" - - # Pretty print output - outstrs = ["/* DO NOT EDIT! This is an autogenerated file." - " See scripts/acpi_extract.py. */"] - for array in output.keys(): - otype = get_value_type(max(output[array])) - outstrs.append("static unsigned %s %s[] = {" % (otype, array)) - odata = [] - for value in output[array]: - odata.append("0x%02x" % value) - if len(odata) >= 8: - outstrs.append(" %s," % (', '.join(odata),)) - del odata[:] - outstrs.append(" %s" % (', '.join(odata),)) - outstrs.append('};') - outstrs.append('') - sys.stdout.write('\n'.join(outstrs)) - -if __name__ == '__main__': - main() diff --git a/scripts/acpi_extract_preprocess.py b/scripts/acpi_extract_preprocess.py deleted file mode 100755 index XXXXXXX..XXXXXXX --- a/scripts/acpi_extract_preprocess.py +++ /dev/null @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> -# -# This file may be distributed under the terms of the GNU GPLv3 license. - -# Read a preprocessed ASL listing and put each ACPI_EXTRACT -# directive in a comment, to make iasl skip it. -# We also put each directive on a new line, the machinery -# in scripts/acpi_extract.py requires this. - -import re -import sys -import fileinput - -def die(diag): - sys.stderr.write("Error: %s\n" % (diag)) - sys.exit(1) - -# Note: () around pattern make split return matched string as part of list -psplit = re.compile(r''' ( - \b # At word boundary - ACPI_EXTRACT_\w+ # directive - \s+ # some whitespace - \w+ # array name - )''', re.VERBOSE) - -lineno = 0 -for line in fileinput.input(): - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line.rstrip()) - - s = psplit.split(line) - # The way split works, each odd item is the matching ACPI_EXTRACT directive. - # Put each in a comment, and on a line by itself. - for i in range(len(s)): - if (i % 2): - sys.stdout.write("\n/* %s */\n" % s[i]) - else: - sys.stdout.write(s[i]) - -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
This effectively breaks cross build which cross CC is supplied externally. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OUT=out/ # Common command definitions -export HOSTCC := $(CC) +export HOSTCC := cc export CONFIG_SHELL := sh export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config export LC_ALL := C -CROSS_PREFIX= -ifneq ($(CROSS_PREFIX),) + +CROSS_PREFIX := CC=$(CROSS_PREFIX)gcc -endif AS=$(CROSS_PREFIX)as LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
This is perfered way to get correct LD and AS flags set, as well as preprocessor definitions on cross builds. Also mandatory for potential clang build. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 35 +++++++++++++++++------------------ scripts/test-build.sh | 12 ++++++------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config export LC_ALL := C -CROSS_PREFIX := +CROSS_PREFIX := CC=$(CROSS_PREFIX)gcc -AS=$(CROSS_PREFIX)as -LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip PYTHON=python -CPP=cpp -LD32BIT_FLAG:=-melf_i386 # Source files SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c \ @@ -XXX,XX +XXX,XX @@ COMMONCFLAGS := -I$(OUT) -Isrc -Os -MD -g \ -m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \ -minline-all-stringops -fomit-frame-pointer \ -freg-struct-return -ffreestanding -fno-delete-null-pointer-checks \ - -ffunction-sections -fdata-sections -fno-common -fno-merge-constants -COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) + -ffunction-sections -fdata-sections -fno-common -static -nostdlib \ + -fno-merge-constants COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,) +COMMONCFLAGS += $(call cc-option,$(CC),-nopie,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,) @@ -XXX,XX +XXX,XX @@ CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0 CFLAGS16 := $(CFLAGSSEG) -DMODE16=1 \ $(call cc-option,$(CC),-m16,-Wa$(COMMA)src/code16gcc.s) \ $(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline) +LD32BIT_FLAG:= $(COMMONCFLAGS) -Wl,-melf_i386 \ + $(call cc-option,$(CC),-Wl$(COMMA)--no-warn-rwx-segments) # Run with "make V=1" to see the actual compile commands ifdef V @@ -XXX,XX +XXX,XX @@ all: $(target-y) ################ Common build rules # Verify the build environment works. -TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" scripts/test-build.sh) +TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" CFLAGS16="$(CFLAGS16)" \ + LD32BIT_FLAG="$(LD32BIT_FLAG)" scripts/test-build.sh) ifeq "$(TESTGCC)" "-1" $(error "Please upgrade the build environment") endif @@ -XXX,XX +XXX,XX @@ $(OUT)%.o: %.c $(OUT)autoconf.h $(OUT)%.lds: %.lds.S @echo " Precompiling $@" - $(Q)$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@ - + $(Q)$(CC) -E $(COMMONCFLAGS) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@ ################ Main BIOS build rules @@ -XXX,XX +XXX,XX @@ $(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o src/version.c scripts/layoutrom.py scripts/buildversion.py @echo " Building ld scripts" - $(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h + $(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h $(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o - $(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o - $(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o + $(Q)$(CC) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o + $(Q)$(CC) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o $(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump $(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump $(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump @@ -XXX,XX +XXX,XX @@ $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds $(OUT)code32flat.o $(OUT)code $(OUT)rom16.o: $(OUT)code16.o $(OUT)romlayout16.lds @echo " Linking $@" - $(Q)$(LD) -T $(OUT)romlayout16.lds $< -o $@ + $(Q)$(CC) $(LD32BIT_FLAG) -T $(OUT)romlayout16.lds $< -o $@ $(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)romlayout32seg.lds @echo " Linking $@" - $(Q)$(LD) -T $(OUT)romlayout32seg.lds $< -o $@ + $(Q)$(CC) $(LD32BIT_FLAG) -T $(OUT)romlayout32seg.lds $< -o $@ $(OUT)rom.o: $(OUT)rom16.noexec.o $(OUT)rom32seg.noexec.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds @echo " Linking $@" - $(Q)$(LD) -N -T $(OUT)romlayout32flat.lds $(OUT)rom16.noexec.o $(OUT)rom32seg.noexec.o $(OUT)code32flat.o -o $@ + $(Q)$(CC) $(LD32BIT_FLAG) -Wl,-N -T $(OUT)romlayout32flat.lds $(OUT)rom16.noexec.o $(OUT)rom32seg.noexec.o $(OUT)code32flat.o -o $@ $(OUT)bios.bin.prep: $(OUT)rom.o scripts/checkrom.py @echo " Prepping $@" @@ -XXX,XX +XXX,XX @@ $(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py @echo " Fixup VGA rom assembler" $(Q)$(PYTHON) ./scripts/vgafixup.py $< $(OUT)vgaccode16.s - $(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@ + $(Q)$(CC) -c $(CFLAGS16) $(OUT)vgaccode16.s -o $@ else $(OUT)vgaccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16) -Isrc, $(SRCVGA),$@) endif @@ -XXX,XX +XXX,XX @@ $(OUT)vgarom.o: $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgasrc/vgalayout.lds v @echo " Linking $@" $(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autovgaversion.h $(Q)$(CC) $(CFLAGS16) -c vgasrc/vgaversion.c -o $(OUT)vgaversion.o - $(Q)$(LD) --gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@ + $(Q)$(CC) $(LD32BIT_FLAG) -Wl,--gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@ $(OUT)vgabios.bin.raw: $(OUT)vgarom.o @echo " Extracting binary $@" diff --git a/scripts/test-build.sh b/scripts/test-build.sh index XXXXXXX..XXXXXXX 100755 --- a/scripts/test-build.sh +++ b/scripts/test-build.sh @@ -XXX,XX +XXX,XX @@ SECTIONS } } EOF -$CC -O -g -c $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1 +$CC $CFLAGS16 -O -g -c $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Unable to execute the C compiler ($CC)." >&2 echo "" >&2 @@ -XXX,XX +XXX,XX @@ if [ $? -ne 0 ]; then echo -1 exit 0 fi -$LD -T $TMPFILE1_ld $TMPFILE1o -o $TMPFILE2o > /dev/null 2>&1 +$CC $LD32BIT_FLAG -v -T $TMPFILE1_ld $TMPFILE1o -o $TMPFILE2o > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "The version of LD on this system ($LD) does not properly handle" >&2 echo "alignments. As a result, this project can not be built." >&2 @@ -XXX,XX +XXX,XX @@ fi # Test for "-fwhole-program". Older versions of gcc (pre v4.1) don't # support the whole-program optimization - detect that. -$CC -fwhole-program -S -o /dev/null -xc /dev/null > /dev/null 2>&1 +$CC -m32 -fwhole-program -S -o /dev/null -xc /dev/null > /dev/null 2>&1 if [ $? -ne 0 ]; then echo " Working around no -fwhole-program" >&2 echo 2 @@ -XXX,XX +XXX,XX @@ void __attribute__((externally_visible)) t1() { } extern unsigned char v1; unsigned char v1 __attribute__((section(".data16.foo.19"))) __attribute__((externally_visible)); EOF -$CC -Os -c -fwhole-program $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1 +$CC -m32 -Os -c -fwhole-program $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1 cat - > $TMPFILE2 <<EOF void t1(); extern unsigned char v1; int __attribute__((externally_visible)) main() { t1(); return v1; } EOF -$CC -Os -c -fwhole-program $TMPFILE2 -o $TMPFILE2o > /dev/null 2>&1 -$CC -nostdlib -Os $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 +$CC -m32 -Os -c -fwhole-program $TMPFILE2 -o $TMPFILE2o > /dev/null 2>&1 +$CC ${LD32BIT_FLAG} -Os $TMPFILE1o $TMPFILE2o -o $TMPFILE3o > /dev/null 2>&1 if [ $? -ne 0 ]; then echo " Working around non-functional -fwhole-program" >&2 echo 2 -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Allow all hoat flags to be set at top level makefile. Allow KBUILD_DEFCONFIG to be specified to load external defconfigs. Allow linux style CROSS_COMPILE specifier. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 6 +++++- scripts/kconfig/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OUT=out/ # Common command definitions export HOSTCC := cc +export HOSTCLFLAGS := +export HOSTLDFLAGS := export CONFIG_SHELL := sh export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config +export KBUILD_DEFCONFIG := /dev/null export LC_ALL := C -CROSS_PREFIX := +CROSS_COMPILE := +CROSS_PREFIX := $(CROSS_COMPILE) CC=$(CROSS_PREFIX)gcc OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index XXXXXXX..XXXXXXX 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -XXX,XX +XXX,XX @@ else Kconfig := Kconfig endif +ifndef KBUILD_DEFCONFIG +KBUILD_DEFCONFIG := defconfig +endif + # We need this, in case the user has it in its environment unexport CONFIG_ @@ -XXX,XX +XXX,XX @@ savedefconfig: $(obj)/conf defconfig: $(obj)/conf @echo " Build default config" - $(Q)$< --defconfig=/dev/null $(Kconfig) + $(Q)$< --defconfig=$(KBUILD_DEFCONFIG) $(Kconfig) %_defconfig: $(obj)/conf $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
To adopt newer toolchains. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- scripts/gen-offsets.sh | 7 ++++--- src/gen-defs.h | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/gen-offsets.sh b/scripts/gen-offsets.sh index XXXXXXX..XXXXXXX 100755 --- a/scripts/gen-offsets.sh +++ b/scripts/gen-offsets.sh @@ -XXX,XX +XXX,XX @@ cat > "$OUTFILE" <<EOF #ifndef __ASM_OFFSETS_H #define __ASM_OFFSETS_H EOF -sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$\#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" < "$INFILE" >> "$OUTFILE" +sed -ne 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; + /^->/{s:->#\(.*\):/* \1 */:; + s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; + s:->::; p;}' < "$INFILE" >> "$OUTFILE" cat >> "$OUTFILE" <<EOF #endif // asm-offsets.h EOF diff --git a/src/gen-defs.h b/src/gen-defs.h index XXXXXXX..XXXXXXX 100644 --- a/src/gen-defs.h +++ b/src/gen-defs.h @@ -XXX,XX +XXX,XX @@ #ifndef __GEN_DEFS_H #define __GEN_DEFS_H - #define DEFINE(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val)) -#define BLANK() \ - asm volatile("\n->" : : ) +#define BLANK() asm volatile("\n.ascii \"->\"" : : ) #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)) #define COMMENT(x) \ - asm volatile("\n->#" x) + asm volatile("\n.ascii \"->#" x "\"") #endif // gen-defs.h -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
We can't assume python is python3 on build platforms. Explictly use python3 for running those scripts. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 2 +- scripts/buildrom.py | 2 +- scripts/buildversion.py | 2 +- scripts/checkrom.py | 2 +- scripts/checkstack.py | 2 +- scripts/checksum.py | 2 +- scripts/encodeint.py | 2 +- scripts/layoutrom.py | 2 +- scripts/ldnoexec.py | 2 +- scripts/readserial.py | 2 +- scripts/transdump.py | 2 +- scripts/vgafixup.py | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ CC=$(CROSS_PREFIX)gcc OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip -PYTHON=python +PYTHON=python3 # Source files SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c \ diff --git a/scripts/buildrom.py b/scripts/buildrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/buildrom.py +++ b/scripts/buildrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Fill in checksum/size of an option rom, and pad it to proper length. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/buildversion.py b/scripts/buildversion.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/buildversion.py +++ b/scripts/buildversion.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Generate version information for a program # # Copyright (C) 2015 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/checkrom.py b/scripts/checkrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checkrom.py +++ b/scripts/checkrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to check a bios image and report info on it. # # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/checkstack.py b/scripts/checkstack.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checkstack.py +++ b/scripts/checkstack.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script that tries to find how much stack space each function in an # object is using. # diff --git a/scripts/checksum.py b/scripts/checksum.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checksum.py +++ b/scripts/checksum.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to report the checksum of a file. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/encodeint.py b/scripts/encodeint.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/encodeint.py +++ b/scripts/encodeint.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Encode an integer in little endian format in a file. # # Copyright (C) 2011 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/layoutrom.py +++ b/scripts/layoutrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to analyze code and arrange ld sections. # # Copyright (C) 2008-2014 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/ldnoexec.py b/scripts/ldnoexec.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/ldnoexec.py +++ b/scripts/ldnoexec.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to remove EXEC flag from an ELF file # # Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/readserial.py b/scripts/readserial.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/readserial.py +++ b/scripts/readserial.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script that can read from a serial device and show timestamps. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/transdump.py b/scripts/transdump.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/transdump.py +++ b/scripts/transdump.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This script is useful for taking the output of memdump() and # converting it back into binary output. This can be useful, for diff --git a/scripts/vgafixup.py b/scripts/vgafixup.py index XXXXXXX..XXXXXXX 100644 --- a/scripts/vgafixup.py +++ b/scripts/vgafixup.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Work around x86emu bugs by replacing problematic instructions. # # Copyright (C) 2012 Kevin O'Connor <kevin@koconnor.net> -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Although we are not going to have a clang build any time soon, those warnings generally make sense. ./src/hw/usb-ohci.c:192:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses] 192 | if (! status & OHCI_HCR) ./src/util.h:217:53: warning: attribute declaration must precede definition [-Wignored-attributes] 217 | extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1); | ^ In file included from out/ccode32flat.o.tmp.c:83: ./src/hw/virtio-blk.c:56:9: warning: misleading indentation; statement is not part of the previous 'while' [-Wmisleading-indentation] 56 | vring_get_buf(vq, NULL); Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- src/hw/serialio.c | 1 + src/hw/usb-ohci.c | 2 +- src/hw/virtio-blk.c | 2 +- src/std/LegacyBios.h | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hw/serialio.c b/src/hw/serialio.c index XXXXXXX..XXXXXXX 100644 --- a/src/hw/serialio.c +++ b/src/hw/serialio.c @@ -XXX,XX +XXX,XX @@ serial_debug_read(u8 offset) ASSERT32FLAT(); return readb((void*)CONFIG_DEBUG_SERIAL_MEM_ADDRESS + 4*offset); } + return 0; } // Setup the debug serial port for output. diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c index XXXXXXX..XXXXXXX 100644 --- a/src/hw/usb-ohci.c +++ b/src/hw/usb-ohci.c @@ -XXX,XX +XXX,XX @@ start_ohci(struct usb_ohci_s *cntl, struct ohci_hcca *hcca) writel(&cntl->regs->cmdstatus, OHCI_HCR); for (;;) { u32 status = readl(&cntl->regs->cmdstatus); - if (! status & OHCI_HCR) + if (!(status & OHCI_HCR)) break; if (timer_check(end)) { warn_timeout(); diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index XXXXXXX..XXXXXXX 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -XXX,XX +XXX,XX @@ virtio_blk_op_one_segment(struct virtiodrive_s *vdrive, usleep(5); /* Reclaim virtqueue element */ - vring_get_buf(vq, NULL); + vring_get_buf(vq, NULL); /** ** Clear interrupt status register. Avoid leaving interrupts stuck diff --git a/src/std/LegacyBios.h b/src/std/LegacyBios.h index XXXXXXX..XXXXXXX 100644 --- a/src/std/LegacyBios.h +++ b/src/std/LegacyBios.h @@ -XXX,XX +XXX,XX @@ typedef enum { /// code is read/write. /// Input: /// AX = Compatibility16PrepareToBoot - /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure + /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure /// Return: /// AX = Returned status codes /// @@ -XXX,XX +XXX,XX @@ typedef struct { UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base. } EFI_LEGACY_INSTALL_PCI_HANDLER; +#pragma pack() + #endif -- Git-154) _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Hi all, This series improved SeaBIOS build system in various aspects. Most notably, it makes cross compiling on MacOS Arm64 with x86_64-elf- toolchain possible. It also fixed various issues exposed when I was trying to clang build work. Although I eventually give up. Thanks Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Jiaxun Yang (9): Remove remaining ACPI tooling bits Makefile: Don't use $(CC) as default $(HOSTCC) Makefile: Invlode preprocessor and assembler with CC Makefile: Allow more linux style knobs asm-offset: Refresh definations from Linux scripts: Use python3 as python LegacyBios.h: Add missing pack() pragma virtio-blk: Fix indentation for vring_get_buf call usb-ohci: Fix logical condition in start_ohci function Makefile | 24 +-- scripts/acpi_extract.py | 366 ------------------------------------- scripts/acpi_extract_preprocess.py | 41 ----- scripts/buildrom.py | 2 +- scripts/buildversion.py | 2 +- scripts/checkrom.py | 2 +- scripts/checkstack.py | 2 +- scripts/checksum.py | 2 +- scripts/encodeint.py | 2 +- scripts/gen-offsets.sh | 7 +- scripts/kconfig/Makefile | 6 +- scripts/layoutrom.py | 2 +- scripts/ldnoexec.py | 2 +- scripts/readserial.py | 2 +- scripts/transdump.py | 2 +- scripts/vgafixup.py | 2 +- src/gen-defs.h | 8 +- src/hw/usb-ohci.c | 2 +- src/hw/virtio-blk.c | 2 +- src/std/LegacyBios.h | 238 ++++++++++++------------ 20 files changed, 157 insertions(+), 559 deletions(-) --- base-commit: 0026c353eb4e220af29750fcf000d48faf8d4ab3 change-id: 20250903-build-d57c47407e58 Best regards, -- Jiaxun Yang <jiaxun.yang@flygoat.com> _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Builtin ACPI support was removed before. Now clean remaining tooling bits. Fixes: 35aa9a72c279 ("drop obsolete acpi table code") Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- Makefile | 3 +- scripts/acpi_extract.py | 366 ------------------------------------- scripts/acpi_extract_preprocess.py | 41 ----- 3 files changed, 1 insertion(+), 409 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip PYTHON=python CPP=cpp -IASL:=iasl LD32BIT_FLAG:=-melf_i386 # Source files @@ -XXX,XX +XXX,XX @@ all: $(target-y) ################ Common build rules # Verify the build environment works. -TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" IASL="$(IASL)" scripts/test-build.sh) +TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" scripts/test-build.sh) ifeq "$(TESTGCC)" "-1" $(error "Please upgrade the build environment") endif diff --git a/scripts/acpi_extract.py b/scripts/acpi_extract.py deleted file mode 100755 index XXXXXXX..XXXXXXX --- a/scripts/acpi_extract.py +++ /dev/null @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> -# -# This file may be distributed under the terms of the GNU GPLv3 license. - -# Process mixed ASL/AML listing (.lst file) produced by iasl -l -# Locate and execute ACPI_EXTRACT directives, output offset info -# -# Documentation of ACPI_EXTRACT_* directive tags: -# -# These directive tags output offset information from AML for BIOS runtime -# table generation. -# Each directive is of the form: -# ACPI_EXTRACT_<TYPE> <array_name> <Operator> (...) -# and causes the extractor to create an array -# named <array_name> with offset, in the generated AML, -# of an object of a given type in the following <Operator>. -# -# A directive must fit on a single code line. -# -# Object type in AML is verified, a mismatch causes a build failure. -# -# Directives and operators currently supported are: -# ACPI_EXTRACT_NAME_DWORD_CONST - extract a Dword Const object from Name() -# ACPI_EXTRACT_NAME_WORD_CONST - extract a Word Const object from Name() -# ACPI_EXTRACT_NAME_BYTE_CONST - extract a Byte Const object from Name() -# ACPI_EXTRACT_METHOD_STRING - extract a NameString from Method() -# ACPI_EXTRACT_NAME_STRING - extract a NameString from Name() -# ACPI_EXTRACT_PROCESSOR_START - start of Processor() block -# ACPI_EXTRACT_PROCESSOR_STRING - extract a NameString from Processor() -# ACPI_EXTRACT_PROCESSOR_END - offset at last byte of Processor() + 1 -# ACPI_EXTRACT_DEVICE_START - start of Device() block -# ACPI_EXTRACT_DEVICE_STRING - extract a NameString from Device() -# ACPI_EXTRACT_DEVICE_END - offset at last byte of Device() + 1 -# ACPI_EXTRACT_PKG_START - start of Package block -# -# ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode -# -# ACPI_EXTRACT is not allowed anywhere else in code, except in comments. - -import re -import sys -import fileinput - -aml = [] -asl = [] -output = {} -debug = "" - -class asl_line: - line = None - lineno = None - aml_offset = None - -def die(diag): - sys.stderr.write("Error: %s; %s\n" % (diag, debug)) - sys.exit(1) - -#Store an ASL command, matching AML offset, and input line (for debugging) -def add_asl(lineno, line): - l = asl_line() - l.line = line - l.lineno = lineno - l.aml_offset = len(aml) - asl.append(l) - -#Store an AML byte sequence -#Verify that offset output by iasl matches # of bytes so far -def add_aml(offset, line): - o = int(offset, 16) - # Sanity check: offset must match size of code so far - if (o != len(aml)): - die("Offset 0x%x != 0x%x" % (o, len(aml))) - # Strip any trailing dots and ASCII dump after " - line = re.sub(r'\s*\.*\s*".*$', "", line) - # Strip traling whitespace - line = re.sub(r'\s+$', "", line) - # Strip leading whitespace - line = re.sub(r'^\s+', "", line) - # Split on whitespace - code = re.split(r'\s+', line) - for c in code: - # Require a legal hex number, two digits - if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))): - die("Unexpected octet %s" % c) - aml.append(int(c, 16)) - -# Process aml bytecode array, decoding AML -def aml_pkglen_bytes(offset): - # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes. - pkglenbytes = aml[offset] >> 6 - return pkglenbytes + 1 - -def aml_pkglen(offset): - pkgstart = offset - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml[offset] & 0x3F - # If multibyte, first nibble only uses bits 0-3 - if ((pkglenbytes > 1) and (pkglen & 0x30)): - die("PkgLen bytes 0x%x but first nibble 0x%x expected 0x0X" % - (pkglen, pkglen)) - offset += 1 - pkglenbytes -= 1 - for i in range(pkglenbytes): - pkglen |= aml[offset + i] << (i * 8 + 4) - if (len(aml) < pkgstart + pkglen): - die("PckgLen 0x%x at offset 0x%x exceeds AML size 0x%x" % - (pkglen, offset, len(aml))) - return pkglen - -# Given method offset, find its NameString offset -def aml_method_string(offset): - #0x14 MethodOp PkgLength NameString MethodFlags TermList - if (aml[offset] != 0x14): - die( "Method offset 0x%x: expected 0x14 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -# Given name offset, find its NameString offset -def aml_name_string(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x08): - die( "Name offset 0x%x: expected 0x08 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - # Block Name Modifier. Skip it. - if (aml[offset] == 0x5c or aml[offset] == 0x5e): - offset += 1 - return offset - -# Given data offset, find 8 byte buffer offset -def aml_data_buffer8(offset): - #0x08 NameOp NameString DataRef - expect = [0x11, 0x0B, 0x0A, 0x08] - if (aml[offset:offset+4] != expect): - die( "Name offset 0x%x: expected %s actual %s" % - (offset, aml[offset:offset+4], expect)) - return offset + len(expect) - -# Given data offset, find dword const offset -def aml_data_dword_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0C): - die( "Name offset 0x%x: expected 0x0C actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Given data offset, find word const offset -def aml_data_word_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0B): - die( "Name offset 0x%x: expected 0x0B actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Given data offset, find byte const offset -def aml_data_byte_const(offset): - #0x08 NameOp NameString DataRef - if (aml[offset] != 0x0A): - die( "Name offset 0x%x: expected 0x0A actual 0x%x" % - (offset, aml[offset])) - return offset + 1 - -# Find name'd buffer8 -def aml_name_buffer8(offset): - return aml_data_buffer8(aml_name_string(offset) + 4) - -# Given name offset, find dword const offset -def aml_name_dword_const(offset): - return aml_data_dword_const(aml_name_string(offset) + 4) - -# Given name offset, find word const offset -def aml_name_word_const(offset): - return aml_data_word_const(aml_name_string(offset) + 4) - -# Given name offset, find byte const offset -def aml_name_byte_const(offset): - return aml_data_byte_const(aml_name_string(offset) + 4) - -def aml_device_start(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)): - die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])) - return offset - -def aml_device_string(offset): - #0x5B 0x82 DeviceOp PkgLength NameString - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_device_end(offset): - start = aml_device_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_processor_start(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)): - die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" % - (offset, aml[offset], aml[offset + 1])) - return offset - -def aml_processor_string(offset): - #0x5B 0x83 ProcessorOp PkgLength NameString ProcID - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - offset += pkglenbytes - return offset - -def aml_processor_end(offset): - start = aml_processor_start(offset) - offset += 2 - pkglenbytes = aml_pkglen_bytes(offset) - pkglen = aml_pkglen(offset) - return offset + pkglen - -def aml_package_start(offset): - offset = aml_name_string(offset) + 4 - # 0x12 PkgLength NumElements PackageElementList - if (aml[offset] != 0x12): - die( "Name offset 0x%x: expected 0x12 actual 0x%x" % - (offset, aml[offset])) - offset += 1 - return offset + aml_pkglen_bytes(offset) + 1 - -def get_value_type(maxvalue): - #Use type large enough to fit the table - if (maxvalue >= 0x10000): - return "int" - elif (maxvalue >= 0x100): - return "short" - else: - return "char" - -def main(): - global debug - lineno = 0 - for line in fileinput.input(): - # Strip trailing newline - line = line.rstrip() - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line) - #ASL listing: space, then line#, then ...., then code - pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*') - m = pasl.search(line) - if (m): - add_asl(lineno, pasl.sub("", line)) - # AML listing: offset in hex, then ...., then code - paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*') - m = paml.search(line) - if (m): - add_aml(m.group(1), paml.sub("", line)) - - # Now go over code - # Track AML offset of a previous non-empty ASL command - prev_aml_offset = -1 - for i in range(len(asl)): - debug = "input line %d: %s" % (asl[i].lineno, asl[i].line) - - l = asl[i].line - - # skip if not an extract directive - a = len(re.findall(r'ACPI_EXTRACT', l)) - if (not a): - # If not empty, store AML offset. Will be used for sanity checks - # IASL seems to put {}. at random places in the listing. - # Ignore any non-words for the purpose of this test. - m = re.search(r'\w+', l) - if (m): - prev_aml_offset = asl[i].aml_offset - continue - - if (a > 1): - die("Expected at most one ACPI_EXTRACT per line, actual %d" % a) - - mext = re.search(r''' - ^\s* # leading whitespace - /\*\s* # start C comment - (ACPI_EXTRACT_\w+) # directive: group(1) - \s+ # whitspace separates directive from array name - (\w+) # array name: group(2) - \s*\*/ # end of C comment - \s*$ # trailing whitespace - ''', l, re.VERBOSE) - if (not mext): - die("Stray ACPI_EXTRACT in input") - - # previous command must have produced some AML, - # otherwise we are in a middle of a block - if (prev_aml_offset == asl[i].aml_offset): - die("ACPI_EXTRACT directive in the middle of a block") - - directive = mext.group(1) - array = mext.group(2) - offset = asl[i].aml_offset - - if (directive == "ACPI_EXTRACT_ALL_CODE"): - if array in output: - die("%s directive used more than once" % directive) - output[array] = aml - continue - if (directive == "ACPI_EXTRACT_NAME_BUFFER8"): - offset = aml_name_buffer8(offset) - elif (directive == "ACPI_EXTRACT_NAME_DWORD_CONST"): - offset = aml_name_dword_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_WORD_CONST"): - offset = aml_name_word_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_BYTE_CONST"): - offset = aml_name_byte_const(offset) - elif (directive == "ACPI_EXTRACT_NAME_STRING"): - offset = aml_name_string(offset) - elif (directive == "ACPI_EXTRACT_METHOD_STRING"): - offset = aml_method_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_START"): - offset = aml_device_start(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_STRING"): - offset = aml_device_string(offset) - elif (directive == "ACPI_EXTRACT_DEVICE_END"): - offset = aml_device_end(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_START"): - offset = aml_processor_start(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_STRING"): - offset = aml_processor_string(offset) - elif (directive == "ACPI_EXTRACT_PROCESSOR_END"): - offset = aml_processor_end(offset) - elif (directive == "ACPI_EXTRACT_PKG_START"): - offset = aml_package_start(offset) - else: - die("Unsupported directive %s" % directive) - - if array not in output: - output[array] = [] - output[array].append(offset) - - debug = "at end of file" - - # Pretty print output - outstrs = ["/* DO NOT EDIT! This is an autogenerated file." - " See scripts/acpi_extract.py. */"] - for array in output.keys(): - otype = get_value_type(max(output[array])) - outstrs.append("static unsigned %s %s[] = {" % (otype, array)) - odata = [] - for value in output[array]: - odata.append("0x%02x" % value) - if len(odata) >= 8: - outstrs.append(" %s," % (', '.join(odata),)) - del odata[:] - outstrs.append(" %s" % (', '.join(odata),)) - outstrs.append('};') - outstrs.append('') - sys.stdout.write('\n'.join(outstrs)) - -if __name__ == '__main__': - main() diff --git a/scripts/acpi_extract_preprocess.py b/scripts/acpi_extract_preprocess.py deleted file mode 100755 index XXXXXXX..XXXXXXX --- a/scripts/acpi_extract_preprocess.py +++ /dev/null @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/python -# Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> -# -# This file may be distributed under the terms of the GNU GPLv3 license. - -# Read a preprocessed ASL listing and put each ACPI_EXTRACT -# directive in a comment, to make iasl skip it. -# We also put each directive on a new line, the machinery -# in scripts/acpi_extract.py requires this. - -import re -import sys -import fileinput - -def die(diag): - sys.stderr.write("Error: %s\n" % (diag)) - sys.exit(1) - -# Note: () around pattern make split return matched string as part of list -psplit = re.compile(r''' ( - \b # At word boundary - ACPI_EXTRACT_\w+ # directive - \s+ # some whitespace - \w+ # array name - )''', re.VERBOSE) - -lineno = 0 -for line in fileinput.input(): - # line number and debug string to output in case of errors - lineno = lineno + 1 - debug = "input line %d: %s" % (lineno, line.rstrip()) - - s = psplit.split(line) - # The way split works, each odd item is the matching ACPI_EXTRACT directive. - # Put each in a comment, and on a line by itself. - for i in range(len(s)): - if (i % 2): - sys.stdout.write("\n/* %s */\n" % s[i]) - else: - sys.stdout.write(s[i]) - -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
In context of cross compiling, $(CC) refers to compiler to generate target binary, we can't assume $(CC) will generate target binary. Set default HOSTCC to cc, and make override of CC unconditional. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OUT=out/ # Common command definitions -export HOSTCC := $(CC) +export HOSTCC := cc export CONFIG_SHELL := sh export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config export LC_ALL := C -CROSS_PREFIX= -ifneq ($(CROSS_PREFIX),) + +CROSS_PREFIX := CC=$(CROSS_PREFIX)gcc -endif AS=$(CROSS_PREFIX)as LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Our build system was using host CPP preprocessor which is not gaurenteed to have necessaey target macros set, convert to use target CC to invole preprocessor. The same change is applied to assembler as well for simplicity. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ export LC_ALL := C CROSS_PREFIX := CC=$(CROSS_PREFIX)gcc -AS=$(CROSS_PREFIX)as LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip PYTHON=python -CPP=cpp LD32BIT_FLAG:=-melf_i386 # Source files @@ -XXX,XX +XXX,XX @@ $(OUT)%.o: %.c $(OUT)autoconf.h $(OUT)%.lds: %.lds.S @echo " Precompiling $@" - $(Q)$(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@ + $(Q)$(CC) -E $(COMMONCFLAGS) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $@ ################ Main BIOS build rules @@ -XXX,XX +XXX,XX @@ $(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o src/version.c scripts/layoutrom.py scripts/buildversion.py @echo " Building ld scripts" - $(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(AS);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h + $(Q)$(PYTHON) ./scripts/buildversion.py -e "$(EXTRAVERSION)" -t "$(CC);$(LD);$(OBJCOPY);$(OBJDUMP);$(STRIP)" $(OUT)autoversion.h $(Q)$(CC) $(CFLAGS32FLAT) -c src/version.c -o $(OUT)version.o $(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o $(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o @@ -XXX,XX +XXX,XX @@ $(OUT)vgaccode16.raw.s: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(OUT)vgaccode16.o: $(OUT)vgaccode16.raw.s scripts/vgafixup.py @echo " Fixup VGA rom assembler" $(Q)$(PYTHON) ./scripts/vgafixup.py $< $(OUT)vgaccode16.s - $(Q)$(AS) --32 src/code16gcc.s $(OUT)vgaccode16.s -o $@ + $(Q)$(CC) -c $(CFLAGS16) $(OUT)vgaccode16.s -o $@ else $(OUT)vgaccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRCVGA)) ; $(call whole-compile, $(CFLAGS16) -Isrc, $(SRCVGA),$@) endif -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Allow all host flags to be set at top level makefile. Allow KBUILD_DEFCONFIG to be specified to load external defconfigs. Allow linux style CROSS_COMPILE specifier. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 6 +++++- scripts/kconfig/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ OUT=out/ # Common command definitions export HOSTCC := cc +export HOSTCFLAGS := +export HOSTLDFLAGS := export CONFIG_SHELL := sh export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config +export KBUILD_DEFCONFIG := /dev/null export LC_ALL := C -CROSS_PREFIX := +CROSS_COMPILE := +CROSS_PREFIX := $(CROSS_COMPILE) CC=$(CROSS_PREFIX)gcc LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index XXXXXXX..XXXXXXX 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -XXX,XX +XXX,XX @@ else Kconfig := Kconfig endif +ifndef KBUILD_DEFCONFIG +KBUILD_DEFCONFIG := defconfig +endif + # We need this, in case the user has it in its environment unexport CONFIG_ @@ -XXX,XX +XXX,XX @@ savedefconfig: $(obj)/conf defconfig: $(obj)/conf @echo " Build default config" - $(Q)$< --defconfig=/dev/null $(Kconfig) + $(Q)$< --defconfig=$(KBUILD_DEFCONFIG) $(Kconfig) %_defconfig: $(obj)/conf $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
To adopt newer toolchains. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- scripts/gen-offsets.sh | 7 ++++--- src/gen-defs.h | 8 +++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/gen-offsets.sh b/scripts/gen-offsets.sh index XXXXXXX..XXXXXXX 100755 --- a/scripts/gen-offsets.sh +++ b/scripts/gen-offsets.sh @@ -XXX,XX +XXX,XX @@ cat > "$OUTFILE" <<EOF #ifndef __ASM_OFFSETS_H #define __ASM_OFFSETS_H EOF -sed -ne "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$\#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" < "$INFILE" >> "$OUTFILE" +sed -ne 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; + /^->/{s:->#\(.*\):/* \1 */:; + s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; + s:->::; p;}' < "$INFILE" >> "$OUTFILE" cat >> "$OUTFILE" <<EOF #endif // asm-offsets.h EOF diff --git a/src/gen-defs.h b/src/gen-defs.h index XXXXXXX..XXXXXXX 100644 --- a/src/gen-defs.h +++ b/src/gen-defs.h @@ -XXX,XX +XXX,XX @@ #ifndef __GEN_DEFS_H #define __GEN_DEFS_H - #define DEFINE(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val)) -#define BLANK() \ - asm volatile("\n->" : : ) +#define BLANK() asm volatile("\n.ascii \"->\"" : : ) #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)) #define COMMENT(x) \ - asm volatile("\n->#" x) + asm volatile("\n.ascii \"->#" x "\"") #endif // gen-defs.h -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Some of our python3 scripts are python3 only. We can't assume python is python3 on build platforms. Explictly use python3 for running those scripts. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- Makefile | 2 +- scripts/buildrom.py | 2 +- scripts/buildversion.py | 2 +- scripts/checkrom.py | 2 +- scripts/checkstack.py | 2 +- scripts/checksum.py | 2 +- scripts/encodeint.py | 2 +- scripts/layoutrom.py | 2 +- scripts/ldnoexec.py | 2 +- scripts/readserial.py | 2 +- scripts/transdump.py | 2 +- scripts/vgafixup.py | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index XXXXXXX..XXXXXXX 100644 --- a/Makefile +++ b/Makefile @@ -XXX,XX +XXX,XX @@ LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip -PYTHON=python +PYTHON=python3 LD32BIT_FLAG:=-melf_i386 # Source files diff --git a/scripts/buildrom.py b/scripts/buildrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/buildrom.py +++ b/scripts/buildrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Fill in checksum/size of an option rom, and pad it to proper length. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/buildversion.py b/scripts/buildversion.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/buildversion.py +++ b/scripts/buildversion.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Generate version information for a program # # Copyright (C) 2015 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/checkrom.py b/scripts/checkrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checkrom.py +++ b/scripts/checkrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to check a bios image and report info on it. # # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/checkstack.py b/scripts/checkstack.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checkstack.py +++ b/scripts/checkstack.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script that tries to find how much stack space each function in an # object is using. # diff --git a/scripts/checksum.py b/scripts/checksum.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/checksum.py +++ b/scripts/checksum.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to report the checksum of a file. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/encodeint.py b/scripts/encodeint.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/encodeint.py +++ b/scripts/encodeint.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Encode an integer in little endian format in a file. # # Copyright (C) 2011 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/layoutrom.py +++ b/scripts/layoutrom.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to analyze code and arrange ld sections. # # Copyright (C) 2008-2014 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/ldnoexec.py b/scripts/ldnoexec.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/ldnoexec.py +++ b/scripts/ldnoexec.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to remove EXEC flag from an ELF file # # Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/readserial.py b/scripts/readserial.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/readserial.py +++ b/scripts/readserial.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script that can read from a serial device and show timestamps. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> diff --git a/scripts/transdump.py b/scripts/transdump.py index XXXXXXX..XXXXXXX 100755 --- a/scripts/transdump.py +++ b/scripts/transdump.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # This script is useful for taking the output of memdump() and # converting it back into binary output. This can be useful, for diff --git a/scripts/vgafixup.py b/scripts/vgafixup.py index XXXXXXX..XXXXXXX 100644 --- a/scripts/vgafixup.py +++ b/scripts/vgafixup.py @@ -XXX,XX +XXX,XX @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Work around x86emu bugs by replacing problematic instructions. # # Copyright (C) 2012 Kevin O'Connor <kevin@koconnor.net> -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
To match #pragma pack(1) at begining of this file. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- src/std/LegacyBios.h | 238 ++++++++++++++++++++++++++------------------------- 1 file changed, 120 insertions(+), 118 deletions(-) diff --git a/src/std/LegacyBios.h b/src/std/LegacyBios.h index XXXXXXX..XXXXXXX 100644 --- a/src/std/LegacyBios.h +++ b/src/std/LegacyBios.h @@ -XXX,XX +XXX,XX @@ environment. Reverse thunk is the code that does the opposite. Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> -This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. @par Revision Reference: @@ -XXX,XX +XXX,XX @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define _EFI_LEGACY_BIOS_H_ /// -/// +/// /// #pragma pack(1) @@ -XXX,XX +XXX,XX @@ typedef struct { /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a DWORD or UINT32. /// UINT32 Signature; - + /// /// The value required such that byte checksum of TableLength equals zero. /// UINT8 TableChecksum; - + /// /// The length of this table. /// UINT8 TableLength; - + /// /// The major EFI revision for which this table was generated. - /// + /// UINT8 EfiMajorRevision; - + /// /// The minor EFI revision for which this table was generated. /// UINT8 EfiMinorRevision; - + /// /// The major revision of this table. /// UINT8 TableMajorRevision; - + /// /// The minor revision of this table. /// UINT8 TableMinorRevision; - + /// /// Reserved for future usage. /// UINT16 Reserved; - + /// /// The segment of the entry point within the traditional BIOS for Compatibility16 functions. /// UINT16 Compatibility16CallSegment; - + /// /// The offset of the entry point within the traditional BIOS for Compatibility16 functions. /// UINT16 Compatibility16CallOffset; - + /// - /// The segment of the entry point within the traditional BIOS for EfiCompatibility + /// The segment of the entry point within the traditional BIOS for EfiCompatibility /// to invoke the PnP installation check. /// UINT16 PnPInstallationCheckSegment; - + /// - /// The Offset of the entry point within the traditional BIOS for EfiCompatibility + /// The Offset of the entry point within the traditional BIOS for EfiCompatibility /// to invoke the PnP installation check. /// UINT16 PnPInstallationCheckOffset; - + /// - /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform + /// EFI system resources table. Type EFI_SYSTEM_TABLE is defined in the IntelPlatform ///Innovation Framework for EFI Driver Execution Environment Core Interface Specification (DXE CIS). /// - UINT32 EfiSystemTable; - + UINT32 EfiSystemTable; + /// /// The address of an OEM-provided identifier string. The string is null terminated. /// UINT32 OemIdStringPointer; - + /// /// The 32-bit physical address where ACPI RSD PTR is stored within the traditional /// BIOS. The remained of the ACPI tables are located at their EFI addresses. The size @@ -XXX,XX +XXX,XX @@ typedef struct { /// RSD PTR with either the ACPI 1.0b or 2.0 values. /// UINT32 AcpiRsdPtrPointer; - + /// /// The OEM revision number. Usage is undefined but provided for OEM module usage. /// UINT16 OemRevision; - + /// /// The 32-bit physical address where INT15 E820 data is stored within the traditional /// BIOS. The EfiCompatibility code will fill in the E820Pointer value and copy the /// data to the indicated area. /// UINT32 E820Pointer; - + /// /// The length of the E820 data and is filled in by the EfiCompatibility code. /// UINT32 E820Length; - + /// /// The 32-bit physical address where the $PIR table is stored in the traditional BIOS. /// The EfiCompatibility code will fill in the IrqRoutingTablePointer value and /// copy the data to the indicated area. /// UINT32 IrqRoutingTablePointer; - + /// /// The length of the $PIR table and is filled in by the EfiCompatibility code. /// UINT32 IrqRoutingTableLength; - + /// /// The 32-bit physical address where the MP table is stored in the traditional BIOS. - /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data + /// The EfiCompatibility code will fill in the MpTablePtr value and copy the data /// to the indicated area. /// UINT32 MpTablePtr; - + /// /// The length of the MP table and is filled in by the EfiCompatibility code. /// UINT32 MpTableLength; - + /// /// The segment of the OEM-specific INT table/code. - /// + /// UINT16 OemIntSegment; - + /// /// The offset of the OEM-specific INT table/code. /// UINT16 OemIntOffset; - + /// /// The segment of the OEM-specific 32-bit table/code. /// UINT16 Oem32Segment; - + /// /// The offset of the OEM-specific 32-bit table/code. /// UINT16 Oem32Offset; - + /// /// The segment of the OEM-specific 16-bit table/code. /// UINT16 Oem16Segment; - + /// /// The offset of the OEM-specific 16-bit table/code. /// UINT16 Oem16Offset; - + /// /// The segment of the TPM binary passed to 16-bit CSM. /// UINT16 TpmSegment; - + /// /// The offset of the TPM binary passed to 16-bit CSM. /// UINT16 TpmOffset; - + /// /// A pointer to a string identifying the independent BIOS vendor. /// UINT32 IbvPointer; - + /// /// This field is NULL for all systems not supporting PCI Express. This field is the base /// value of the start of the PCI Express memory-mapped configuration registers and @@ -XXX,XX +XXX,XX @@ typedef struct { /// Functions. /// UINT32 PciExpressBase; - + /// /// Maximum PCI bus number assigned. /// @@ -XXX,XX +XXX,XX @@ typedef struct { } EFI_COMPATIBILITY16_TABLE; /// -/// Functions provided by the CSM binary which communicate between the EfiCompatibility +/// Functions provided by the CSM binary which communicate between the EfiCompatibility /// and Compatability16 code. /// -/// Inconsistent with the specification here: -/// The member's name started with "Compatibility16" [defined in Intel Framework -/// Compatibility Support Module Specification / 0.97 version] +/// Inconsistent with the specification here: +/// The member's name started with "Compatibility16" [defined in Intel Framework +/// Compatibility Support Module Specification / 0.97 version] /// has been changed to "Legacy16" since keeping backward compatible. /// typedef enum { @@ -XXX,XX +XXX,XX @@ typedef enum { /// AX = Return Status codes /// Legacy16InitializeYourself = 0x0000, - + /// /// Causes the Compatibility16 BIOS to perform any drive number translations to match the boot sequence. /// Input: @@ -XXX,XX +XXX,XX @@ typedef enum { /// AX = Returned status codes /// Legacy16UpdateBbs = 0x0001, - + /// /// Allows the Compatibility16 code to perform any final actions before booting. The Compatibility16 /// code is read/write. /// Input: /// AX = Compatibility16PrepareToBoot - /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure + /// ES:BX = Pointer to EFI_TO_COMPATIBILITY16_BOOT_TABLE structure /// Return: /// AX = Returned status codes /// Legacy16PrepareToBoot = 0x0002, - + /// /// Causes the Compatibility16 BIOS to boot. The Compatibility16 code is Read/Only. /// Input: @@ -XXX,XX +XXX,XX @@ typedef enum { /// AX = Returned status codes /// Legacy16Boot = 0x0003, - + /// /// Allows the Compatibility16 code to get the last device from which a boot was attempted. This is /// stored in CMOS and is the priority number of the last attempted boot device. @@ -XXX,XX +XXX,XX @@ typedef enum { /// BX = Priority number of the boot device. /// Legacy16RetrieveLastBootDevice = 0x0004, - + /// /// Allows the Compatibility16 code rehook INT13, INT18, and/or INT19 after dispatching a legacy OpROM. /// Input: @@ -XXX,XX +XXX,XX @@ typedef enum { /// BX = Number of non-BBS-compliant devices found. Equals 0 if BBS compliant. /// Legacy16DispatchOprom = 0x0005, - + /// /// Finds a free area in the 0xFxxxx or 0xExxxx region of the specified length and returns the address /// of that region. @@ -XXX,XX +XXX,XX @@ typedef enum { /// DS:BX = Address of the region /// Legacy16GetTableAddress = 0x0006, - + /// /// Enables the EfiCompatibility module to do any nonstandard processing of keyboard LEDs or state. /// Input: @@ -XXX,XX +XXX,XX @@ typedef enum { /// AX = Returned status codes /// Legacy16SetKeyboardLeds = 0x0007, - + /// /// Enables the EfiCompatibility module to install an interrupt handler for PCI mass media devices that /// do not have an OpROM associated with them. An example is SATA. @@ -XXX,XX +XXX,XX @@ typedef struct { UINT32 BbsTablePointer; ///< A pointer to the BBS table. UINT16 RuntimeSegment; ///< The segment where the OpROM can be relocated to. If this value is 0x0000, this ///< means that the relocation of this run time code is not supported. - ///< Inconsistent with specification here: - ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] + ///< Inconsistent with specification here: + ///< The member's name "OpromDestinationSegment" [defined in Intel Framework Compatibility Support Module Specification / 0.97 version] ///< has been changed to "RuntimeSegment" since keeping backward compatible. } EFI_DISPATCH_OPROM_TABLE; @@ -XXX,XX +XXX,XX @@ typedef struct { /// Starting address of memory under 1 MB. The ending address is assumed to be 640 KB or 0x9FFFF. /// UINT32 BiosLessThan1MB; - + /// /// The starting address of the high memory block. /// UINT32 HiPmmMemory; - + /// /// The length of high memory block. /// UINT32 HiPmmMemorySizeInBytes; - + /// /// The segment of the reverse thunk call code. /// UINT16 ReverseThunkCallSegment; - + /// /// The offset of the reverse thunk call code. /// UINT16 ReverseThunkCallOffset; - + /// /// The number of E820 entries copied to the Compatibility16 BIOS. /// UINT32 NumberE820Entries; - + /// /// The amount of usable memory above 1 MB, e.g., E820 type 1 memory. /// UINT32 OsMemoryAbove1Mb; - + /// /// The start of thunk code in main memory. Memory cannot be used by BIOS or PMM. /// UINT32 ThunkStart; - + /// /// The size of the thunk code. /// UINT32 ThunkSizeInBytes; - + /// /// Starting address of memory under 1 MB. /// UINT32 LowPmmMemory; - + /// /// The length of low Memory block. /// @@ -XXX,XX +XXX,XX @@ typedef struct { /// per IDE controller. The IdentifyDrive is per drive. Index 0 is master and index /// 1 is slave. /// - UINT16 Status; - + UINT16 Status; + /// /// PCI bus of IDE controller. /// UINT32 Bus; - + /// /// PCI device of IDE controller. /// UINT32 Device; - + /// /// PCI function of IDE controller. /// UINT32 Function; - + /// /// Command ports base address. /// UINT16 CommandBaseAddress; - + /// /// Control ports base address. /// UINT16 ControlBaseAddress; - + /// /// Bus master address. /// UINT16 BusMasterAddress; - + UINT8 HddIrq; - + /// /// Data that identifies the drive data; one per possible attached drive. /// @@ -XXX,XX +XXX,XX @@ typedef struct { UINT16 Enabled : 1; ///< If 0, ignore this entry. UINT16 Failed : 1; ///< 0 = Not known if boot failure occurred. ///< 1 = Boot attempted failed. - + /// /// State of media present. /// 00 = No bootable media is present in the device. @@ -XXX,XX +XXX,XX @@ typedef struct { /// The boot priority for this boot device. Values are defined below. /// UINT16 BootPriority; - + /// /// The PCI bus for this boot device. /// UINT32 Bus; - + /// /// The PCI device for this boot device. /// UINT32 Device; - + /// /// The PCI function for the boot device. /// UINT32 Function; - + /// /// The PCI class for this boot device. /// UINT8 Class; - + /// /// The PCI Subclass for this boot device. /// UINT8 SubClass; - + /// /// Segment:offset address of an ASCIIZ description string describing the manufacturer. /// UINT16 MfgStringOffset; - + /// /// Segment:offset address of an ASCIIZ description string describing the manufacturer. - /// + /// UINT16 MfgStringSegment; - + /// /// BBS device type. BBS device types are defined below. /// UINT16 DeviceType; - + /// /// Status of this boot device. Type BBS_STATUS_FLAGS is defined below. /// BBS_STATUS_FLAGS StatusFlags; - + /// /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for /// BCV devices. /// UINT16 BootHandlerOffset; - + /// /// Segment:Offset address of boot loader for IPL devices or install INT13 handler for /// BCV devices. - /// + /// UINT16 BootHandlerSegment; - + /// /// Segment:offset address of an ASCIIZ description string describing this device. /// @@ -XXX,XX +XXX,XX @@ typedef struct { /// Segment:offset address of an ASCIIZ description string describing this device. /// UINT16 DescStringSegment; - + /// /// Reserved. /// UINT32 InitPerReserved; - + /// /// The use of these fields is IBV dependent. They can be used to flag that an OpROM /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup /// UINT32 AdditionalIrq13Handler; - + /// /// The use of these fields is IBV dependent. They can be used to flag that an OpROM /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup - /// + /// UINT32 AdditionalIrq18Handler; - + /// /// The use of these fields is IBV dependent. They can be used to flag that an OpROM /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup - /// + /// UINT32 AdditionalIrq19Handler; - + /// /// The use of these fields is IBV dependent. They can be used to flag that an OpROM /// has hooked the specified IRQ. The OpROM may be BBS compliant as some SCSI /// BBS-compliant OpROMs also hook IRQ vectors in order to run their BIOS Setup - /// + /// UINT32 AdditionalIrq40Handler; UINT8 AssignedDriveNumber; UINT32 AdditionalIrq41Handler; @@ -XXX,XX +XXX,XX @@ typedef struct { /// values are reserved for future usage. /// UINT16 Type : 3; - + /// /// The size of "port" in bits. Defined values are below. /// UINT16 PortGranularity : 3; - + /// /// The size of data in bits. Defined values are below. /// UINT16 DataGranularity : 3; - + /// /// Reserved for future use. /// @@ -XXX,XX +XXX,XX @@ typedef struct { /// SMM_ATTRIBUTES is defined below. /// SMM_ATTRIBUTES SmmAttributes; - + /// /// Function Soft SMI is to perform. Type SMM_FUNCTION is defined below. /// SMM_FUNCTION SmmFunction; - + /// /// SmmPort size depends upon SmmAttributes and ranges from2 bytes to 16 bytes. /// UINT8 SmmPort; - + /// /// SmmData size depends upon SmmAttributes and ranges from2 bytes to 16 bytes. /// @@ -XXX,XX +XXX,XX @@ typedef struct { /// This bit set indicates that the ServiceAreaData is valid. /// UINT8 DirectoryServiceValidity : 1; - + /// /// This bit set indicates to use the Reserve Area Boot Code Address (RACBA) only if /// DirectoryServiceValidity is 0. /// UINT8 RabcaUsedFlag : 1; - + /// /// This bit set indicates to execute hard disk diagnostics. /// UINT8 ExecuteHddDiagnosticsFlag : 1; - + /// /// Reserved for future use. Set to 0. /// @@ -XXX,XX +XXX,XX @@ typedef struct { /// UDC_ATTRIBUTES is defined below. /// UDC_ATTRIBUTES Attributes; - + /// /// This field contains the zero-based device on which the selected - /// ServiceDataArea is present. It is 0 for master and 1 for the slave device. + /// ServiceDataArea is present. It is 0 for master and 1 for the slave device. /// UINT8 DeviceNumber; - + /// /// This field contains the zero-based index into the BbsTable for the parent device. /// This index allows the user to reference the parent device information such as PCI /// bus, device function. /// UINT8 BbsTableEntryNumberForParentDevice; - + /// /// This field contains the zero-based index into the BbsTable for the boot entry. /// UINT8 BbsTableEntryNumberForBoot; - + /// /// This field contains the zero-based index into the BbsTable for the HDD diagnostics entry. /// UINT8 BbsTableEntryNumberForHddDiag; - + /// /// The raw Beer data. /// UINT8 BeerData[128]; - + /// /// The raw data of selected service area. /// @@ -XXX,XX +XXX,XX @@ typedef struct { UINT16 SecondaryBusMaster; ///< The secondary device bus master I/O base. } EFI_LEGACY_INSTALL_PCI_HANDLER; +#pragma pack() + #endif -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Adjusted the indentation of the vring_get_buf function call to improve code readability and maintain consistency with surrounding code. Fix warning: In file included from out/ccode32flat.o.tmp.c:83: ./src/hw/virtio-blk.c:56:9: warning: misleading indentation; statement is not part of the previous 'while' [-Wmisleading-indentation] 56 | vring_get_buf(vq, NULL); Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- src/hw/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index XXXXXXX..XXXXXXX 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -XXX,XX +XXX,XX @@ virtio_blk_op_one_segment(struct virtiodrive_s *vdrive, usleep(5); /* Reclaim virtqueue element */ - vring_get_buf(vq, NULL); + vring_get_buf(vq, NULL); /** ** Clear interrupt status register. Avoid leaving interrupts stuck -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org
Corrected the logical condition in the start_ohci function to ensure proper evaluation of the status variable. This change prevents potential misinterpretation of the command status register. Fix warning: ./src/hw/usb-ohci.c:192:13: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses] 192 | if (! status & OHCI_HCR) Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- src/hw/usb-ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw/usb-ohci.c b/src/hw/usb-ohci.c index XXXXXXX..XXXXXXX 100644 --- a/src/hw/usb-ohci.c +++ b/src/hw/usb-ohci.c @@ -XXX,XX +XXX,XX @@ start_ohci(struct usb_ohci_s *cntl, struct ohci_hcca *hcca) writel(&cntl->regs->cmdstatus, OHCI_HCR); for (;;) { u32 status = readl(&cntl->regs->cmdstatus); - if (! status & OHCI_HCR) + if (!(status & OHCI_HCR)) break; if (timer_check(end)) { warn_timeout(); -- 2.43.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org