diff --git a/repos/base-codezero/include/base/ipc_pager.h b/repos/base-codezero/include/base/ipc_pager.h
index 9c2d5ca3f..d671ec90e 100644
--- a/repos/base-codezero/include/base/ipc_pager.h
+++ b/repos/base-codezero/include/base/ipc_pager.h
@@ -14,6 +14,7 @@
#ifndef _INCLUDE__BASE__IPC_PAGER_H_
#define _INCLUDE__BASE__IPC_PAGER_H_
+#include
#include
#include
#include
@@ -37,7 +38,7 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute const cacheability, bool io_mem,
unsigned l2size = PAGE_SIZE_LOG2,
bool rw = true)
:
diff --git a/repos/base-codezero/include/codezero/syscalls.h b/repos/base-codezero/include/codezero/syscalls.h
index 3ebc8371d..d19ad15aa 100644
--- a/repos/base-codezero/include/codezero/syscalls.h
+++ b/repos/base-codezero/include/codezero/syscalls.h
@@ -58,6 +58,15 @@ extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__);
#undef max
#endif
#undef printf
+
+/*
+ * Turn '#define cacheable' (as defined in the codezero headers) into an enum
+ * value. Otherwise, the define will conflict with variables named 'cacheable'.
+ */
+enum { _codezero_cacheable = cacheable /* #define value */ };
+#undef cacheable
+enum { cacheable = _codezero_cacheable };
+
} }
namespace Codezero {
diff --git a/repos/base-fiasco/include/base/ipc_pager.h b/repos/base-fiasco/include/base/ipc_pager.h
index a747e53b9..cdf0299be 100644
--- a/repos/base-fiasco/include/base/ipc_pager.h
+++ b/repos/base-fiasco/include/base/ipc_pager.h
@@ -15,6 +15,7 @@
#define _INCLUDE__BASE__IPC_PAGER_H_
/* Genode includes */
+#include
#include
#include
#include
@@ -41,14 +42,14 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute cacheability, bool io_mem,
unsigned l2size = L4_LOG2_PAGESIZE,
bool rw = true, bool grant = false)
:
_dst_addr(dst_addr),
_fpage(Fiasco::l4_fpage(src_addr, l2size, rw, grant))
{
- if (write_combined)
+ if (cacheability == WRITE_COMBINED)
_fpage.fp.cache = Fiasco::L4_FPAGE_BUFFERABLE;
}
diff --git a/repos/base-foc/include/base/ipc_pager.h b/repos/base-foc/include/base/ipc_pager.h
index 0a4ddd20a..af621377e 100644
--- a/repos/base-foc/include/base/ipc_pager.h
+++ b/repos/base-foc/include/base/ipc_pager.h
@@ -16,6 +16,7 @@
#define _INCLUDE__BASE__IPC_PAGER_H_
/* Genode includes */
+#include
#include
#include
#include
@@ -33,12 +34,13 @@ namespace Genode {
{
private:
- addr_t _dst_addr;
- addr_t _src_addr;
- bool _write_combined;
- unsigned _log2size;
- bool _rw;
- bool _grant;
+ addr_t _dst_addr;
+ addr_t _src_addr;
+ Cache_attribute _cacheability;
+ bool _iomem;
+ unsigned _log2size;
+ bool _rw;
+ bool _grant;
public:
@@ -46,34 +48,30 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute c, bool io_mem,
unsigned l2size = L4_LOG2_PAGESIZE,
bool rw = true, bool grant = false)
: _dst_addr(dst_addr), _src_addr(src_addr),
- _write_combined(write_combined), _log2size(l2size),
+ _cacheability(c), _iomem(io_mem), _log2size(l2size),
_rw(rw), _grant(grant) { }
/**
* Construct invalid flexpage
*/
- Mapping() : _dst_addr(0), _src_addr(0), _write_combined(false),
- _log2size(0), _rw(false), _grant(false) { }
+ Mapping() : _dst_addr(0), _src_addr(0), _cacheability(UNCACHED),
+ _iomem(false), _log2size(0), _rw(false), _grant(false) { }
Fiasco::l4_umword_t dst_addr() const { return _dst_addr; }
bool grant() const { return _grant; }
Fiasco::l4_fpage_t fpage() const
{
- // TODO: write combined
- //if (write_combined)
- // _fpage.fp.cache = Fiasco::L4_FPAGE_BUFFERABLE;
-
unsigned char rights = _rw ? Fiasco::L4_FPAGE_RWX : Fiasco::L4_FPAGE_RX;
return Fiasco::l4_fpage(_src_addr, _log2size, rights);
}
- bool write_combined() const { return _write_combined; }
-
+ Cache_attribute cacheability() const { return _cacheability; }
+ bool iomem() { return _iomem; }
/**
* Prepare map operation is not needed on Fiasco.OC, since we clear the
* dataspace before this function is called.
diff --git a/repos/base-foc/src/base/ipc/pager.cc b/repos/base-foc/src/base/ipc/pager.cc
index 7cf0acd12..d0c98a0a9 100644
--- a/repos/base-foc/src/base/ipc/pager.cc
+++ b/repos/base-foc/src/base/ipc/pager.cc
@@ -87,12 +87,20 @@ void Ipc_pager::reply_and_wait_for_fault()
l4_umword_t grant = _reply_mapping.grant() ? L4_MAP_ITEM_GRANT : 0;
l4_utcb_mr()->mr[0] = _reply_mapping.dst_addr() | L4_ITEM_MAP | grant;
- /*
- * XXX Does L4_FPAGE_BUFFERABLE imply L4_FPAGE_UNCACHEABLE?
- */
- if (_reply_mapping.write_combined())
+ switch (_reply_mapping.cacheability()) {
+ case WRITE_COMBINED:
l4_utcb_mr()->mr[0] |= L4_FPAGE_BUFFERABLE << 4;
-
+ break;
+ case CACHED:
+ l4_utcb_mr()->mr[0] |= L4_FPAGE_CACHEABLE << 4;
+ break;
+ case UNCACHED:
+ if (!_reply_mapping.iomem())
+ l4_utcb_mr()->mr[0] |= L4_FPAGE_BUFFERABLE << 4;
+ else
+ l4_utcb_mr()->mr[0] |= L4_FPAGE_UNCACHEABLE << 4;
+ break;
+ }
l4_utcb_mr()->mr[1] = _reply_mapping.fpage().raw;
_tag = l4_ipc_send_and_wait(_last, l4_utcb(), snd_tag,
diff --git a/repos/base-foc/src/core/ram_session_support.cc b/repos/base-foc/src/core/ram_session_support.cc
index d8ace86ad..5d812734b 100644
--- a/repos/base-foc/src/core/ram_session_support.cc
+++ b/repos/base-foc/src/core/ram_session_support.cc
@@ -29,7 +29,7 @@ void Ram_session_component::_clear_ds(Dataspace_component *ds)
{
memset((void *)ds->phys_addr(), 0, ds->size());
- if (ds->write_combined())
+ if (ds->cacheability() != CACHED)
Fiasco::l4_cache_dma_coherent(ds->phys_addr(), ds->phys_addr() + ds->size());
}
diff --git a/repos/base-host/include/base/ipc_pager.h b/repos/base-host/include/base/ipc_pager.h
index 94657985f..cd2e95624 100644
--- a/repos/base-host/include/base/ipc_pager.h
+++ b/repos/base-host/include/base/ipc_pager.h
@@ -14,6 +14,7 @@
#ifndef _INCLUDE__BASE__IPC_PAGER_H_
#define _INCLUDE__BASE__IPC_PAGER_H_
+#include
#include
#include
#include
@@ -28,7 +29,7 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute, bool io_mem,
unsigned l2size = 12, bool rw = true) { }
/**
diff --git a/repos/base-hw/include/base/pager.h b/repos/base-hw/include/base/pager.h
index 00af36013..9f952d613 100644
--- a/repos/base-hw/include/base/pager.h
+++ b/repos/base-hw/include/base/pager.h
@@ -60,12 +60,12 @@ namespace Genode
struct Genode::Mapping
{
- addr_t virt_address;
- addr_t phys_address;
- bool write_combined;
- bool io_mem;
- unsigned size_log2;
- bool writable;
+ addr_t virt_address;
+ addr_t phys_address;
+ Cache_attribute cacheable;
+ bool io_mem;
+ unsigned size_log2;
+ bool writable;
/**
* Constructor for invalid mappings
@@ -75,7 +75,7 @@ struct Genode::Mapping
/**
* Constructor for valid mappings
*/
- Mapping(addr_t const va, addr_t const pa, bool const wc,
+ Mapping(addr_t const va, addr_t const pa, Cache_attribute const c,
bool const io, unsigned const sl2, bool const w);
/**
diff --git a/repos/base-hw/src/base/pager.cc b/repos/base-hw/src/base/pager.cc
index f1b045613..c125909f3 100644
--- a/repos/base-hw/src/base/pager.cc
+++ b/repos/base-hw/src/base/pager.cc
@@ -22,17 +22,18 @@ using namespace Genode;
** Mapping **
*************/
-Mapping::Mapping(addr_t const va, addr_t const pa, bool const wc,
- bool const io, unsigned const sl2, bool const w)
+Mapping::Mapping(addr_t const va, addr_t const pa,
+ Cache_attribute const c, bool const io,
+ unsigned const sl2, bool const w)
:
- virt_address(va), phys_address(pa), write_combined(wc),
+ virt_address(va), phys_address(pa), cacheable(c),
io_mem(io), size_log2(sl2), writable(w)
{ }
Mapping::Mapping()
:
- virt_address(0), phys_address(0), write_combined(0),
+virt_address(0), phys_address(0), cacheable(CACHED),
io_mem(0), size_log2(0), writable(0)
{ }
diff --git a/repos/base-hw/src/core/arm_v6/translation_table.h b/repos/base-hw/src/core/arm_v6/translation_table.h
index 7e595b878..5ad8934c4 100644
--- a/repos/base-hw/src/core/arm_v6/translation_table.h
+++ b/repos/base-hw/src/core/arm_v6/translation_table.h
@@ -25,9 +25,14 @@ Arm::memory_region_attr(Page_flags const & flags)
typedef typename T::Tex Tex;
typedef typename T::C C;
typedef typename T::B B;
- if(flags.device) { return 0; }
- if(flags.cacheable) { return Tex::bits(5) | B::bits(1); }
- return Tex::bits(6) | C::bits(1);
+ if (flags.device) { return 0; }
+
+ switch (flags.cacheable) {
+ case CACHED: return Tex::bits(5) | B::bits(1);
+ case WRITE_COMBINED: return B::bits(1);
+ case UNCACHED: return Tex::bits(1);
+ }
+ return 0;
}
#endif /* _ARM_V6__TRANSLATION_TABLE_H_ */
diff --git a/repos/base-hw/src/core/arm_v7/translation_table.h b/repos/base-hw/src/core/arm_v7/translation_table.h
index 613298162..4b35dc63e 100644
--- a/repos/base-hw/src/core/arm_v7/translation_table.h
+++ b/repos/base-hw/src/core/arm_v7/translation_table.h
@@ -26,8 +26,13 @@ Arm::memory_region_attr(Page_flags const & flags)
typedef typename T::C C;
typedef typename T::B B;
if (flags.device) { return Tex::bits(2); }
- if (flags.cacheable) { return Tex::bits(5) | B::bits(1); }
- return Tex::bits(6) | C::bits(1);
+
+ switch (flags.cacheable) {
+ case CACHED: return Tex::bits(5) | B::bits(1);
+ case WRITE_COMBINED: return B::bits(1);
+ case UNCACHED: return Tex::bits(1);
+ }
+ return 0;
}
#endif /* _ARM_V7__TRANSLATION_TABLE_H_ */
diff --git a/repos/base-hw/src/core/include/page_flags.h b/repos/base-hw/src/core/include/page_flags.h
index 62e448850..844ff080c 100644
--- a/repos/base-hw/src/core/include/page_flags.h
+++ b/repos/base-hw/src/core/include/page_flags.h
@@ -14,6 +14,8 @@
#ifndef _TLB__PAGE_FLAGS_H_
#define _TLB__PAGE_FLAGS_H_
+#include
+
namespace Genode
{
/**
@@ -21,34 +23,35 @@ namespace Genode
*/
struct Page_flags
{
- bool writeable;
- bool executable;
- bool privileged;
- bool global;
- bool device;
- bool cacheable;
+ bool writeable;
+ bool executable;
+ bool privileged;
+ bool global;
+ bool device;
+ Cache_attribute cacheable;
/**
* Create flag POD for Genode pagers
*/
static const Page_flags
apply_mapping(bool const writeable,
- bool const write_combined,
+ Cache_attribute const cacheable,
bool const io_mem) {
return Page_flags { writeable, true, false, false,
- io_mem, !write_combined && !io_mem }; }
+ io_mem, cacheable }; }
/**
* Create flag POD for kernel when it creates the core space
*/
static const Page_flags map_core_area(bool const io_mem) {
- return Page_flags { true, true, false, false, io_mem, !io_mem }; }
+ return Page_flags { true, true, false, false, io_mem,
+ io_mem ? UNCACHED : CACHED}; }
/**
* Create flag POD for the mode transition region
*/
static const Page_flags mode_transition() {
- return Page_flags { true, true, true, true, false, true }; }
+ return Page_flags { true, true, true, true, false, CACHED }; }
};
}
diff --git a/repos/base-hw/src/core/platform_thread.cc b/repos/base-hw/src/core/platform_thread.cc
index 8493abf0a..03ae1d5a7 100644
--- a/repos/base-hw/src/core/platform_thread.cc
+++ b/repos/base-hw/src/core/platform_thread.cc
@@ -128,7 +128,7 @@ Platform_thread::Platform_thread(const char * const label,
Ram_session_component * const ram =
dynamic_cast(core_env()->ram_session());
assert(ram);
- try { _utcb = ram->alloc(sizeof(Native_utcb), 1); }
+ try { _utcb = ram->alloc(sizeof(Native_utcb), CACHED); }
catch (...) {
PERR("failed to allocate UTCB");
throw Cpu_session::Out_of_metadata();
diff --git a/repos/base-hw/src/core/ram_session_support.cc b/repos/base-hw/src/core/ram_session_support.cc
index 2aabc8953..52b615b0e 100644
--- a/repos/base-hw/src/core/ram_session_support.cc
+++ b/repos/base-hw/src/core/ram_session_support.cc
@@ -51,7 +51,7 @@ void Ram_session_component::_clear_ds (Dataspace_component * ds)
memset(virt_addr, 0, page_rounded_size);
/* uncached dataspaces need to be flushed */
- if (ds->write_combined())
+ if (ds->cacheability() != CACHED)
Kernel::update_data_region((addr_t)virt_addr, page_rounded_size);
/* unmap dataspace from core */
diff --git a/repos/base-hw/src/core/rm_session_support.cc b/repos/base-hw/src/core/rm_session_support.cc
index 7e5593c65..dd13b6d4a 100644
--- a/repos/base-hw/src/core/rm_session_support.cc
+++ b/repos/base-hw/src/core/rm_session_support.cc
@@ -65,7 +65,7 @@ int Pager_activation_base::apply_mapping()
Page_flags const flags =
Page_flags::apply_mapping(_mapping.writable,
- _mapping.write_combined,
+ _mapping.cacheable,
_mapping.io_mem);
/* insert mapping into translation table */
diff --git a/repos/base-hw/src/core/vm_session_component.cc b/repos/base-hw/src/core/vm_session_component.cc
index 2c57b89d7..b32044124 100644
--- a/repos/base-hw/src/core/vm_session_component.cc
+++ b/repos/base-hw/src/core/vm_session_component.cc
@@ -59,7 +59,7 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint *ds_ep,
size_t ram_quota)
: _ds_ep(ds_ep), _ram_alloc(ram_alloc), _vm_id(0),
_ds_addr(_alloc_ds(&ram_quota)),
- _ds(_ds_size(), _ds_addr, _ds_addr, false, true, 0),
+ _ds(_ds_size(), _ds_addr, _ds_addr, UNCACHED, true, 0),
_ds_cap(static_cap_cast(_ds_ep->manage(&_ds)))
{
/* alloc needed memory */
diff --git a/repos/base-linux/src/core/context_area.cc b/repos/base-linux/src/core/context_area.cc
index 43ff8907a..71f2553f4 100644
--- a/repos/base-linux/src/core/context_area.cc
+++ b/repos/base-linux/src/core/context_area.cc
@@ -84,7 +84,8 @@ class Context_area_ram_session : public Genode::Ram_session
{
public:
- Genode::Ram_dataspace_capability alloc(Genode::size_t size, bool) {
+ Genode::Ram_dataspace_capability alloc(Genode::size_t size,
+ Genode::Cache_attribute) {
return Genode::Ram_dataspace_capability(); }
void free(Genode::Ram_dataspace_capability) { }
diff --git a/repos/base-linux/src/core/include/dataspace_component.h b/repos/base-linux/src/core/include/dataspace_component.h
index dc7e4ec43..078b3d6c0 100644
--- a/repos/base-linux/src/core/include/dataspace_component.h
+++ b/repos/base-linux/src/core/include/dataspace_component.h
@@ -52,7 +52,7 @@ namespace Genode {
* Constructor
*/
Dataspace_component(size_t size, addr_t addr,
- bool /* write_combined */, bool writable,
+ Cache_attribute, bool writable,
Dataspace_owner * owner)
: _size(size), _addr(addr), _fd(-1), _writable(writable),
_owner(owner) { }
@@ -68,7 +68,7 @@ namespace Genode {
* reasons and should not be used.
*/
Dataspace_component(size_t size, addr_t core_local_addr,
- addr_t phys_addr, bool write_combined,
+ addr_t phys_addr, Cache_attribute,
bool writable, Dataspace_owner * _owner)
:
_size(size), _addr(phys_addr), _fd(-1), _owner(_owner)
diff --git a/repos/base-linux/src/core/rom_session_component.cc b/repos/base-linux/src/core/rom_session_component.cc
index c04e27cb6..f07009d0e 100644
--- a/repos/base-linux/src/core/rom_session_component.cc
+++ b/repos/base-linux/src/core/rom_session_component.cc
@@ -65,7 +65,7 @@ Rom_session_component::Rom_session_component(Rom_fs *rom_fs,
int const fd = lx_open(fname, O_RDONLY | LX_O_CLOEXEC, S_IRUSR | S_IXUSR);
- _ds = Dataspace_component(fsize, 0, false, false, 0);
+ _ds = Dataspace_component(fsize, 0, CACHED, false, 0);
_ds.fd(fd);
_ds.fname(fname);
diff --git a/repos/base-nova/include/base/ipc_pager.h b/repos/base-nova/include/base/ipc_pager.h
index 5738df050..9658b93bb 100644
--- a/repos/base-nova/include/base/ipc_pager.h
+++ b/repos/base-nova/include/base/ipc_pager.h
@@ -15,6 +15,7 @@
#define _INCLUDE__BASE__IPC_PAGER_H_
/* Genode includes */
+#include
#include
#include
#include
@@ -43,12 +44,12 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t map_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute c, bool io_mem,
unsigned size_log2 = PAGE_SIZE_LOG2,
bool rw = true)
:
_dst_addr(dst_addr), _core_local_addr(map_addr),
- _write_combined(write_combined), _size_log2(size_log2),
+ _write_combined(c != CACHED), _size_log2(size_log2),
_rw(rw)
{ }
diff --git a/repos/base-okl4/include/base/ipc_pager.h b/repos/base-okl4/include/base/ipc_pager.h
index 9e3677a74..e2c2c67f7 100644
--- a/repos/base-okl4/include/base/ipc_pager.h
+++ b/repos/base-okl4/include/base/ipc_pager.h
@@ -14,6 +14,7 @@
#ifndef _INCLUDE__BASE__IPC_PAGER_H_
#define _INCLUDE__BASE__IPC_PAGER_H_
+#include
#include
#include
#include
@@ -40,7 +41,7 @@ namespace Genode {
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute cacheability, bool io_mem,
unsigned l2size = 12, bool rw = true);
/**
diff --git a/repos/base-okl4/src/base/ipc/pager.cc b/repos/base-okl4/src/base/ipc/pager.cc
index 0c43128fb..92c9fdce7 100644
--- a/repos/base-okl4/src/base/ipc/pager.cc
+++ b/repos/base-okl4/src/base/ipc/pager.cc
@@ -62,7 +62,7 @@ static inline Okl4::L4_ThreadId_t thread_get_my_global_id()
*************/
Mapping::Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute cacheability, bool io_mem,
unsigned l2size, bool rw)
:
_fpage(L4_FpageLog2(dst_addr, l2size)),
diff --git a/repos/base-pistachio/include/base/ipc_pager.h b/repos/base-pistachio/include/base/ipc_pager.h
index bf8d78736..5c006c472 100644
--- a/repos/base-pistachio/include/base/ipc_pager.h
+++ b/repos/base-pistachio/include/base/ipc_pager.h
@@ -15,6 +15,7 @@
#define _INCLUDE__BASE__IPC_PAGER_H_
/* Genode includes */
+#include
#include
#include
#include
@@ -37,20 +38,13 @@ namespace Genode {
Pistachio::L4_GrantItem_t _grant_item;
};
- /*
- * On Pistachio, the write-combining attribute is not part of a mapping
- * but it can be applied to a flexpage via the memory-control system
- * call. Therefore, we need to keep the flag in an extra member variable.
- */
- bool _write_combined; /* enable write-combined access to I/O memory */
-
public:
/**
* Constructor
*/
Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem,
+ Cache_attribute, bool io_mem,
unsigned l2size = Pistachio::get_page_size_log2(),
bool rw = true, bool grant = false);
diff --git a/repos/base-pistachio/src/base/ipc/pager.cc b/repos/base-pistachio/src/base/ipc/pager.cc
index 925e45e11..078693ef6 100644
--- a/repos/base-pistachio/src/base/ipc/pager.cc
+++ b/repos/base-pistachio/src/base/ipc/pager.cc
@@ -32,10 +32,8 @@ using namespace Pistachio;
*************/
Mapping::Mapping(addr_t dst_addr, addr_t src_addr,
- bool write_combined, bool io_mem, unsigned l2size,
+ Cache_attribute, bool io_mem, unsigned l2size,
bool rw, bool grant)
-:
- _write_combined(write_combined)
{
L4_Fpage_t fpage = L4_FpageLog2(src_addr, l2size);
diff --git a/repos/base-pistachio/src/core/io_mem_session_support.cc b/repos/base-pistachio/src/core/io_mem_session_support.cc
index 3e3fa857c..4e136a1f1 100644
--- a/repos/base-pistachio/src/core/io_mem_session_support.cc
+++ b/repos/base-pistachio/src/core/io_mem_session_support.cc
@@ -104,7 +104,7 @@ addr_t Io_mem_session_component::_map_local(addr_t base, size_t size)
L4_Fpage(base + offset, page_size),
L4_Fpage(local_base + offset, page_size));
- if (_write_combined) {
+ if (_cacheable == WRITE_COMBINED) {
int res = L4_Set_PageAttribute(L4_Fpage(local_base + offset, page_size),
L4_WriteCombiningMemory);
if (res != 1)
diff --git a/repos/base/include/base/cache.h b/repos/base/include/base/cache.h
new file mode 100644
index 000000000..9a4b1baeb
--- /dev/null
+++ b/repos/base/include/base/cache.h
@@ -0,0 +1,20 @@
+/*
+ * \brief Generic cache declarations
+ * \author Stefan Kalkowski
+ * \date 2014-06-17
+ */
+
+/*
+ * Copyright (C) 2014 Genode Labs GmbH
+ *
+ * This file is part of the Genode OS framework, which is distributed
+ * under the terms of the GNU General Public License version 2.
+ */
+
+#ifndef _INCLUDE__BASE__CACHE_H_
+#define _INCLUDE__BASE__CACHE_H_
+
+namespace Genode {
+ enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED };
+}
+#endif /* _INCLUDE__BASE__CACHE_H_ */
diff --git a/repos/base/include/ram_session/client.h b/repos/base/include/ram_session/client.h
index e91a09f5f..e89989c36 100644
--- a/repos/base/include/ram_session/client.h
+++ b/repos/base/include/ram_session/client.h
@@ -25,7 +25,8 @@ namespace Genode {
explicit Ram_session_client(Ram_session_capability session)
: Rpc_client(session) { }
- Ram_dataspace_capability alloc(size_t size, bool cached = true) {
+ Ram_dataspace_capability alloc(size_t size,
+ Cache_attribute cached = CACHED) {
return call(size, cached); }
void free(Ram_dataspace_capability ds) { call(ds); }
diff --git a/repos/base/include/ram_session/ram_session.h b/repos/base/include/ram_session/ram_session.h
index 04288eb1a..a603e4ce3 100644
--- a/repos/base/include/ram_session/ram_session.h
+++ b/repos/base/include/ram_session/ram_session.h
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -49,7 +50,7 @@ namespace Genode {
* Allocate RAM dataspace
*
* \param size size of RAM dataspace
- * \param cached true for cached memory, false for allocating
+ * \param cached selects cacheability attributes of the memory,
* uncached memory, i.e., for DMA buffers
*
* \throw Quota_exceeded
@@ -57,7 +58,7 @@ namespace Genode {
* \return capability to new RAM dataspace
*/
virtual Ram_dataspace_capability alloc(size_t size,
- bool cached = true) = 0;
+ Cache_attribute cached = CACHED) = 0;
/**
* Free RAM dataspace
@@ -116,7 +117,7 @@ namespace Genode {
GENODE_RPC_THROW(Rpc_alloc, Ram_dataspace_capability, alloc,
GENODE_TYPE_LIST(Quota_exceeded, Out_of_metadata),
- size_t, bool);
+ size_t, Cache_attribute);
GENODE_RPC(Rpc_free, void, free, Ram_dataspace_capability);
GENODE_RPC(Rpc_ref_account, int, ref_account, Ram_session_capability);
GENODE_RPC(Rpc_transfer_quota, int, transfer_quota, Ram_session_capability, size_t);
diff --git a/repos/base/src/base/env/platform_env_common.h b/repos/base/src/base/env/platform_env_common.h
index 087376304..563b2527a 100644
--- a/repos/base/src/base/env/platform_env_common.h
+++ b/repos/base/src/base/env/platform_env_common.h
@@ -87,7 +87,7 @@ struct Genode::Expanding_ram_session_client : Upgradeable_client(cap) { }
- Ram_dataspace_capability alloc(size_t size, bool cached = true)
+ Ram_dataspace_capability alloc(size_t size, Cache_attribute cached = UNCACHED)
{
/*
* If the RAM session runs out of quota, issue a resource request
diff --git a/repos/base/src/core/context_area.cc b/repos/base/src/core/context_area.cc
index 3a7ecd650..8257601ce 100644
--- a/repos/base/src/core/context_area.cc
+++ b/repos/base/src/core/context_area.cc
@@ -135,7 +135,7 @@ class Context_area_ram_session : public Ram_session
public:
- Ram_dataspace_capability alloc(size_t size, bool cached)
+ Ram_dataspace_capability alloc(size_t size, Cache_attribute cached)
{
/* find free context */
unsigned i;
@@ -161,7 +161,7 @@ class Context_area_ram_session : public Ram_session
PDBG("phys_base = %p, size = 0x%zx", phys_base, size);
context_ds[i] = new (&_ds_slab)
- Dataspace_component(size, 0, (addr_t)phys_base, false, true, 0);
+ Dataspace_component(size, 0, (addr_t)phys_base, CACHED, true, 0);
Dataspace_capability cap = Dataspace_capability::local_cap(context_ds[i]);
return static_cap_cast(cap);
diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h
index 750e9f45c..02da1d5af 100644
--- a/repos/base/src/core/include/core_env.h
+++ b/repos/base/src/core/include/core_env.h
@@ -70,7 +70,7 @@ namespace Genode {
** RAM-session interface **
***************************/
- Ram_dataspace_capability alloc(size_t size, bool cached)
+ Ram_dataspace_capability alloc(size_t size, Cache_attribute cached)
{
Lock::Guard lock_guard(_lock);
return RAM_SESSION_IMPL::alloc(size, cached);
diff --git a/repos/base/src/core/include/dataspace_component.h b/repos/base/src/core/include/dataspace_component.h
index fcc67cd81..550230639 100644
--- a/repos/base/src/core/include/dataspace_component.h
+++ b/repos/base/src/core/include/dataspace_component.h
@@ -41,8 +41,8 @@ namespace Genode {
addr_t _core_local_addr; /* address of core-local mapping */
size_t const _size; /* size of dataspace in bytes */
bool const _is_io_mem; /* dataspace is I/O mem, not to be touched */
- bool const _write_combined; /* access I/O memory write-combined, or
- RAM uncacheable respectively */
+ Cache_attribute const _cache; /* access memory cached, write-combined, or
+ uncached respectively */
bool const _writable; /* false if dataspace is read-only */
List _regions; /* regions this is attached to */
@@ -73,7 +73,7 @@ namespace Genode {
Dataspace_component()
:
_phys_addr(0), _core_local_addr(0), _size(0),
- _is_io_mem(false), _write_combined(false), _writable(false),
+ _is_io_mem(false), _cache(CACHED), _writable(false),
_owner(0), _managed(false) { }
/**
@@ -82,12 +82,12 @@ namespace Genode {
* This constructor is used by RAM and ROM dataspaces.
*/
Dataspace_component(size_t size, addr_t core_local_addr,
- bool write_combined, bool writable,
+ Cache_attribute cache, bool writable,
Dataspace_owner *owner)
:
_phys_addr(core_local_addr), _core_local_addr(core_local_addr),
_size(round_page(size)), _is_io_mem(false),
- _write_combined(write_combined), _writable(writable),
+ _cache(cache), _writable(writable),
_owner(owner), _managed(false) { }
/**
@@ -101,11 +101,11 @@ namespace Genode {
* space is needed to send a mapping to another address space.
*/
Dataspace_component(size_t size, addr_t core_local_addr,
- addr_t phys_addr, bool write_combined,
+ addr_t phys_addr, Cache_attribute cache,
bool writable, Dataspace_owner *owner)
:
_phys_addr(phys_addr), _core_local_addr(core_local_addr),
- _size(size), _is_io_mem(true), _write_combined(write_combined),
+ _size(size), _is_io_mem(true), _cache(cache),
_writable(writable), _owner(owner), _managed(false) { }
/**
@@ -120,9 +120,9 @@ namespace Genode {
*/
virtual Native_capability sub_rm_session() { return Dataspace_capability(); }
- addr_t core_local_addr() const { return _core_local_addr; }
- bool is_io_mem() const { return _is_io_mem; }
- bool write_combined() const { return _write_combined; }
+ addr_t core_local_addr() const { return _core_local_addr; }
+ bool is_io_mem() const { return _is_io_mem; }
+ Cache_attribute cacheability() const { return _cache; }
/**
* Return dataspace base address to be used for map operations
diff --git a/repos/base/src/core/include/io_mem_session_component.h b/repos/base/src/core/include/io_mem_session_component.h
index ebd1006b4..ee7270f55 100644
--- a/repos/base/src/core/include/io_mem_session_component.h
+++ b/repos/base/src/core/include/io_mem_session_component.h
@@ -35,10 +35,10 @@ namespace Genode {
*/
struct Dataspace_attr
{
- size_t size;
- addr_t core_local_addr;
- addr_t phys_addr;
- bool write_combined;
+ size_t size;
+ addr_t core_local_addr;
+ addr_t phys_addr;
+ Cache_attribute cacheable;
/**
* Base address of request used for freeing mem-ranges
@@ -59,11 +59,11 @@ namespace Genode {
* An invalid dataspace is represented by setting all
* arguments to zero.
*/
- Dataspace_attr(size_t s, addr_t cla, addr_t pa, bool write_combined,
+ Dataspace_attr(size_t s, addr_t cla, addr_t pa, Cache_attribute c,
addr_t req_base)
:
size(s), core_local_addr(cla), phys_addr(pa),
- write_combined(write_combined), req_base(req_base) { }
+ cacheable(c), req_base(req_base) { }
};
struct Io_dataspace_component : Dataspace_component
@@ -76,7 +76,7 @@ namespace Genode {
Io_dataspace_component(Dataspace_attr da)
:
Dataspace_component(da.size, da.core_local_addr,
- da.phys_addr, da.write_combined,
+ da.phys_addr, da.cacheable,
true, 0),
req_base(da.req_base) { }
@@ -88,7 +88,7 @@ namespace Genode {
Io_dataspace_component _ds;
Rpc_entrypoint *_ds_ep;
Io_mem_dataspace_capability _ds_cap;
- bool _write_combined;
+ Cache_attribute _cacheable;
Dataspace_attr _prepare_io_mem(const char *args, Range_allocator *ram_alloc);
diff --git a/repos/base/src/core/include/ram_session_component.h b/repos/base/src/core/include/ram_session_component.h
index 7cf439926..8204ed684 100644
--- a/repos/base/src/core/include/ram_session_component.h
+++ b/repos/base/src/core/include/ram_session_component.h
@@ -161,7 +161,7 @@ namespace Genode {
** RAM Session interface **
***************************/
- Ram_dataspace_capability alloc(size_t, bool);
+ Ram_dataspace_capability alloc(size_t, Cache_attribute);
void free(Ram_dataspace_capability);
int ref_account(Ram_session_capability);
int transfer_quota(Ram_session_capability, size_t);
diff --git a/repos/base/src/core/include/rm_session_component.h b/repos/base/src/core/include/rm_session_component.h
index 52a5b8941..78ae70292 100644
--- a/repos/base/src/core/include/rm_session_component.h
+++ b/repos/base/src/core/include/rm_session_component.h
@@ -263,7 +263,7 @@ namespace Genode {
*/
Rm_dataspace_component(size_t size)
:
- Dataspace_component(size, 0, false, false, 0)
+ Dataspace_component(size, 0, CACHED, false, 0)
{ _managed = true; }
diff --git a/repos/base/src/core/io_mem_session_component.cc b/repos/base/src/core/io_mem_session_component.cc
index cd7910eb9..4a76776df 100644
--- a/repos/base/src/core/io_mem_session_component.cc
+++ b/repos/base/src/core/io_mem_session_component.cc
@@ -37,11 +37,11 @@ Io_mem_session_component::_prepare_io_mem(const char *args,
addr_t base = req_base & ~(get_page_size() - 1);
size_t size = end - base;
- _write_combined = false;
+ _cacheable = UNCACHED;
Arg a = Arg_string::find_arg(args, "wc");
- if (a.valid())
- _write_combined = a.bool_value(0);
+ if (a.valid() && a.bool_value(0))
+ _cacheable = WRITE_COMBINED;
/* check for RAM collision */
int ret;
@@ -69,9 +69,9 @@ Io_mem_session_component::_prepare_io_mem(const char *args,
if (verbose)
PDBG("I/O mem [%lx,%lx) => [%lx,%lx)%s",
base, base + size, local_addr, local_addr + size,
- _write_combined ? " (write-combined)" : "");
+ (_cacheable == WRITE_COMBINED) ? " (write-combined)" : "");
- return Dataspace_attr(size, local_addr, base, _write_combined, req_base);
+ return Dataspace_attr(size, local_addr, base, _cacheable, req_base);
}
diff --git a/repos/base/src/core/ram_session_component.cc b/repos/base/src/core/ram_session_component.cc
index 45898323c..db67484dc 100644
--- a/repos/base/src/core/ram_session_component.cc
+++ b/repos/base/src/core/ram_session_component.cc
@@ -106,7 +106,7 @@ void Ram_session_component::_remove_ref_account_member(Ram_session_component *me
}
-Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cached)
+Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attribute cached)
{
/* zero-sized dataspaces are not allowed */
if (!ds_size) return Ram_dataspace_capability();
@@ -171,7 +171,7 @@ Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cache
* when resolving page faults.
*/
ds = new (&_ds_slab)
- Dataspace_component(ds_size, (addr_t)ds_addr, !cached, true, this);
+ Dataspace_component(ds_size, (addr_t)ds_addr, cached, true, this);
} catch (Allocator::Out_of_memory) {
PWRN("Could not allocate metadata");
/* cleanup unneeded resources */
diff --git a/repos/base/src/core/rm_session_component.cc b/repos/base/src/core/rm_session_component.cc
index b7f886bfe..eea199e07 100644
--- a/repos/base/src/core/rm_session_component.cc
+++ b/repos/base/src/core/rm_session_component.cc
@@ -280,7 +280,7 @@ int Rm_client::pager(Ipc_pager &pager)
Mapping mapping(dst_fault_area.base(),
src_fault_area.base(),
- src_dataspace->write_combined(),
+ src_dataspace->cacheability(),
src_dataspace->is_io_mem(),
map_size_log2,
src_dataspace->writable());
diff --git a/repos/base/src/core/rom_session_component.cc b/repos/base/src/core/rom_session_component.cc
index 02f31f976..37d1c40da 100644
--- a/repos/base/src/core/rom_session_component.cc
+++ b/repos/base/src/core/rom_session_component.cc
@@ -25,7 +25,7 @@ Rom_session_component::Rom_session_component(Rom_fs *rom_fs,
:
_rom_module(_find_rom(rom_fs, args)),
_ds(_rom_module ? _rom_module->size() : 0,
- _rom_module ? _rom_module->addr() : 0, false, false, 0),
+ _rom_module ? _rom_module->addr() : 0, CACHED, false, 0),
_ds_ep(ds_ep)
{
/* ROM module not found */
diff --git a/repos/dde_linux/src/lib/lxip/lxcc_emul.cc b/repos/dde_linux/src/lib/lxip/lxcc_emul.cc
index a851304b4..6e8d5dedb 100644
--- a/repos/dde_linux/src/lib/lxip/lxcc_emul.cc
+++ b/repos/dde_linux/src/lib/lxip/lxcc_emul.cc
@@ -54,7 +54,7 @@ class Genode::Slab_backend_alloc : public Genode::Allocator,
};
addr_t _base; /* virt. base address */
- bool _cached; /* non-/cached RAM */
+ Cache_attribute _cached; /* non-/cached RAM */
Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
int _index; /* current index in ds_cap */
@@ -86,7 +86,7 @@ class Genode::Slab_backend_alloc : public Genode::Allocator,
public:
- Slab_backend_alloc(bool cached)
+ Slab_backend_alloc(Cache_attribute cached)
: Rm_connection(0, VM_SIZE), _cached(cached), _index(0),
_range(env()->heap())
{
@@ -220,7 +220,7 @@ class Malloc
public:
- Malloc(Slab_backend_alloc *alloc, bool cached)
+ Malloc(Slab_backend_alloc *alloc, Genode::Cache_attribute cached)
: _back_allocator(alloc), _cached(cached), _start(alloc->start()),
_end(alloc->end())
{
@@ -312,8 +312,8 @@ class Malloc
*/
static Malloc *mem()
{
- static Slab_backend_alloc _b(true);
- static Malloc _m(&_b, true);
+ static Slab_backend_alloc _b(Genode::CACHED);
+ static Malloc _m(&_b, Genode::CACHED);
return &_m;
}
};
diff --git a/repos/dde_linux/src/lib/usb/include/arm/platform/lx_mem.h b/repos/dde_linux/src/lib/usb/include/arm/platform/lx_mem.h
index 9ac672a17..3683d5283 100644
--- a/repos/dde_linux/src/lib/usb/include/arm/platform/lx_mem.h
+++ b/repos/dde_linux/src/lib/usb/include/arm/platform/lx_mem.h
@@ -14,13 +14,17 @@
#ifndef _ARM__PLATFORM__LX_MEM_
#define _ARM__PLATFORM__LX_MEM_
+#include
+
class Backend_memory {
public:
static Genode::Ram_dataspace_capability alloc(Genode::addr_t size,
- bool cached) {
- return Genode::env()->ram_session()->alloc(size, cached); }
+ Genode::Cache_attribute c)
+ {
+ return Genode::env()->ram_session()->alloc(size, c);
+ }
static void free(Genode::Ram_dataspace_capability cap) {
return Genode::env()->ram_session()->free(cap); }
diff --git a/repos/dde_linux/src/lib/usb/include/nic/component.h b/repos/dde_linux/src/lib/usb/include/nic/component.h
index f7193dc3c..0cd8c3e09 100644
--- a/repos/dde_linux/src/lib/usb/include/nic/component.h
+++ b/repos/dde_linux/src/lib/usb/include/nic/component.h
@@ -291,7 +291,7 @@ namespace Nic {
/**
* Root component, handling new session requests
*/
- class Root : public Packet_root
+ class Root : public Packet_root
{
public:
diff --git a/repos/dde_linux/src/lib/usb/include/signal/dispatch.h b/repos/dde_linux/src/lib/usb/include/signal/dispatch.h
index ef4bcdcc0..5a4fa248b 100644
--- a/repos/dde_linux/src/lib/usb/include/signal/dispatch.h
+++ b/repos/dde_linux/src/lib/usb/include/signal/dispatch.h
@@ -74,7 +74,8 @@ class Packet_session_component : public RPC
/**
* Root component, handling new session requests
*/
- template
+ template
class Packet_root : public ROOT_COMPONENT
{
private:
@@ -116,8 +117,8 @@ class Packet_session_component : public RPC
}
return new (ROOT_COMPONENT::md_alloc())
- SESSION_COMPONENT(Backend_memory::alloc(tx_buf_size, CACHED),
- Backend_memory::alloc(rx_buf_size, CACHED),
+ SESSION_COMPONENT(Backend_memory::alloc(tx_buf_size, CACHEABILITY),
+ Backend_memory::alloc(rx_buf_size, CACHEABILITY),
_ep, _device);
}
diff --git a/repos/dde_linux/src/lib/usb/include/x86/platform/lx_mem.h b/repos/dde_linux/src/lib/usb/include/x86/platform/lx_mem.h
index 106984947..ce30d1bbf 100644
--- a/repos/dde_linux/src/lib/usb/include/x86/platform/lx_mem.h
+++ b/repos/dde_linux/src/lib/usb/include/x86/platform/lx_mem.h
@@ -14,12 +14,14 @@
#ifndef _X86__PLATFORM__LX_MEM_
#define _X86__PLATFORM__LX_MEM_
+#include
+
class Backend_memory {
public:
static Genode::Ram_dataspace_capability alloc(Genode::addr_t size,
- bool cached);
+ Genode::Cache_attribute);
static void free(Genode::Ram_dataspace_capability cap);
};
diff --git a/repos/dde_linux/src/lib/usb/lx_emul.cc b/repos/dde_linux/src/lib/usb/lx_emul.cc
index 1ff93aaa0..bdbb172f0 100644
--- a/repos/dde_linux/src/lib/usb/lx_emul.cc
+++ b/repos/dde_linux/src/lib/usb/lx_emul.cc
@@ -56,7 +56,7 @@ class Genode::Slab_backend_alloc : public Genode::Allocator,
};
addr_t _base; /* virt. base address */
- bool _cached; /* non-/cached RAM */
+ Genode::Cache_attribute _cached; /* non-/cached RAM */
Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
int _index; /* current index in ds_cap */
@@ -88,7 +88,7 @@ class Genode::Slab_backend_alloc : public Genode::Allocator,
public:
- Slab_backend_alloc(bool cached)
+ Slab_backend_alloc(Genode::Cache_attribute cached)
: Rm_connection(0, VM_SIZE), _cached(cached), _index(0),
_range(env()->heap())
{
@@ -206,11 +206,11 @@ class Malloc
typedef Genode::Slab_alloc Slab_alloc;
typedef Genode::Slab_backend_alloc Slab_backend_alloc;
- Slab_backend_alloc *_back_allocator;
- Slab_alloc *_allocator[NUM_SLABS];
- bool _cached; /* cached or un-cached memory */
- addr_t _start; /* VM region of this allocator */
- addr_t _end;
+ Slab_backend_alloc *_back_allocator;
+ Slab_alloc *_allocator[NUM_SLABS];
+ Genode::Cache_attribute _cached; /* cached or un-cached memory */
+ addr_t _start; /* VM region of this allocator */
+ addr_t _end;
/**
* Set 'value' at 'addr'
@@ -240,7 +240,7 @@ class Malloc
public:
- Malloc(Slab_backend_alloc *alloc, bool cached)
+ Malloc(Slab_backend_alloc *alloc, Genode::Cache_attribute cached)
: _back_allocator(alloc), _cached(cached), _start(alloc->start()),
_end(alloc->end())
{
@@ -326,8 +326,8 @@ class Malloc
*/
static Malloc *mem()
{
- static Slab_backend_alloc _b(true);
- static Malloc _m(&_b, true);
+ static Slab_backend_alloc _b(Genode::CACHED);
+ static Malloc _m(&_b, Genode::CACHED);
return &_m;
}
@@ -336,8 +336,8 @@ class Malloc
*/
static Malloc *dma()
{
- static Slab_backend_alloc _b(false);
- static Malloc _m(&_b, false);
+ static Slab_backend_alloc _b(Genode::UNCACHED);
+ static Malloc _m(&_b, Genode::UNCACHED);
return &_m;
}
};
diff --git a/repos/dde_linux/src/lib/usb/pci_driver.cc b/repos/dde_linux/src/lib/usb/pci_driver.cc
index 92b923a2a..8af6f8867 100644
--- a/repos/dde_linux/src/lib/usb/pci_driver.cc
+++ b/repos/dde_linux/src/lib/usb/pci_driver.cc
@@ -367,15 +367,15 @@ void Ram_object::free() { Genode::env()->ram_session()->free(ram_cap()); }
void Dma_object::free() { pci.free_dma_buffer(pci_device_cap, ram_cap()); }
-Genode::Ram_dataspace_capability Backend_memory::alloc(Genode::addr_t size,
- bool cached)
+Genode::Ram_dataspace_capability
+Backend_memory::alloc(Genode::addr_t size, Genode::Cache_attribute cached)
{
using namespace Genode;
Memory_object_base *o;
Genode::Ram_dataspace_capability cap;
- if (cached) {
- cap = env()->ram_session()->alloc(size, cached);
+ if (cached == CACHED) {
+ cap = env()->ram_session()->alloc(size);
o = new (env()->heap()) Ram_object(cap);
} else {
cap = pci.alloc_dma_buffer(pci_device_cap, size);
diff --git a/repos/dde_linux/src/lib/usb/storage/storage.cc b/repos/dde_linux/src/lib/usb/storage/storage.cc
index 6a8b27443..dbc0bc697 100644
--- a/repos/dde_linux/src/lib/usb/storage/storage.cc
+++ b/repos/dde_linux/src/lib/usb/storage/storage.cc
@@ -157,7 +157,7 @@ class Storage_device : public Genode::List::Element,
bool dma_enabled() { return true; }
Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t size) {
- return Backend_memory::alloc(size, false); }
+ return Backend_memory::alloc(size, Genode::UNCACHED); }
void free_dma_buffer(Genode::Ram_dataspace_capability cap) {
return Backend_memory::free(cap); }
diff --git a/repos/dde_rump/include/util/allocator_fap.h b/repos/dde_rump/include/util/allocator_fap.h
index b19c071b2..bdbcb6856 100644
--- a/repos/dde_rump/include/util/allocator_fap.h
+++ b/repos/dde_rump/include/util/allocator_fap.h
@@ -62,7 +62,7 @@ namespace Allocator {
typedef Genode::Allocator_avl Allocator_avl;
addr_t _base; /* virt. base address */
- bool _cached; /* non-/cached RAM */
+ Cache_attribute _cached; /* non-/cached RAM */
Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
int _index = 0; /* current index in ds_cap */
@@ -107,7 +107,7 @@ namespace Allocator {
public:
- Backend_alloc(bool cached)
+ Backend_alloc(Cache_attribute cached)
: Rm_connection(0, VM_SIZE), _cached(cached),
_range(Genode::env()->heap())
{
@@ -195,7 +195,7 @@ namespace Allocator {
public:
Fap(bool cached)
- : _back_allocator(cached) { }
+ : _back_allocator(cached ? CACHED : UNCACHED) { }
void *alloc(size_t size, int align = 0)
{
diff --git a/repos/os/include/os/attached_ram_dataspace.h b/repos/os/include/os/attached_ram_dataspace.h
index 52dc0faa0..fd36984aa 100644
--- a/repos/os/include/os/attached_ram_dataspace.h
+++ b/repos/os/include/os/attached_ram_dataspace.h
@@ -35,7 +35,7 @@ namespace Genode {
Ram_session *_ram_session;
Ram_dataspace_capability _ds;
void *_local_addr;
- bool const _cached;
+ Cache_attribute const _cached;
template
static void _swap(T &v1, T &v2) { T tmp = v1; v1 = v2; v2 = tmp; }
@@ -73,7 +73,7 @@ namespace Genode {
* work-around for this issues, we eagerly map the whole
* dataspace before writing actual content to it.
*/
- if (!_cached) {
+ if (_cached != CACHED) {
enum { PAGE_SIZE = 4096 };
unsigned char volatile *base = (unsigned char volatile *)_local_addr;
for (size_t i = 0; i < _size; i += PAGE_SIZE)
@@ -90,7 +90,7 @@ namespace Genode {
* \throw Rm_session::Attach_failed
*/
Attached_ram_dataspace(Ram_session *ram_session, size_t size,
- bool cached = true)
+ Cache_attribute cached = CACHED)
:
_size(size), _ram_session(ram_session), _local_addr(0),
_cached(cached)
diff --git a/repos/os/src/drivers/ahci/exynos5/ahci_driver.h b/repos/os/src/drivers/ahci/exynos5/ahci_driver.h
index 4bf61f427..78939dad0 100644
--- a/repos/os/src/drivers/ahci/exynos5/ahci_driver.h
+++ b/repos/os/src/drivers/ahci/exynos5/ahci_driver.h
@@ -57,7 +57,7 @@ class Ahci_driver : public Block::Driver
bool dma_enabled() { return true; }
Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t size) {
- return Genode::env()->ram_session()->alloc(size, false); }
+ return Genode::env()->ram_session()->alloc(size, UNCACHED); }
void free_dma_buffer(Genode::Ram_dataspace_capability c) {
return Genode::env()->ram_session()->free(c); }
diff --git a/repos/os/src/drivers/framebuffer/exynos5/main.cc b/repos/os/src/drivers/framebuffer/exynos5/main.cc
index 7e5ff3534..586c199bd 100644
--- a/repos/os/src/drivers/framebuffer/exynos5/main.cc
+++ b/repos/os/src/drivers/framebuffer/exynos5/main.cc
@@ -75,7 +75,7 @@ class Framebuffer::Session_component
_height(height),
_format(Driver::FORMAT_RGB565),
_size(driver.buffer_size(width, height, _format)),
- _ds(env()->ram_session()->alloc(_size, false)),
+ _ds(env()->ram_session()->alloc(_size, WRITE_COMBINED)),
_phys_base(Dataspace_client(_ds).phys_addr())
{
if (driver.init_drv(width, height, _format, output, _phys_base)) {
diff --git a/repos/os/src/drivers/framebuffer/imx53/main.cc b/repos/os/src/drivers/framebuffer/imx53/main.cc
index 6d75cd1a3..ee0c1fc01 100644
--- a/repos/os/src/drivers/framebuffer/imx53/main.cc
+++ b/repos/os/src/drivers/framebuffer/imx53/main.cc
@@ -73,7 +73,7 @@ class Framebuffer::Session_component :
_bb_ds(buffered ? Genode::env()->ram_session()->alloc(_size)
: Genode::Ram_dataspace_capability()),
_bb_addr(buffered ? (void*)Genode::env()->rm_session()->attach(_bb_ds) : 0),
- _fb_ds(Genode::env()->ram_session()->alloc(_size, false)),
+ _fb_ds(Genode::env()->ram_session()->alloc(_size, WRITE_COMBINED)),
_fb_addr((void*)Genode::env()->rm_session()->attach(_fb_ds)),
_ipu(driver.ipu())
{
diff --git a/repos/os/src/drivers/framebuffer/omap4/main.cc b/repos/os/src/drivers/framebuffer/omap4/main.cc
index 3c20f60ca..fbcdac9b4 100644
--- a/repos/os/src/drivers/framebuffer/omap4/main.cc
+++ b/repos/os/src/drivers/framebuffer/omap4/main.cc
@@ -62,7 +62,7 @@ class Framebuffer::Session_component : public Genode::Rpc_objectram_session()->alloc(_size, false)),
+ _ds(env()->ram_session()->alloc(_size, WRITE_COMBINED)),
_phys_base(Dataspace_client(_ds).phys_addr())
{
if (!driver.init(width, height, _format, output, _phys_base)) {
diff --git a/repos/os/src/drivers/pci/pci_session_component.h b/repos/os/src/drivers/pci/pci_session_component.h
index 4c442e65f..5e049009e 100644
--- a/repos/os/src/drivers/pci/pci_session_component.h
+++ b/repos/os/src/drivers/pci/pci_session_component.h
@@ -312,7 +312,7 @@ namespace Pci {
Genode::size_t size)
{
Genode::Ram_dataspace_capability ram =
- Genode::env()->ram_session()->alloc(size, false);
+ Genode::env()->ram_session()->alloc(size, Genode::UNCACHED);
if (!ram.valid() || !_child)
return ram;
diff --git a/repos/os/src/drivers/sd_card/omap4/driver.h b/repos/os/src/drivers/sd_card/omap4/driver.h
index 450f1b4a0..c967bb34f 100644
--- a/repos/os/src/drivers/sd_card/omap4/driver.h
+++ b/repos/os/src/drivers/sd_card/omap4/driver.h
@@ -133,7 +133,7 @@ class Block::Omap4_driver : public Block::Driver
bool dma_enabled() { return _use_dma; }
Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t size) {
- return Genode::env()->ram_session()->alloc(size, false); }
+ return Genode::env()->ram_session()->alloc(size, UNCACHED); }
void free_dma_buffer(Genode::Ram_dataspace_capability c) {
return Genode::env()->ram_session()->free(c); }
diff --git a/repos/os/src/server/loader/ram_session_client_guard.h b/repos/os/src/server/loader/ram_session_client_guard.h
index 219e759e4..67f41878c 100644
--- a/repos/os/src/server/loader/ram_session_client_guard.h
+++ b/repos/os/src/server/loader/ram_session_client_guard.h
@@ -34,7 +34,7 @@ namespace Genode {
Ram_session_client_guard(Ram_session_capability session, size_t amount)
: Ram_session_client(session), _amount(amount), _consumed(0) { }
- Ram_dataspace_capability alloc(size_t size, bool cached)
+ Ram_dataspace_capability alloc(size_t size, Cache_attribute cached)
{
Lock::Guard _consumed_lock_guard(_consumed_lock);
diff --git a/repos/os/src/server/part_blk/component.h b/repos/os/src/server/part_blk/component.h
index 44bd007eb..20bb99191 100644
--- a/repos/os/src/server/part_blk/component.h
+++ b/repos/os/src/server/part_blk/component.h
@@ -271,7 +271,7 @@ class Block::Root :
}
Ram_dataspace_capability ds_cap;
- ds_cap = Genode::env()->ram_session()->alloc(tx_buf_size, true);
+ ds_cap = Genode::env()->ram_session()->alloc(tx_buf_size);
return new (md_alloc())
Session_component(ds_cap,
Partition_table::table().partition(num),
diff --git a/repos/ports/src/app/gdb_monitor/ram_session_component.cc b/repos/ports/src/app/gdb_monitor/ram_session_component.cc
index 79f56c6a8..538e1a541 100644
--- a/repos/ports/src/app/gdb_monitor/ram_session_component.cc
+++ b/repos/ports/src/app/gdb_monitor/ram_session_component.cc
@@ -29,9 +29,9 @@ Ram_session_component::~Ram_session_component()
{ }
-Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, bool cached)
+Ram_dataspace_capability Ram_session_component::alloc(size_t ds_size, Cache_attribute cached)
{
- return _parent_ram_session.alloc(ds_size);
+ return _parent_ram_session.alloc(ds_size, cached);
}
diff --git a/repos/ports/src/app/gdb_monitor/ram_session_component.h b/repos/ports/src/app/gdb_monitor/ram_session_component.h
index c236f5842..b69b6011f 100644
--- a/repos/ports/src/app/gdb_monitor/ram_session_component.h
+++ b/repos/ports/src/app/gdb_monitor/ram_session_component.h
@@ -43,7 +43,7 @@ class Ram_session_component : public Rpc_object
** RAM Session interface **
***************************/
- Ram_dataspace_capability alloc(Genode::size_t, bool);
+ Ram_dataspace_capability alloc(Genode::size_t, Cache_attribute);
void free(Ram_dataspace_capability);
int ref_account(Ram_session_capability);
int transfer_quota(Ram_session_capability, Genode::size_t);
diff --git a/repos/ports/src/noux/ram_session_component.h b/repos/ports/src/noux/ram_session_component.h
index 2ea6e30a2..9840f7159 100644
--- a/repos/ports/src/noux/ram_session_component.h
+++ b/repos/ports/src/noux/ram_session_component.h
@@ -135,7 +135,7 @@ namespace Noux {
** Ram_session interface **
***************************/
- Ram_dataspace_capability alloc(size_t size, bool cached)
+ Ram_dataspace_capability alloc(size_t size, Cache_attribute cached)
{
Ram_dataspace_capability ds_cap =
env()->ram_session()->alloc(size, cached);