1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

Makefile: replace RAW_ACCESS with RAW_MEM_ACCESS X86_MSR X86_PORT_IO

Let programmer only depend on the kind of hardware access method they
really need. Libpci no longer depends on all hardware access types since
each programmer handles this individually.

Change-Id: I5bdafaa3c5023ad6c4a695493eeddf11bc148085
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/60325
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Thomas Heijligen
2021-12-23 16:55:16 +01:00
committed by Nico Huber
parent 64b9e3f59e
commit 980cf7d31f
2 changed files with 21 additions and 22 deletions

View File

@ -612,7 +612,6 @@ endif
ifeq ($(CONFIG_RAYER_SPI), yes) ifeq ($(CONFIG_RAYER_SPI), yes)
FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1' FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1'
PROGRAMMER_OBJS += rayer_spi.o PROGRAMMER_OBJS += rayer_spi.o
NEED_RAW_ACCESS += CONFIG_RAYER_SPI
endif endif
ifeq ($(CONFIG_RAIDEN_DEBUG_SPI), yes) ifeq ($(CONFIG_RAIDEN_DEBUG_SPI), yes)
@ -814,10 +813,6 @@ endif
NEED_LIBPCI := $(call filter_deps,$(DEPENDS_ON_LIBPCI)) NEED_LIBPCI := $(call filter_deps,$(DEPENDS_ON_LIBPCI))
ifneq ($(NEED_LIBPCI), ) ifneq ($(NEED_LIBPCI), )
CHECK_LIBPCI = yes CHECK_LIBPCI = yes
# This is a dirty hack, but it saves us from checking all PCI drivers and all platforms manually.
# libpci may need raw memory, MSR or PCI port I/O on some platforms.
# Individual drivers might have the same needs as well.
NEED_RAW_ACCESS += $(NEED_LIBPCI)
FEATURE_CFLAGS += -D'NEED_PCI=1' FEATURE_CFLAGS += -D'NEED_PCI=1'
FEATURE_CFLAGS += $(call debug_shell,grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'") FEATURE_CFLAGS += $(call debug_shell,grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'")
@ -830,27 +825,32 @@ PCILIBS += -lpci
endif endif
endif endif
ifneq ($(NEED_RAW_ACCESS), ) USE_X86_MSR := $(if $(call filter_deps,$(DEPENDS_ON_X86_MSR)),yes,no)
# Raw memory, MSR or PCI port I/O access. ifeq ($(USE_X86_MSR), yes)
FEATURE_CFLAGS += -D'NEED_RAW_ACCESS=1' PROGRAMMER_OBJS += hwaccess_x86_msr.o
PROGRAMMER_OBJS += hwaccess_physmap.o endif
ifeq ($(ARCH), x86) USE_X86_PORT_IO := $(if $(call filter_deps,$(DEPENDS_ON_X86_PORT_IO)),yes,no)
ifeq ($(USE_X86_PORT_IO), yes)
FEATURE_CFLAGS += -D'__FLASHROM_HAVE_OUTB__=1' FEATURE_CFLAGS += -D'__FLASHROM_HAVE_OUTB__=1'
PROGRAMMER_OBJS += hwaccess_x86_io.o hwaccess_x86_msr.o PROGRAMMER_OBJS += hwaccess_x86_io.o
ifeq ($(TARGET_OS), NetBSD)
PCILIBS += -l$(shell uname -p)
endif
ifeq ($(TARGET_OS), OpenBSD)
PCILIBS += -l$(shell uname -m)
endif
endif endif
ifeq ($(TARGET_OS), Darwin) USE_RAW_MEM_ACCESS := $(if $(call filter_deps,$(DEPENDS_ON_RAW_MEM_ACCESS)),yes,no)
# DirectHW framework can be found in the DirectHW library. ifeq ($(USE_RAW_MEM_ACCESS), yes)
PCILIBS += -framework IOKit -framework DirectHW PROGRAMMER_OBJS += hwaccess_physmap.o
endif endif
ifeq (Darwin yes, $(TARGET_OS) $(filter $(USE_X86_MSR) $(USE_X86_PORT_IO) $(USE_RAW_MEM_ACCESS), yes))
override LDFLAGS += -framework IOKit -framework DirectHW
endif
ifeq (NetBSD yes, $(TARGET_OS) $(filter $(USE_X86_MSR) $(USE_X86_PORT_IO), yes))
override LDFLAGS += -l$(shell uname -p)
endif
ifeq (OpenBSD yes, $(TARGET_OS) $(filter $(USE_X86_MSR) $(USE_X86_PORT_IO), yes))
override LDFLAGS += -l$(shell uname -m)
endif endif
USE_LIBUSB1 := $(if $(call filter_deps,$(DEPENDS_ON_LIBUSB1)),yes,no) USE_LIBUSB1 := $(if $(call filter_deps,$(DEPENDS_ON_LIBUSB1)),yes,no)

View File

@ -349,7 +349,6 @@ if need_raw_access
srcs += 'hwaccess_x86_io.c' srcs += 'hwaccess_x86_io.c'
srcs += 'hwaccess_x86_msr.c' srcs += 'hwaccess_x86_msr.c'
srcs += 'hwaccess_physmap.c' srcs += 'hwaccess_physmap.c'
cargs += '-DNEED_RAW_ACCESS=1'
cargs += '-D__FLASHROM_HAVE_OUTB__=1' cargs += '-D__FLASHROM_HAVE_OUTB__=1'
endif endif