From 03cec5cdd7be8d5cd3819ae29be9ec3765a68c7f Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 9 Sep 2022 11:49:07 +0200 Subject: [PATCH] dde_bsd: use generic platform API Ref genodelabs/genode#4578 --- repos/dde_bsd/README | 6 +- repos/dde_bsd/audio.list | 5 - repos/dde_bsd/lib/mk/dde_bsd_audio.inc | 2 +- repos/dde_bsd/lib/mk/dde_bsd_audio_pci.inc | 13 + repos/dde_bsd/lib/mk/dde_bsd_audio_pci.mk | 49 -- .../lib/mk/spec/x86_32/dde_bsd_audio.mk | 2 +- .../lib/mk/spec/x86_64/dde_bsd_audio.mk | 2 +- repos/dde_bsd/ports/dde_bsd.hash | 2 +- .../recipes/src/bsd_audio_drv/content.mk | 7 +- repos/dde_bsd/run/audio_out.run | 156 +++--- .../src/drivers/audio/pci_audio_drv/target.mk | 2 +- repos/dde_bsd/src/lib/audio/bsd.h | 17 - repos/dde_bsd/src/lib/audio/bsd_emul_pci.c | 2 - repos/dde_bsd/src/lib/audio/driver.cc | 1 - repos/dde_bsd/src/lib/audio/irq.cc | 161 ------ repos/dde_bsd/src/lib/audio/pci.cc | 521 ++++++++---------- 16 files changed, 317 insertions(+), 631 deletions(-) create mode 100644 repos/dde_bsd/lib/mk/dde_bsd_audio_pci.inc delete mode 100644 repos/dde_bsd/lib/mk/dde_bsd_audio_pci.mk delete mode 100644 repos/dde_bsd/src/lib/audio/irq.cc diff --git a/repos/dde_bsd/README b/repos/dde_bsd/README index 9bdd3e131c..9f30b6d92c 100644 --- a/repos/dde_bsd/README +++ b/repos/dde_bsd/README @@ -4,10 +4,8 @@ Audio ##### The audio driver is ported from OpenBSD 6.6 and includes support for -Intel HD Audio, ICH as well as for Ensoniq AudioPCI (ES1370) compatible -soundcards. The HDA driver works on real hardware and Virtualbox -whereas the ES1370 driver is only used in Qemu. The ICH driver is only -tested in Virtualbox where it produces audible artifacts. +Intel HD Audio devices. The HDA driver works on real hardware and +supposedly in VirtualBox. Usage and configuration diff --git a/repos/dde_bsd/audio.list b/repos/dde_bsd/audio.list index fa48dbcc7a..af13f3c404 100644 --- a/repos/dde_bsd/audio.list +++ b/repos/dde_bsd/audio.list @@ -1,18 +1,13 @@ sys/lib/libkern/strlcpy.c sys/dev/audio.c sys/dev/audio_if.h -sys/dev/pci/auich.c sys/dev/pci/azalia.c sys/dev/pci/azalia.h sys/dev/pci/azalia_codec.c -sys/dev/pci/eap.c -sys/dev/pci/eapreg.h sys/dev/pci/pcidevs.h sys/dev/pci/pcidevs_data.h sys/dev/mulaw.c sys/dev/mulaw.h -sys/dev/ic/ac97.c -sys/dev/ic/ac97.h sys/sys/audioio.h sys/sys/device.h sys/sys/queue.h diff --git a/repos/dde_bsd/lib/mk/dde_bsd_audio.inc b/repos/dde_bsd/lib/mk/dde_bsd_audio.inc index 2bb34dc03c..75a3b1d454 100644 --- a/repos/dde_bsd/lib/mk/dde_bsd_audio.inc +++ b/repos/dde_bsd/lib/mk/dde_bsd_audio.inc @@ -13,7 +13,7 @@ INC_DIR += $(AUDIO_CONTRIB_DIR) LIBS += dde_bsd_audio_include -SRC_CC += dummies.cc driver.cc irq.cc mem.cc misc.cc scheduler.cc timer.cc +SRC_CC += dummies.cc driver.cc mem.cc misc.cc scheduler.cc timer.cc SRC_C += bsd_emul.c SRC_S += setjmp.S diff --git a/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.inc b/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.inc new file mode 100644 index 0000000000..448f2f3c94 --- /dev/null +++ b/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.inc @@ -0,0 +1,13 @@ +include $(REP_DIR)/lib/mk/dde_bsd_audio.inc + +SRC_C += bsd_emul_pci.c +SRC_CC += pci.cc + +# enable when debugging +#CC_OPT += -DAZALIA_DEBUG +#CC_OPT += -DDIAGNOSTIC + +# HDA driver +SRC_C += dev/pci/azalia.c dev/pci/azalia_codec.c + +# vi: set ft=make : diff --git a/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.mk b/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.mk deleted file mode 100644 index 6518114a49..0000000000 --- a/repos/dde_bsd/lib/mk/dde_bsd_audio_pci.mk +++ /dev/null @@ -1,49 +0,0 @@ -LIB_DIR = $(REP_DIR)/src/lib/audio -LIB_INC_DIR = $(LIB_DIR)/include - -AUDIO_CONTRIB_DIR := $(call select_from_ports,dde_bsd)/src/lib/audio - -# -# Set include paths up before adding the dde_bsd_audio_include library -# because it will use INC_DIR += and must be at the end -# -INC_DIR += $(LIB_DIR) -INC_DIR += $(LIB_INC_DIR) -INC_DIR += $(AUDIO_CONTRIB_DIR) - -LIBS += dde_bsd_audio_include - -SRC_C := bsd_emul_pci.c -SRC_CC += pci.cc - -CC_OPT += -Wno-unused-but-set-variable - -# disable builtins -CC_OPT += -fno-builtin-printf -fno-builtin-snprintf -fno-builtin-vsnprintf \ - -fno-builtin-malloc -fno-builtin-free -fno-builtin-log -fno-builtin-log2 - -CC_OPT += -D_KERNEL - -# enable when debugging -#CC_OPT += -DAC97_DEBUG -#CC_OPT += -DAUICH_DEBUG -#CC_OPT += -DAZALIA_DEBUG -#CC_OPT += -DDIAGNOSTIC - -# AC97 codec -SRC_C += dev/ic/ac97.c - -# HDA driver -SRC_C += dev/pci/azalia.c dev/pci/azalia_codec.c - -# ICH driver -SRC_C += dev/pci/auich.c - -# ES1370 -SRC_C += dev/pci/eap.c - -vpath %.c $(AUDIO_CONTRIB_DIR) -vpath %.c $(LIB_DIR) -vpath %.cc $(LIB_DIR) - -# vi: set ft=make : diff --git a/repos/dde_bsd/lib/mk/spec/x86_32/dde_bsd_audio.mk b/repos/dde_bsd/lib/mk/spec/x86_32/dde_bsd_audio.mk index 98f3796d58..357ca1c22c 100644 --- a/repos/dde_bsd/lib/mk/spec/x86_32/dde_bsd_audio.mk +++ b/repos/dde_bsd/lib/mk/spec/x86_32/dde_bsd_audio.mk @@ -1,6 +1,6 @@ INC_DIR += $(LIB_INC_DIR)/spec/x86_32 $(LIB_INC_DIR)/spec/x86 -include $(REP_DIR)/lib/mk/dde_bsd_audio.inc +include $(REP_DIR)/lib/mk/dde_bsd_audio_pci.inc vpath %.S $(LIB_DIR)/spec/x86_32 diff --git a/repos/dde_bsd/lib/mk/spec/x86_64/dde_bsd_audio.mk b/repos/dde_bsd/lib/mk/spec/x86_64/dde_bsd_audio.mk index fe3e57dfae..e573623a53 100644 --- a/repos/dde_bsd/lib/mk/spec/x86_64/dde_bsd_audio.mk +++ b/repos/dde_bsd/lib/mk/spec/x86_64/dde_bsd_audio.mk @@ -1,6 +1,6 @@ INC_DIR += $(LIB_INC_DIR)/spec/x86_64 $(LIB_INC_DIR)/spec/x86 -include $(REP_DIR)/lib/mk/dde_bsd_audio.inc +include $(REP_DIR)/lib/mk/dde_bsd_audio_pci.inc vpath %.S $(LIB_DIR)/spec/x86_64 diff --git a/repos/dde_bsd/ports/dde_bsd.hash b/repos/dde_bsd/ports/dde_bsd.hash index a0f7b8dd2c..02274e60a8 100644 --- a/repos/dde_bsd/ports/dde_bsd.hash +++ b/repos/dde_bsd/ports/dde_bsd.hash @@ -1 +1 @@ -4d3a973ccec12ca00589f9213c2ce663d4a4e496 +03360eec0f7a11d523e2b0c88568c95cb691d3ac diff --git a/repos/dde_bsd/recipes/src/bsd_audio_drv/content.mk b/repos/dde_bsd/recipes/src/bsd_audio_drv/content.mk index f104af33c5..01764c9ed0 100644 --- a/repos/dde_bsd/recipes/src/bsd_audio_drv/content.mk +++ b/repos/dde_bsd/recipes/src/bsd_audio_drv/content.mk @@ -1,6 +1,6 @@ PORT_DIR := $(call port_dir,$(REP_DIR)/ports/dde_bsd) -MK_FILES := dde_bsd_audio.inc dde_bsd_audio_include.mk dde_bsd_audio_pci.mk +MK_FILES := dde_bsd_audio.inc dde_bsd_audio_include.mk dde_bsd_audio_pci.inc LIB_MK := $(addprefix lib/mk/, $(MK_FILES)) \ $(foreach SPEC,x86_32 x86_64,lib/mk/spec/$(SPEC)/dde_bsd_audio.mk) \ @@ -11,18 +11,13 @@ MIRROR_FROM_REP_DIR := $(LIB_MK) src/lib src/drivers patches include MIRROR_FROM_PORT_DIR := $(addprefix src/lib/audio/, \ dev/pci/azalia_codec.c \ dev/pci/pcidevs.h \ - dev/pci/eap.c \ dev/pci/pcidevs_data.h \ dev/pci/azalia.h \ - dev/pci/eapreg.h \ dev/pci/azalia.c \ - dev/pci/auich.c \ dev/mulaw.h \ dev/audio_if.h \ dev/mulaw.c \ dev/audio.c \ - dev/ic/ac97.h \ - dev/ic/ac97.c \ lib/libkern \ sys/device.h \ sys/audioio.h \ diff --git a/repos/dde_bsd/run/audio_out.run b/repos/dde_bsd/run/audio_out.run index 462a23d43f..c83bb0a629 100644 --- a/repos/dde_bsd/run/audio_out.run +++ b/repos/dde_bsd/run/audio_out.run @@ -1,47 +1,33 @@ assert_spec x86 -# -# Check used commands -# +if {[have_include "power_on/qemu"]} { + puts "\nAudio_out test running on Qemu is not supported.\n" + exit 0 +} -set wget [installed_command wget] +if {[have_spec linux]} { + puts"\nAudio_out test running on Linux is not supported.\n" + exit 0 +} -# -# Configure -# -set use_mixer 0 - -# -# Build -# - -set build_components { +create_boot_directory +build { core init timer + drivers/acpi + drivers/platform + app/pci_decode + server/report_rom drivers/audio test/audio_out } -lappend_if $use_mixer build_components server/mixer - -source ${genode_dir}/repos/base/run/platform_drv.inc -append_platform_drv_build_components - -build $build_components - -create_boot_directory - -# -# Config -# - -append config { - +install_config { + - @@ -54,60 +40,86 @@ append config { - } + -append_platform_drv_config - -append_if $use_mixer config { - + - - - - - - } + + + + + + -append_if [have_spec linux] config { - } -append_if [expr ![have_spec linux]] config { - } -append config { - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + sample.raw - } -append_if $use_mixer config { - } -append config { + } -install_config $config - - # # Get sample file # -if {[info exists env(GENODE_SAMPLE_RAW)]} { - catch { exec $wget $::env(GENODE_SAMPLE_RAW) -O bin/sample.raw } -} - if {![file exists bin/sample.raw]} { puts "" puts "The sample file is missing. Please take a look at" @@ -117,22 +129,12 @@ if {![file exists bin/sample.raw]} { exit 1 } -# -# Boot modules -# - -append boot_modules { - core ld.lib.so init timer } [audio_drv_binary] { - test-audio_out sample.raw +build_boot_image { + core ld.lib.so init timer + platform_drv acpi_drv pci_decode report_rom + pci_audio_drv test-audio_out sample.raw } -lappend_if $use_mixer boot_modules mixer - -append_platform_drv_boot_modules - -build_boot_image $boot_modules - -append qemu_args " -nographic -soundhw es1370 " # # For obvious reasons the timeout depends on the total diff --git a/repos/dde_bsd/src/drivers/audio/pci_audio_drv/target.mk b/repos/dde_bsd/src/drivers/audio/pci_audio_drv/target.mk index 9f089ea4bd..00a3f837c9 100644 --- a/repos/dde_bsd/src/drivers/audio/pci_audio_drv/target.mk +++ b/repos/dde_bsd/src/drivers/audio/pci_audio_drv/target.mk @@ -1,7 +1,7 @@ REQUIRES = x86 TARGET = pci_audio_drv SRC_CC = main.cc -LIBS = dde_bsd_audio dde_bsd_audio_pci base +LIBS = dde_bsd_audio base INC_DIR += $(REP_DIR)/include vpath %.cc $(REP_DIR)/src/drivers/audio diff --git a/repos/dde_bsd/src/lib/audio/bsd.h b/repos/dde_bsd/src/lib/audio/bsd.h index 8f60c79df7..919a9a05c1 100644 --- a/repos/dde_bsd/src/lib/audio/bsd.h +++ b/repos/dde_bsd/src/lib/audio/bsd.h @@ -24,25 +24,8 @@ namespace Bsd { int probe_drivers(Genode::Env&, Genode::Allocator&); void mem_init(Genode::Env&, Genode::Allocator &); - void irq_init(Genode::Entrypoint&, Genode::Allocator&); void timer_init(Genode::Env&); void update_time(); - - - /************************** - ** Bus_driver interface ** - **************************/ - - struct Bus_driver - { - virtual Genode::Irq_session_capability irq_session() = 0; - - virtual Genode::addr_t alloc(Genode::size_t size, int align) = 0; - virtual void free(Genode::addr_t virt, Genode::size_t size) = 0; - virtual Genode::addr_t virt_to_phys(Genode::addr_t virt) = 0; - virtual Genode::addr_t phys_to_virt(Genode::addr_t phys) = 0; - }; - } #endif /* _BSD_H_ */ diff --git a/repos/dde_bsd/src/lib/audio/bsd_emul_pci.c b/repos/dde_bsd/src/lib/audio/bsd_emul_pci.c index ad0886c663..062d4c3dd6 100644 --- a/repos/dde_bsd/src/lib/audio/bsd_emul_pci.c +++ b/repos/dde_bsd/src/lib/audio/bsd_emul_pci.c @@ -40,8 +40,6 @@ short pv[] = { -1, PCI_BUS_PARENT }; struct cfdata cfdata[] = { {&audio_ca, &audio_cd, 0, 0, 0, 0, pv+0, 0, 0}, {&azalia_ca, &azalia_cd, 0, 0, 0, 0, pv+1, 0, 0}, - {&eap_ca, &eap_cd, 0, 0, 0, 0, pv+1, 0, 0}, - {&auich_ca, &auich_cd, 0, 0, 0, 0, pv+1, 0, 0}, }; diff --git a/repos/dde_bsd/src/lib/audio/driver.cc b/repos/dde_bsd/src/lib/audio/driver.cc index bf8311fef3..85278ce2bd 100644 --- a/repos/dde_bsd/src/lib/audio/driver.cc +++ b/repos/dde_bsd/src/lib/audio/driver.cc @@ -616,7 +616,6 @@ void Audio::init_driver(Genode::Env &env, Genode::Allocator &alloc, Genode::Signal_context_capability announce_sigh) { Bsd::mem_init(env, alloc); - Bsd::irq_init(env.ep(), alloc); Bsd::timer_init(env); static Task bsd_task(env, alloc, config, announce_sigh); diff --git a/repos/dde_bsd/src/lib/audio/irq.cc b/repos/dde_bsd/src/lib/audio/irq.cc deleted file mode 100644 index 1075b33f90..0000000000 --- a/repos/dde_bsd/src/lib/audio/irq.cc +++ /dev/null @@ -1,161 +0,0 @@ -/* - * \brief Signal context for IRQ's - * \author Josef Soentgen - * \date 2014-10-14 - */ - -/* - * Copyright (C) 2014-2020 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -/* Genode includes */ -#include -#include -#include -#include -#include - -/* local includes */ -#include