os: name sd_card_drv unambigously (ref #2190)

This commit is contained in:
Stefan Kalkowski 2019-05-03 22:49:19 +02:00 committed by Christian Helmuth
parent 4e6b571a36
commit d18d2d0d9b
30 changed files with 125 additions and 146 deletions

View File

@ -10,7 +10,7 @@ if {[have_spec odroid_xu] || [have_spec zynq]} {
}
# use SD on ARM
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_sd_card_drv [expr [have_spec pbxa9]]
# use AHCI on x86
set use_ahci [expr [have_spec x86] && ![have_spec linux]]
@ -94,7 +94,7 @@ append_if $use_ahci config {
</start>}
append_if $use_sd_card_drv config {
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>
@ -129,7 +129,7 @@ set boot_modules {
test-fatfs_block_io
}
lappend_if $use_sd_card_drv boot_modules sd_card_drv
lappend_if $use_sd_card_drv boot_modules pbxa9_sd_card_drv
lappend_if $use_ram_block boot_modules test.hda
append_platform_drv_boot_modules

View File

@ -1,10 +1,7 @@
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_sd_card_drv [expr [have_spec pbxa9]]
set use_ahci_drv [expr [have_spec x86] && ![have_spec linux]]
set use_ram_block [have_spec linux]
if {[have_spec odroid_xu]} {
puts "Run script does not support this platform"; exit }
if {[expr ![have_include "power_on/qemu"] && !$use_ram_block]} {
puts "\nPlease setup your native sd or hard drive. Remove this fail stop";
puts "check when you have prepared your native environment.\n";
@ -81,7 +78,7 @@ append_if $use_ahci_drv config {
}
append_if $use_sd_card_drv config {
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>
@ -112,7 +109,7 @@ set boot_modules {
}
lappend_if $use_ahci_drv boot_modules ahci_drv
lappend_if $use_sd_card_drv boot_modules sd_card_drv
lappend_if $use_sd_card_drv boot_modules pbxa9_sd_card_drv
lappend_if $use_ram_block boot_modules ram_block
lappend_if $use_ram_block boot_modules test.hda

View File

@ -10,7 +10,7 @@ if {[have_spec odroid_xu] || [have_spec zynq]} {
}
# use SD on ARM
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_sd_card_drv [expr [have_spec pbxa9]]
# use AHCI on x86
set use_ahci [expr [have_spec x86] && ![have_spec linux]]
@ -110,7 +110,7 @@ append_if $use_ahci config {
</start>}
append_if $use_sd_card_drv config {
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>
@ -144,7 +144,7 @@ append boot_modules " "
append boot_modules libc_$filesystem.lib.so
lappend_if $use_ahci boot_modules ahci_drv
lappend_if $use_sd_card_drv boot_modules sd_card_drv
lappend_if $use_sd_card_drv boot_modules pbxa9_sd_card_drv
lappend_if $use_ram_block boot_modules ram_block
lappend_if $use_ram_block boot_modules test.hda

View File

@ -20,7 +20,7 @@ if {[have_spec odroid_xu] || [have_spec zynq]} {
}
# use SD on ARM
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_sd_card_drv [expr [have_spec pbxa9]]
# use AHCI on x86
set use_ahci [expr [have_spec x86] && ![have_spec linux]]
@ -122,7 +122,7 @@ append_if $use_ahci config {
</start>}
append_if $use_sd_card_drv config {
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>
@ -165,7 +165,7 @@ append boot_modules {
lappend boot_modules {*}$test_boot_modules
lappend_if $use_sd_card_drv boot_modules sd_card_drv
lappend_if $use_sd_card_drv boot_modules pbxa9_sd_card_drv
lappend_if $use_ram_block boot_modules test.hda
append_platform_drv_boot_modules

View File

@ -4,12 +4,12 @@
# \date 2017-06-13
#
set use_sd_card_drv [expr [have_spec omap4] || [have_spec arndale] || [have_spec pl180]]
set use_sd_card_drv [expr [have_spec pbxa9]]
set use_ahci_drv [expr [have_spec x86] && ![have_spec linux]]
set use_ram_block [have_spec linux]
set mkfs [installed_command $mkfs_cmd]
if {[have_spec odroid_xu]} {
if {[expr ![have_spec pbxa9] && ![have_spec x86]]} {
puts "Run script does not support this platform"; exit }
#
@ -99,7 +99,7 @@ append_if $use_ahci_drv config {
}
append_if $use_sd_card_drv config {
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>
@ -132,7 +132,7 @@ set boot_modules {
lappend boot_modules $binary
lappend_if $use_ahci_drv boot_modules ahci_drv
lappend_if $use_sd_card_drv boot_modules sd_card_drv
lappend_if $use_sd_card_drv boot_modules pbxa9_sd_card_drv
lappend_if $use_ram_block boot_modules ram_block
lappend_if $use_ram_block boot_modules test.hda

View File

@ -16,10 +16,8 @@ if {[have_spec odroid_xu]} {
append build_components [qt5_build_components feature]
set use_sd_card_driver [expr [have_spec omap4] || [have_spec arndale]]
set use_ahci_driver [expr [have_spec x86] && ![have_spec linux]]
lappend_if $use_sd_card_driver build_components drivers/sd_card
lappend_if $use_ahci_driver build_components drivers/ahci
lappend_if [have_spec acpi] build_components drivers/acpi
lappend_if [have_spec linux] build_components server/ram_fs
@ -53,12 +51,6 @@ append_if $use_ahci_driver config {
</config>
</start>}
append_if $use_sd_card_driver config {
<start name="sd_card_drv">
<resource name="RAM" quantum="1M" />
<provides><service name="Block"/></provides>
</start>}
append_if [have_spec linux] config {
<start name="ram_fs">
<resource name="RAM" quantum="10M"/>
@ -136,7 +128,6 @@ append boot_modules [qt5_boot_modules feature]
# platform-specific modules
lappend_if [have_spec linux] boot_modules ram_fs
lappend_if [expr ![have_spec linux]] boot_modules fatfs_fs
lappend_if $use_sd_card_driver boot_modules sd_card_drv
lappend_if $use_ahci_driver boot_modules ahci_drv
build_boot_image $boot_modules

View File

@ -1,15 +0,0 @@
ifeq ($(filter-out $(SPECS),exynos5),)
SPEC = exynos5
else ifeq ($(filter-out $(SPECS),imx53),)
SPEC = imx
else ifeq ($(filter-out $(SPECS),imx6),)
SPEC = imx
else ifeq ($(filter-out $(SPECS),omap4),)
SPEC = omap4
else ifeq ($(filter-out $(SPECS),pbxa9),)
SPEC = pbxa9
else ifeq ($(filter-out $(SPECS),rpi),)
SPEC = rpi
endif
INC_DIR += $(REP_DIR)/src/drivers/sd_card $(REP_DIR)/src/drivers/sd_card/spec/$(SPEC)

View File

@ -1,6 +0,0 @@
SRC_CC += spec/exynos5/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += adma2.cc spec/imx53/driver.cc spec/imx/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += adma2.cc spec/imx/driver.cc spec/imx6/driver.cc spec/imx6q_sabrelite/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += adma2.cc spec/imx/driver.cc spec/imx6/driver.cc spec/nit6_solox/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += spec/omap4/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += spec/pbxa9/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -1,6 +0,0 @@
SRC_CC += spec/rpi/driver.cc
LIBS += base
vpath %.cc $(REP_DIR)/src/drivers/sd_card
include $(REP_DIR)/lib/import/import-sd_card_drv.mk

View File

@ -2,6 +2,8 @@
# Build
#
assert_spec pbxa9
# generic components
set build_components {
core init
@ -44,7 +46,7 @@ append config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="sd_card_drv">
<start name="pbxa9_sd_card_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Block"/></provides>
</start>
@ -63,7 +65,7 @@ install_config $config
# generic modules
set boot_modules {
core ld.lib.so init timer
sd_card_drv
pbxa9_sd_card_drv
test-block-client
}

View File

@ -2,27 +2,34 @@
# Check for platform support
#
if {[have_spec pl180]} { set buffer_size_kib [expr 12 * 1024]
} elseif {[have_spec imx6]} { set buffer_size_kib [expr 1024]
} elseif {[have_spec imx53] &&
![have_spec foc]} { set buffer_size_kib [expr 1024]
} elseif {[have_spec rpi]} { set buffer_size_kib [expr 4 * 1024]
} elseif {[have_spec omap4]} { set buffer_size_kib [expr 4 * 1024]
} elseif {[have_spec arndale]} { set buffer_size_kib [expr 1024]
} else {
proc buffer_size_kib {} {
if {[have_spec pl180]} { return [expr 12 * 1024] }
if {[have_spec imx6]} { return [expr 1024] }
if {[have_spec imx53] &&
![have_spec foc]} { return [expr 1024] }
if {[have_spec rpi]} { return [expr 4 * 1024] }
if {[have_spec omap4]} { return [expr 4 * 1024] }
if {[have_spec arndale]} { return [expr 1024] }
puts "\n Run script is not supported on this platform. \n";
exit 0;
}
proc sd_card_drv {} {
if {[have_spec pbxa9]} { return pbxa9_sd_card_drv }
if {[have_spec imx6q_sabrelite]} { return imx6q_sabrelite_sd_card_drv }
if {[have_spec imx53]} { return imx53_sd_card_drv }
if {[have_spec rpi]} { return rpi_sd_card_drv }
if {[have_spec omap4]} { return omap4_sd_card_drv }
if {[have_spec arndale]} { return arndale_sd_card_drv }
puts "\n Run script is not supported on this platform. \n";
exit 0;
}
#
# Build the boot modules
#
set build_components {
core init timer
test/sd_card_bench
}
set build_components { core init timer drivers/sd_card }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
@ -57,13 +64,10 @@ append config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="sd_card_bench">
<start name="} [sd_card_drv] {">
<resource name="RAM" quantum="16M"/>
<provides><service name="Block"/></provides>}
append config "<config buffer_size_kib=\"$buffer_size_kib\"/>"
append config {
<provides><service name="Block"/></provides>
<config benchmark="yes" buffer_size_kib="} [buffer_size_kib] {"/>
</start>
</config>}
@ -77,9 +81,9 @@ install_config $config
set boot_modules {
core ld.lib.so init
timer
sd_card_bench
}
append boot_modules [sd_card_drv]
append_platform_drv_boot_modules
build_boot_image $boot_modules

View File

@ -155,7 +155,7 @@ append_if $mmc_rootfs config {
<service name="Platform"/>
</provides>
</start>
<start name="sd_card_drv">
<start name="imx53_sd_card_drv">
<resource name="RAM" quantum="3M"/>
<provides><service name="Block"/></provides>
</start>
@ -163,7 +163,7 @@ append_if $mmc_rootfs config {
<resource name="RAM" quantum="10M" />
<provides><service name="Block" /></provides>
<route>
<service name="Block"><child name="sd_card_drv" /></service>
<service name="Block"><child name="imx53_sd_card_drv" /></service>
<any-service><parent/><any-child/></any-service>
</route>
<config>
@ -229,7 +229,7 @@ if { $mmc_rootfs } {
# add components that enable MMC access via parvirtualized block
lappend boot_modules timer
lappend boot_modules imx53_platform_drv
lappend boot_modules sd_card_drv
lappend boot_modules imx53_sd_card_drv
lappend boot_modules part_block
# download and add rootfs

View File

@ -13,7 +13,6 @@
*/
/* Genode includes */
#include <base/component.h>
#include <timer_session/connection.h>
#include <base/attached_ram_dataspace.h>
#include <base/attached_rom_dataspace.h>
@ -24,7 +23,7 @@
using namespace Genode;
struct Main
struct Benchmark
{
using Packet_descriptor = Block::Packet_descriptor;
@ -48,28 +47,28 @@ struct Main
}
};
Env &env;
Packet_descriptor pkt { };
uint64_t time_before_ms { };
Timer::Connection timer { env };
Operation operation { READ };
Signal_handler<Main> ack_handler { env.ep(), *this, &Main::update_state };
Driver_session drv_session { ack_handler };
Sd_card::Driver drv { env };
size_t const buf_size_kib { Attached_rom_dataspace(env, "config")
.xml().attribute_value("buffer_size_kib",
(size_t)0) };
size_t const buf_size { buf_size_kib * 1024 };
Attached_ram_dataspace buf { env.ram(), env.rm(), buf_size, UNCACHED };
char *buf_virt { buf.local_addr<char>() };
addr_t buf_phys { Dataspace_client(buf.cap())
.phys_addr() };
size_t buf_off_done { 0 };
size_t buf_off_pend { 0 };
unsigned req_size_id { 0 };
size_t req_sizes[9] { 512, 1024, 1024 * 2, 1024 * 4,
1024 * 8, 1024 * 16, 1024 * 32,
1024 * 64, 1024 * 128 };
Env &env;
Attached_rom_dataspace config { env, "config" };
Packet_descriptor pkt { };
uint64_t time_before_ms { };
Timer::Connection timer { env };
Operation operation { READ };
Signal_handler<Benchmark> ack_handler { env.ep(), *this, &Benchmark::update_state };
Driver_session drv_session { ack_handler };
Sd_card::Driver drv { env };
size_t const buf_size_kib { config.xml().attribute_value("buffer_size_kib",
(size_t)0) };
size_t const buf_size { buf_size_kib * 1024 };
Attached_ram_dataspace buf { env.ram(), env.rm(), buf_size, UNCACHED };
char *buf_virt { buf.local_addr<char>() };
addr_t buf_phys { Dataspace_client(buf.cap())
.phys_addr() };
size_t buf_off_done { 0 };
size_t buf_off_pend { 0 };
unsigned req_size_id { 0 };
size_t req_sizes[9] { 512, 1024, 1024 * 2, 1024 * 4,
1024 * 8, 1024 * 16, 1024 * 32,
1024 * 64, 1024 * 128 };
size_t req_size() const { return req_sizes[req_size_id]; }
@ -142,7 +141,7 @@ struct Main
} catch (Block::Driver::Request_congestion) { }
}
Main(Env &env) : env(env)
Benchmark(Env &env) : env(env)
{
log("");
log("--- SD card benchmark (", drv.dma_enabled() ? "with" : "no", " DMA) ---");
@ -162,9 +161,6 @@ struct Main
/*
* Noncopyable
*/
Main(Main const &);
Main &operator = (Main const &);
Benchmark(Benchmark const &);
Benchmark &operator = (Benchmark const &);
};
void Component::construct(Genode::Env &env) { static Main main(env); }

View File

@ -19,6 +19,7 @@
#include <block/component.h>
/* local includes */
#include <benchmark.h>
#include <driver.h>
using namespace Genode;
@ -53,4 +54,14 @@ struct Main
};
void Component::construct(Genode::Env &env) { static Main main(env); }
void Component::construct(Genode::Env &env)
{
bool benchmark = false;
try {
Attached_rom_dataspace config { env, "config" };
benchmark = config.xml().attribute_value("benchmark", false);
} catch(...) {}
if (benchmark) static Benchmark bench(env);
else static Main main(env);
}

View File

@ -0,0 +1,5 @@
TARGET = exynos5_sd_card_drv
REQUIRES = arm_v7
INC_DIR = $(call select_from_repositories,include/spec/exynos5)
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,6 @@
TARGET = imx53_sd_card_drv
REQUIRES = arm_v7
SRC_CC = adma2.cc spec/imx/driver.cc
INC_DIR = $(REP_DIR)/src/drivers/sd_card/spec/imx
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,6 @@
TARGET = imx6q_sabrelite_sd_card_drv
REQUIRES = arm_v7
SRC_CC += adma2.cc spec/imx/driver.cc spec/imx6/driver.cc
INC_DIR = $(REP_DIR)/src/drivers/sd_card/spec/imx
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,6 @@
TARGET = nit6_solox_sd_card_drv
REQUIRES = arm_v7
SRC_CC = adma2.cc spec/imx/driver.cc spec/imx6/driver.cc
INC_DIR = $(REP_DIR)/src/drivers/sd_card/spec/imx
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,4 @@
TARGET = omap4_sd_card_drv
REQUIRES = arm_v7
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,4 @@
TARGET = pbxa9_sd_card_drv
REQUIRES = arm_v7
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,4 @@
TARGET = rpi_sd_card_drv
REQUIRES = arm_v6
include $(REP_DIR)/src/drivers/sd_card/target.inc

View File

@ -0,0 +1,6 @@
SRC_CC += main.cc driver.cc
LIBS += base
INC_DIR += $(PRG_DIR) $(REP_DIR)/src/drivers/sd_card
vpath %.cc $(REP_DIR)/src/drivers/sd_card
vpath %.cc $(PRG_DIR)

View File

@ -1,3 +0,0 @@
TARGET = sd_card_drv
LIBS = sd_card_drv
SRC_CC = main.cc

View File

@ -1,3 +0,0 @@
TARGET = sd_card_bench
LIBS = sd_card_drv
SRC_CC = main.cc