base/cache.h: rename Cache_attribute to Cache

The short name is better because the type will become prominently
visible at the API.

Issue #2243
This commit is contained in:
Norman Feske
2021-04-07 19:13:32 +02:00
parent 3ed8df9089
commit 468e7a825c
76 changed files with 226 additions and 237 deletions

View File

@ -49,8 +49,7 @@ class Genode::Mapping
/** /**
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t src_addr, Mapping(addr_t dst_addr, addr_t src_addr, Cache cacheability, bool,
Cache_attribute cacheability, bool,
unsigned l2size, bool rw, bool) unsigned l2size, bool rw, bool)
: :
_dst_addr(dst_addr), _dst_addr(dst_addr),

View File

@ -42,21 +42,20 @@ class Genode::Mapping
{ {
private: private:
addr_t _dst_addr; addr_t _dst_addr;
Foc::l4_fpage_t _fpage { }; Foc::l4_fpage_t _fpage { };
Cache_attribute _cacheability; Cache _cacheability;
bool _iomem; bool _iomem;
public: public:
/** /**
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t src_addr, Mapping(addr_t dst_addr, addr_t src_addr, Cache cache, bool io_mem,
Cache_attribute c, bool io_mem,
unsigned log2size, bool write, bool executable) unsigned log2size, bool write, bool executable)
: :
_dst_addr(dst_addr), _cacheability(c), _iomem(io_mem) _dst_addr(dst_addr), _cacheability(cache), _iomem(io_mem)
{ {
typedef Foc::L4_fpage_rights Rights; typedef Foc::L4_fpage_rights Rights;
Rights rights = ( write && executable) ? Foc::L4_FPAGE_RWX : Rights rights = ( write && executable) ? Foc::L4_FPAGE_RWX :
@ -73,11 +72,12 @@ class Genode::Mapping
Mapping() : _dst_addr(0), _fpage(Foc::l4_fpage_invalid()), Mapping() : _dst_addr(0), _fpage(Foc::l4_fpage_invalid()),
_cacheability(UNCACHED), _iomem(false) { } _cacheability(UNCACHED), _iomem(false) { }
Foc::l4_umword_t dst_addr() const { return _dst_addr; } Foc::l4_umword_t dst_addr() const { return _dst_addr; }
bool grant() const { return false; } bool grant() const { return false; }
Foc::l4_fpage_t fpage() const { return _fpage; } Foc::l4_fpage_t fpage() const { return _fpage; }
Cache_attribute cacheability() const { return _cacheability; } Cache cacheability() const { return _cacheability; }
bool iomem() const { return _iomem; } bool iomem() const { return _iomem; }
/** /**
* Prepare map operation is not needed on Fiasco.OC, since we clear the * Prepare map operation is not needed on Fiasco.OC, since we clear the
* dataspace before this function is called. * dataspace before this function is called.

View File

@ -60,13 +60,13 @@ struct Genode::Mapping : Hw::Mapping
{ {
Mapping() {} Mapping() {}
Mapping(addr_t virt, Mapping(addr_t virt,
addr_t phys, addr_t phys,
Cache_attribute cacheable, Cache cacheable,
bool io, bool io,
unsigned size_log2, unsigned size_log2,
bool writeable, bool writeable,
bool executable) bool executable)
: :
Hw::Mapping(phys, virt, 1 << size_log2, Hw::Mapping(phys, virt, 1 << size_log2,
{ writeable ? Hw::RW : Hw::RO, { writeable ? Hw::RW : Hw::RO,

View File

@ -65,8 +65,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
Vcpu & vcpu = *_vcpus[_vcpu_id_alloc]; Vcpu & vcpu = *_vcpus[_vcpu_id_alloc];
try { try {
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED);
Cache_attribute::UNCACHED);
vcpu.ds_addr = _region_map.attach(vcpu.ds_cap); vcpu.ds_addr = _region_map.attach(vcpu.ds_cap);
} catch (...) { } catch (...) {
if (vcpu.ds_cap.valid()) if (vcpu.ds_cap.valid())

View File

@ -31,12 +31,12 @@ namespace Hw {
struct Hw::Page_flags struct Hw::Page_flags
{ {
Writeable writeable; Writeable writeable;
Executeable executable; Executeable executable;
Privileged privileged; Privileged privileged;
Global global; Global global;
Type type; Type type;
Genode::Cache_attribute cacheable; Genode::Cache cacheable;
void print(Genode::Output & out) const void print(Genode::Output & out) const
{ {

View File

@ -199,8 +199,8 @@ class Hw::Long_translation_table
struct Attribute_index : Base::template Bitfield<2, 3> struct Attribute_index : Base::template Bitfield<2, 3>
{ {
enum { enum {
UNCACHED = Genode::Cache_attribute::UNCACHED, UNCACHED = Genode::Cache::UNCACHED,
CACHED = Genode::Cache_attribute::CACHED, CACHED = Genode::Cache::CACHED,
DEVICE DEVICE
}; };

View File

@ -122,7 +122,7 @@ class Hw::Level_4_translation_table
static access_t create(Page_flags const &flags, addr_t const pa) static access_t create(Page_flags const &flags, addr_t const pa)
{ {
bool const wc = flags.cacheable == Genode::Cache_attribute::WRITE_COMBINED; bool const wc = flags.cacheable == Genode::Cache::WRITE_COMBINED;
return Common::create(flags) return Common::create(flags)
| G::bits(flags.global) | G::bits(flags.global)
@ -303,7 +303,7 @@ class Hw::Page_directory
static typename Base::access_t create(Page_flags const &flags, static typename Base::access_t create(Page_flags const &flags,
addr_t const pa) addr_t const pa)
{ {
bool const wc = flags.cacheable == Genode::Cache_attribute::WRITE_COMBINED; bool const wc = flags.cacheable == Genode::Cache::WRITE_COMBINED;
return Base::create(flags) return Base::create(flags)
| Base::Ps::bits(1) | Base::Ps::bits(1)

View File

@ -74,8 +74,7 @@ class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
/** /**
* Constructor * Constructor
*/ */
Dataspace_component(size_t size, addr_t addr, Dataspace_component(size_t size, addr_t addr, Cache, bool writable,
Cache_attribute, bool writable,
Dataspace_owner * owner) Dataspace_owner * owner)
: :
_size(size), _addr(addr), _cap(), _writable(writable), _owner(owner) _size(size), _addr(addr), _cap(), _writable(writable), _owner(owner)
@ -94,7 +93,7 @@ class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
* reasons and should not be used. * reasons and should not be used.
*/ */
Dataspace_component(size_t size, addr_t, addr_t phys_addr, Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool writable, Dataspace_owner *_owner); Cache, bool writable, Dataspace_owner *_owner);
/** /**
* This constructor is especially used for ROM dataspaces * This constructor is especially used for ROM dataspaces

View File

@ -34,9 +34,9 @@ class Genode::Io_mem_session_component : public Rpc_object<Io_mem_session>
Rpc_entrypoint &_ds_ep; Rpc_entrypoint &_ds_ep;
Io_mem_dataspace_capability _ds_cap; Io_mem_dataspace_capability _ds_cap;
size_t get_arg_size(const char *); size_t get_arg_size(char const *);
addr_t get_arg_phys(const char *); addr_t get_arg_phys(char const *);
Cache_attribute get_arg_wc(const char *); Cache get_arg_wc (char const *);
public: public:

View File

@ -73,7 +73,7 @@ Dataspace_component::Dataspace_component(const char *args)
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr, Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool, Dataspace_owner *_owner) Cache, bool, Dataspace_owner *_owner)
: :
_size(size), _addr(phys_addr), _cap(), _writable(false), _owner(_owner) _size(size), _addr(phys_addr), _cap(), _writable(false), _owner(_owner)
{ {

View File

@ -53,7 +53,7 @@ Io_mem_session_component::Io_mem_session_component(Range_allocator &io_mem_alloc
} }
Cache_attribute Io_mem_session_component::get_arg_wc(const char *) Cache Io_mem_session_component::get_arg_wc(const char *)
{ {
warning(__func__, " not implemented"); warning(__func__, " not implemented");
return UNCACHED; return UNCACHED;

View File

@ -72,7 +72,7 @@ Dataspace_component::Dataspace_component(const char *args)
Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr, Dataspace_component::Dataspace_component(size_t size, addr_t, addr_t phys_addr,
Cache_attribute, bool writable, Dataspace_owner *_owner) Cache, bool writable, Dataspace_owner *_owner)
: :
_size(size), _addr(phys_addr), _cap(), _writable(writable), _owner(_owner) _size(size), _addr(phys_addr), _cap(), _writable(writable), _owner(_owner)
{ {

View File

@ -40,7 +40,7 @@ addr_t Io_mem_session_component::get_arg_phys(const char *args)
} }
Cache_attribute Io_mem_session_component::get_arg_wc(const char *args) Cache Io_mem_session_component::get_arg_wc(const char *args)
{ {
Arg const a = Arg_string::find_arg("wc", args); Arg const a = Arg_string::find_arg("wc", args);
if (a.valid() && a.bool_value(0)) { if (a.valid() && a.bool_value(0)) {

View File

@ -79,8 +79,7 @@ class Stack_area_region_map : public Genode::Region_map
struct Stack_area_ram_allocator : Genode::Ram_allocator struct Stack_area_ram_allocator : Genode::Ram_allocator
{ {
Genode::Ram_dataspace_capability alloc(Genode::size_t, Genode::Ram_dataspace_capability alloc(Genode::size_t, Genode::Cache) override {
Genode::Cache_attribute) override {
return Genode::Ram_dataspace_capability(); } return Genode::Ram_dataspace_capability(); }
void free(Genode::Ram_dataspace_capability) override { } void free(Genode::Ram_dataspace_capability) override { }

View File

@ -31,9 +31,9 @@ class Genode::Mapping
{ {
private: private:
addr_t const _dst_addr; addr_t const _dst_addr;
Cache_attribute const _attr; Cache const _cache;
Nova::Mem_crd const _mem_crd; Nova::Mem_crd const _mem_crd;
enum { PAGE_SIZE_LOG2 = 12 }; enum { PAGE_SIZE_LOG2 = 12 };
@ -43,12 +43,12 @@ class Genode::Mapping
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t source_addr, Mapping(addr_t dst_addr, addr_t source_addr,
Cache_attribute c, bool /* io_mem */, Cache cache, bool /* io_mem */,
unsigned size_log2, unsigned size_log2,
bool writeable, bool executable) bool writeable, bool executable)
: :
_dst_addr(dst_addr), _dst_addr(dst_addr),
_attr(c), _cache(cache),
_mem_crd(source_addr >> PAGE_SIZE_LOG2, _mem_crd(source_addr >> PAGE_SIZE_LOG2,
size_log2 - PAGE_SIZE_LOG2, size_log2 - PAGE_SIZE_LOG2,
Nova::Rights(true, writeable, executable)) Nova::Rights(true, writeable, executable))
@ -56,12 +56,10 @@ class Genode::Mapping
void prepare_map_operation() { } void prepare_map_operation() { }
Nova::Mem_crd mem_crd() const { return _mem_crd; } Nova::Mem_crd mem_crd() const { return _mem_crd; }
bool dma() const { return _cache != CACHED; };
bool dma() { return _attr != CACHED; }; bool write_combined() const { return _cache == WRITE_COMBINED; };
bool write_combined() { return _attr == WRITE_COMBINED; }; addr_t dst_addr() const { return _dst_addr; }
addr_t dst_addr() { return _dst_addr; }
}; };

View File

@ -41,8 +41,7 @@ class Genode::Mapping
/** /**
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t src_addr, Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool io_mem,
Cache_attribute cacheability, bool io_mem,
unsigned l2size, bool rw, bool executable); unsigned l2size, bool rw, bool executable);
/** /**

View File

@ -65,7 +65,7 @@ static inline L4_ThreadId_t thread_get_my_global_id()
** Mapping ** ** Mapping **
*************/ *************/
Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache_attribute, bool, Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool,
unsigned l2size, bool rw, bool) unsigned l2size, bool rw, bool)
: :
_fpage(L4_FpageLog2(dst_addr, l2size)), _fpage(L4_FpageLog2(dst_addr, l2size)),

View File

@ -47,10 +47,8 @@ class Genode::Mapping
/** /**
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t src_addr, Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool io_mem,
Cache_attribute, bool io_mem, unsigned l2size, bool rw, bool executable);
unsigned l2size,
bool rw, bool executable);
/** /**
* Construct invalid mapping * Construct invalid mapping

View File

@ -32,9 +32,8 @@ using namespace Pistachio;
** Mapping ** ** Mapping **
*************/ *************/
Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool,
Cache_attribute, bool, unsigned l2size, unsigned l2size, bool rw, bool)
bool rw, bool)
{ {
bool const grant = false; bool const grant = false;

View File

@ -30,13 +30,13 @@ class Genode::Mapping
private: private:
addr_t _from_phys_addr { 0 }; addr_t _from_phys_addr { 0 };
addr_t _to_virt_addr { 0 }; addr_t _to_virt_addr { 0 };
Cache_attribute _attr { CACHED }; Cache _cache { CACHED };
size_t _num_pages { 0 }; size_t _num_pages { 0 };
addr_t _fault_type { 0 }; addr_t _fault_type { 0 };
bool _writeable { false }; bool _writeable { false };
bool _executable { false }; bool _executable { false };
enum { PAGE_SIZE_LOG2 = 12 }; enum { PAGE_SIZE_LOG2 = 12 };
@ -45,13 +45,12 @@ class Genode::Mapping
/** /**
* Constructor * Constructor
*/ */
Mapping(addr_t dst_addr, addr_t src_addr, Mapping(addr_t dst_addr, addr_t src_addr, Cache const cache, bool,
Cache_attribute const cacheability, bool,
unsigned l2size, bool rw, bool executable) unsigned l2size, bool rw, bool executable)
: :
_from_phys_addr(src_addr), _from_phys_addr(src_addr),
_to_virt_addr(dst_addr), _to_virt_addr(dst_addr),
_attr(cacheability), _cache(cache),
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)), _num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
_writeable(rw), _executable(executable) _writeable(rw), _executable(executable)
{ } { }
@ -69,13 +68,13 @@ class Genode::Mapping
*/ */
void prepare_map_operation() { } void prepare_map_operation() { }
addr_t from_phys() const { return _from_phys_addr; } addr_t from_phys() const { return _from_phys_addr; }
addr_t to_virt() const { return _to_virt_addr; } addr_t to_virt() const { return _to_virt_addr; }
size_t num_pages() const { return _num_pages; } size_t num_pages() const { return _num_pages; }
bool writeable() const { return _writeable; } bool writeable() const { return _writeable; }
bool executable() const { return _executable; } bool executable() const { return _executable; }
Cache_attribute cacheability() const { return _attr; } Cache cacheability() const { return _cache; }
addr_t fault_type() const { return _fault_type; } addr_t fault_type() const { return _fault_type; }
}; };

View File

@ -40,7 +40,7 @@ namespace Genode {
try { try {
platform = platform ? platform : &platform_specific(); platform = platform ? platform : &platform_specific();
platform->core_vm_space().map(from_phys, to_virt, num_pages, platform->core_vm_space().map(from_phys, to_virt, num_pages,
Cache_attribute::CACHED, Cache::CACHED,
WRITEABLE, NON_EXECUTABLE, WRITEABLE, NON_EXECUTABLE,
DONT_FLUSH); DONT_FLUSH);
} catch (Page_table_registry::Mapping_cache_full) { } catch (Page_table_registry::Mapping_cache_full) {

View File

@ -182,7 +182,7 @@ class Genode::Vm_space
template <typename FN> template <typename FN>
bool _map_frame(addr_t const from_phys, addr_t const to_dest, bool _map_frame(addr_t const from_phys, addr_t const to_dest,
Cache_attribute const cacheability, Cache const cacheability,
bool const writable, bool const executable, bool const writable, bool const executable,
bool const flush_support, bool guest, FN const &fn) bool const flush_support, bool guest, FN const &fn)
{ {
@ -242,9 +242,9 @@ class Genode::Vm_space
/** /**
* Platform specific map/unmap of a page frame * Platform specific map/unmap of a page frame
*/ */
long _map_page(Genode::Cap_sel const &idx, Genode::addr_t const virt, long _map_page(Genode::Cap_sel const &idx, addr_t virt,
Cache_attribute const cacheability, bool const write, Cache cacheability, bool const write,
bool const writable, bool guest); bool writable, bool guest);
long _unmap_page(Genode::Cap_sel const &idx); long _unmap_page(Genode::Cap_sel const &idx);
long _invalidate_page(Genode::Cap_sel const &, seL4_Word const, long _invalidate_page(Genode::Cap_sel const &, seL4_Word const,
seL4_Word const); seL4_Word const);
@ -380,7 +380,7 @@ class Genode::Vm_space
} }
bool map(addr_t const from_phys, addr_t const to_virt, bool map(addr_t const from_phys, addr_t const to_virt,
size_t const num_pages, Cache_attribute const cacheability, size_t const num_pages, Cache const cacheability,
bool const writable, bool const executable, bool flush_support) bool const writable, bool const executable, bool flush_support)
{ {
auto fn_unmap = [&] (Cap_sel const &idx, addr_t const v_addr) auto fn_unmap = [&] (Cap_sel const &idx, addr_t const v_addr)
@ -430,7 +430,7 @@ class Genode::Vm_space
} }
void map_guest(addr_t const from_phys, addr_t const guest_phys, void map_guest(addr_t const from_phys, addr_t const guest_phys,
size_t const num_pages, Cache_attribute const cacheability, size_t const num_pages, Cache const cacheability,
bool const writable, bool const executable, bool flush_support) bool const writable, bool const executable, bool flush_support)
{ {
auto fn_unmap = [&] (Cap_sel const &idx, addr_t const) { auto fn_unmap = [&] (Cap_sel const &idx, addr_t const) {

View File

@ -101,7 +101,7 @@ bool Platform_pd::bind_thread(Platform_thread &thread)
enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true, NON_EXECUTABLE = false }; enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true, NON_EXECUTABLE = false };
_vm_space.alloc_page_tables(utcb, get_page_size()); _vm_space.alloc_page_tables(utcb, get_page_size());
_vm_space.map(thread._info.ipc_buffer_phys, utcb, ONE_PAGE, _vm_space.map(thread._info.ipc_buffer_phys, utcb, ONE_PAGE,
Cache_attribute::CACHED, WRITABLE, NON_EXECUTABLE, FLUSHABLE); Cache::CACHED, WRITABLE, NON_EXECUTABLE, FLUSHABLE);
return true; return true;
} }

View File

@ -26,7 +26,7 @@ static long map_page_table(Genode::Cap_sel const pagetable,
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx, long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
Genode::addr_t const virt, Genode::addr_t const virt,
Cache_attribute const cacheability, Cache const cacheability,
bool const writable, bool const writable,
bool const executable, bool const executable,
bool) bool)

View File

@ -54,7 +54,7 @@ Vm_session_component::Vcpu::Vcpu(Rpc_entrypoint &ep,
_ep(ep), _ep(ep),
_ram_alloc(ram_alloc), _ram_alloc(ram_alloc),
_ds_cap (_ram_alloc.alloc(align_addr(sizeof(Genode::Vcpu_state), 12), _ds_cap (_ram_alloc.alloc(align_addr(sizeof(Genode::Vcpu_state), 12),
Cache_attribute::CACHED)) Cache::CACHED))
{ {
try { try {
/* notification cap */ /* notification cap */

View File

@ -15,8 +15,8 @@
#include <vm_space.h> #include <vm_space.h>
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx, long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
Genode::addr_t const virt, Genode::addr_t const virt,
Cache_attribute const cacheability, Cache const cacheability,
bool const writable, bool const writable,
bool const, bool ept) bool const, bool ept)
{ {

View File

@ -114,7 +114,7 @@ class Stack_area_region_map : public Region_map
struct Stack_area_ram_allocator : Ram_allocator struct Stack_area_ram_allocator : Ram_allocator
{ {
Ram_dataspace_capability alloc(size_t, Cache_attribute) override { Ram_dataspace_capability alloc(size_t, Cache) override {
return reinterpret_cap_cast<Ram_dataspace>(Native_capability()); } return reinterpret_cap_cast<Ram_dataspace>(Native_capability()); }
void free(Ram_dataspace_capability) override { void free(Ram_dataspace_capability) override {

View File

@ -39,7 +39,7 @@ class Genode::Attached_ram_dataspace
Region_map *_rm = nullptr; Region_map *_rm = nullptr;
Ram_dataspace_capability _ds { }; Ram_dataspace_capability _ds { };
void *_local_addr = nullptr; void *_local_addr = nullptr;
Cache_attribute const _cached = CACHED; Cache const _cache = CACHED;
template <typename T> template <typename T>
static void _swap(T &v1, T &v2) { T tmp = v1; v1 = v2; v2 = tmp; } static void _swap(T &v1, T &v2) { T tmp = v1; v1 = v2; v2 = tmp; }
@ -58,7 +58,7 @@ class Genode::Attached_ram_dataspace
if (!_size) return; if (!_size) return;
try { try {
_ds = _ram->alloc(_size, _cached); _ds = _ram->alloc(_size, _cache);
_local_addr = _rm->attach(_ds); _local_addr = _rm->attach(_ds);
} }
/* revert allocation if attaching the dataspace failed */ /* revert allocation if attaching the dataspace failed */
@ -75,7 +75,7 @@ class Genode::Attached_ram_dataspace
* work-around for this issues, we eagerly map the whole * work-around for this issues, we eagerly map the whole
* dataspace before writing actual content to it. * dataspace before writing actual content to it.
*/ */
if (_cached != CACHED) { if (_cache != CACHED) {
enum { PAGE_SIZE = 4096 }; enum { PAGE_SIZE = 4096 };
unsigned char volatile *base = (unsigned char volatile *)_local_addr; unsigned char volatile *base = (unsigned char volatile *)_local_addr;
for (size_t i = 0; i < _size; i += PAGE_SIZE) for (size_t i = 0; i < _size; i += PAGE_SIZE)
@ -100,9 +100,9 @@ class Genode::Attached_ram_dataspace
* \throw Region_map::Invalid_dataspace * \throw Region_map::Invalid_dataspace
*/ */
Attached_ram_dataspace(Ram_allocator &ram, Region_map &rm, Attached_ram_dataspace(Ram_allocator &ram, Region_map &rm,
size_t size, Cache_attribute cached = CACHED) size_t size, Cache cache = CACHED)
: :
_size(size), _ram(&ram), _rm(&rm), _cached(cached) _size(size), _ram(&ram), _rm(&rm), _cache(cache)
{ {
_alloc_and_attach(); _alloc_and_attach();
} }

View File

@ -16,7 +16,7 @@
namespace Genode { namespace Genode {
enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED }; enum Cache { UNCACHED, WRITE_COMBINED, CACHED };
} }
#endif /* _INCLUDE__BASE__CACHE_H_ */ #endif /* _INCLUDE__BASE__CACHE_H_ */

View File

@ -36,17 +36,16 @@ struct Genode::Ram_allocator : Interface
/** /**
* Allocate RAM dataspace * Allocate RAM dataspace
* *
* \param size size of RAM dataspace * \param size size of RAM dataspace
* \param cached selects cacheability attributes of the memory, * \param cache selects cacheability attributes of the memory,
* uncached memory, i.e., for DMA buffers * uncached memory, i.e., for DMA buffers
* *
* \throw Out_of_ram * \throw Out_of_ram
* \throw Out_of_caps * \throw Out_of_caps
* *
* \return capability to new RAM dataspace * \return capability to new RAM dataspace
*/ */
virtual Ram_dataspace_capability alloc(size_t size, virtual Ram_dataspace_capability alloc(size_t size, Cache cache = CACHED) = 0;
Cache_attribute cached = CACHED) = 0;
/** /**
* Free RAM dataspace * Free RAM dataspace
@ -82,7 +81,7 @@ class Genode::Constrained_ram_allocator : public Ram_allocator
_ram_alloc(ram_alloc), _ram_guard(ram_guard), _cap_guard(cap_guard) _ram_alloc(ram_alloc), _ram_guard(ram_guard), _cap_guard(cap_guard)
{ } { }
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached = CACHED) override Ram_dataspace_capability alloc(size_t size, Cache cache = CACHED) override
{ {
size_t page_aligned_size = align_addr(size, 12); size_t page_aligned_size = align_addr(size, 12);
@ -92,7 +91,7 @@ class Genode::Constrained_ram_allocator : public Ram_allocator
/* /*
* \throw Out_of_caps, Out_of_ram * \throw Out_of_caps, Out_of_ram
*/ */
Ram_dataspace_capability ds = _ram_alloc.alloc(page_aligned_size, cached); Ram_dataspace_capability ds = _ram_alloc.alloc(page_aligned_size, cache);
ram. acknowledge(); ram. acknowledge();
caps.acknowledge(); caps.acknowledge();

View File

@ -73,10 +73,9 @@ struct Genode::Pd_session_client : Rpc_client<Pd_session>
Cap_quota cap_quota() const override { return call<Rpc_cap_quota>(); } Cap_quota cap_quota() const override { return call<Rpc_cap_quota>(); }
Cap_quota used_caps() const override { return call<Rpc_used_caps>(); } Cap_quota used_caps() const override { return call<Rpc_used_caps>(); }
Ram_dataspace_capability alloc(size_t size, Ram_dataspace_capability alloc(size_t size, Cache cache = CACHED) override
Cache_attribute cached = CACHED) override
{ {
return call<Rpc_alloc>(size, cached); return call<Rpc_alloc>(size, cache);
} }
void free(Ram_dataspace_capability ds) override { call<Rpc_free>(ds); } void free(Ram_dataspace_capability ds) override { call<Rpc_free>(ds); }

View File

@ -350,7 +350,7 @@ struct Genode::Pd_session : Session, Ram_allocator
GENODE_RPC_THROW(Rpc_alloc, Ram_dataspace_capability, alloc, GENODE_RPC_THROW(Rpc_alloc, Ram_dataspace_capability, alloc,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps, Undefined_ref_account), GENODE_TYPE_LIST(Out_of_ram, Out_of_caps, Undefined_ref_account),
size_t, Cache_attribute); size_t, Cache);
GENODE_RPC(Rpc_free, void, free, Ram_dataspace_capability); GENODE_RPC(Rpc_free, void, free, Ram_dataspace_capability);
GENODE_RPC_THROW(Rpc_transfer_ram_quota, void, transfer_quota, GENODE_RPC_THROW(Rpc_transfer_ram_quota, void, transfer_quota,
GENODE_TYPE_LIST(Out_of_ram, Invalid_session, Undefined_ref_account), GENODE_TYPE_LIST(Out_of_ram, Invalid_session, Undefined_ref_account),

View File

@ -45,7 +45,7 @@ namespace Genode {
/* /*
* Access memory cached, write-combined, or uncached respectively * Access memory cached, write-combined, or uncached respectively
*/ */
Cache_attribute const _cache { CACHED }; Cache const _cache { CACHED };
List<Rm_region> _regions { }; /* regions this is attached to */ List<Rm_region> _regions { }; /* regions this is attached to */
Mutex _mutex { }; Mutex _mutex { };
@ -79,7 +79,7 @@ namespace Genode {
* This constructor is used by RAM and ROM dataspaces. * This constructor is used by RAM and ROM dataspaces.
*/ */
Dataspace_component(size_t size, addr_t core_local_addr, Dataspace_component(size_t size, addr_t core_local_addr,
Cache_attribute cache, bool writable, Cache cache, bool writable,
Dataspace_owner *owner) Dataspace_owner *owner)
: :
_phys_addr(core_local_addr), _core_local_addr(core_local_addr), _phys_addr(core_local_addr), _core_local_addr(core_local_addr),
@ -98,7 +98,7 @@ namespace Genode {
* space is needed to send a mapping to another address space. * space is needed to send a mapping to another address space.
*/ */
Dataspace_component(size_t size, addr_t core_local_addr, Dataspace_component(size_t size, addr_t core_local_addr,
addr_t phys_addr, Cache_attribute cache, addr_t phys_addr, Cache cache,
bool writable, Dataspace_owner *owner) bool writable, Dataspace_owner *owner)
: :
_phys_addr(phys_addr), _core_local_addr(core_local_addr), _phys_addr(phys_addr), _core_local_addr(core_local_addr),
@ -117,9 +117,9 @@ namespace Genode {
*/ */
virtual Native_capability sub_rm() { return Dataspace_capability(); } virtual Native_capability sub_rm() { return Dataspace_capability(); }
addr_t core_local_addr() const { return _core_local_addr; } addr_t core_local_addr() const { return _core_local_addr; }
bool io_mem() const { return _io_mem; } bool io_mem() const { return _io_mem; }
Cache_attribute cacheability() const { return _cache; } Cache cacheability() const { return _cache; }
/** /**
* Return dataspace base address to be used for map operations * Return dataspace base address to be used for map operations

View File

@ -35,10 +35,10 @@ namespace Genode {
*/ */
struct Dataspace_attr struct Dataspace_attr
{ {
size_t size { 0 }; size_t size { 0 };
addr_t core_local_addr { 0 }; addr_t core_local_addr { 0 };
addr_t phys_addr { 0 }; addr_t phys_addr { 0 };
Cache_attribute cacheable { UNCACHED }; Cache cacheable { UNCACHED };
/** /**
* Base address of request used for freeing mem-ranges * Base address of request used for freeing mem-ranges
@ -59,7 +59,7 @@ namespace Genode {
* An invalid dataspace is represented by setting all * An invalid dataspace is represented by setting all
* arguments to zero. * arguments to zero.
*/ */
Dataspace_attr(size_t s, addr_t cla, addr_t pa, Cache_attribute c, Dataspace_attr(size_t s, addr_t cla, addr_t pa, Cache c,
addr_t req_base) addr_t req_base)
: :
size(s), core_local_addr(cla), phys_addr(pa), size(s), core_local_addr(cla), phys_addr(pa),
@ -88,7 +88,7 @@ namespace Genode {
Io_dataspace_component _ds; Io_dataspace_component _ds;
Rpc_entrypoint &_ds_ep; Rpc_entrypoint &_ds_ep;
Io_mem_dataspace_capability _ds_cap { }; Io_mem_dataspace_capability _ds_cap { };
Cache_attribute _cacheable { UNCACHED }; Cache _cacheable { UNCACHED };
Dataspace_attr _prepare_io_mem(const char *args, Range_allocator &ram_alloc); Dataspace_attr _prepare_io_mem(const char *args, Range_allocator &ram_alloc);

View File

@ -315,7 +315,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
** RAM allocation and accounting ** ** RAM allocation and accounting **
***********************************/ ***********************************/
Ram_dataspace_capability alloc(size_t, Cache_attribute) override; Ram_dataspace_capability alloc(size_t, Cache) override;
void free(Ram_dataspace_capability) override; void free(Ram_dataspace_capability) override;

View File

@ -106,7 +106,7 @@ class Genode::Ram_dataspace_factory : public Ram_allocator,
** Ram_allocator interface ** ** Ram_allocator interface **
*****************************/ *****************************/
Ram_dataspace_capability alloc(size_t, Cache_attribute) override; Ram_dataspace_capability alloc(size_t, Cache) override;
void free(Ram_dataspace_capability) override; void free(Ram_dataspace_capability) override;
size_t dataspace_size(Ram_dataspace_capability ds) const override; size_t dataspace_size(Ram_dataspace_capability ds) const override;
}; };

View File

@ -33,10 +33,10 @@ class Genode::Synced_ram_allocator : public Ram_allocator
Synced_ram_allocator(Ram_allocator &alloc) : _alloc(alloc) { } Synced_ram_allocator(Ram_allocator &alloc) : _alloc(alloc) { }
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached) override Ram_dataspace_capability alloc(size_t size, Cache cache) override
{ {
Mutex::Guard mutex_guard(_mutex); Mutex::Guard mutex_guard(_mutex);
return _alloc.alloc(size, cached); return _alloc.alloc(size, cache);
} }
void free(Ram_dataspace_capability ds) override void free(Ram_dataspace_capability ds) override

View File

@ -21,7 +21,7 @@ using namespace Genode;
Ram_dataspace_capability Ram_dataspace_capability
Pd_session_component::alloc(size_t ds_size, Cache_attribute cached) Pd_session_component::alloc(size_t ds_size, Cache cache)
{ {
/* zero-sized dataspaces are not allowed */ /* zero-sized dataspaces are not allowed */
if (!ds_size) return Ram_dataspace_capability(); if (!ds_size) return Ram_dataspace_capability();
@ -62,7 +62,7 @@ Pd_session_component::alloc(size_t ds_size, Cache_attribute cached)
* \throw Out_of_ram * \throw Out_of_ram
* \throw Out_of_caps * \throw Out_of_caps
*/ */
Ram_dataspace_capability ram_ds = _ram_ds_factory.alloc(ds_size, cached); Ram_dataspace_capability ram_ds = _ram_ds_factory.alloc(ds_size, cache);
/* /*
* We returned from '_ram_ds_factory.alloc' with a valid dataspace. * We returned from '_ram_ds_factory.alloc' with a valid dataspace.

View File

@ -21,7 +21,7 @@ using namespace Genode;
Ram_dataspace_capability Ram_dataspace_capability
Ram_dataspace_factory::alloc(size_t ds_size, Cache_attribute cached) Ram_dataspace_factory::alloc(size_t ds_size, Cache cache)
{ {
/* zero-sized dataspaces are not allowed */ /* zero-sized dataspaces are not allowed */
if (!ds_size) return Ram_dataspace_capability(); if (!ds_size) return Ram_dataspace_capability();
@ -118,7 +118,7 @@ Ram_dataspace_factory::alloc(size_t ds_size, Cache_attribute cached)
* \throw Out_of_caps * \throw Out_of_caps
*/ */
Dataspace_component &ds = *new (_ds_slab) Dataspace_component &ds = *new (_ds_slab)
Dataspace_component(ds_size, (addr_t)ds_addr, cached, true, this); Dataspace_component(ds_size, (addr_t)ds_addr, cache, true, this);
/* create native shared memory representation of dataspace */ /* create native shared memory representation of dataspace */
try { _export_ram_ds(ds); } try { _export_ram_ds(ds); }

View File

@ -121,7 +121,7 @@ class Stack_area_region_map : public Region_map
struct Stack_area_ram_allocator : Ram_allocator struct Stack_area_ram_allocator : Ram_allocator
{ {
Ram_dataspace_capability alloc(size_t, Cache_attribute) override { Ram_dataspace_capability alloc(size_t, Cache) override {
return reinterpret_cap_cast<Ram_dataspace>(Native_capability()); } return reinterpret_cap_cast<Ram_dataspace>(Native_capability()); }
void free(Ram_dataspace_capability) override { } void free(Ram_dataspace_capability) override { }

View File

@ -38,7 +38,7 @@ struct Genode::Expanding_pd_session_client : Pd_session_client
Expanding_pd_session_client(Parent &parent, Pd_session_capability cap) Expanding_pd_session_client(Parent &parent, Pd_session_capability cap)
: Pd_session_client(cap), _parent(parent) { } : Pd_session_client(cap), _parent(parent) { }
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached = UNCACHED) override Ram_dataspace_capability alloc(size_t size, Cache cache = UNCACHED) override
{ {
/* /*
* If the RAM session runs out of quota, issue a resource request * If the RAM session runs out of quota, issue a resource request
@ -49,7 +49,7 @@ struct Genode::Expanding_pd_session_client : Pd_session_client
return retry<Out_of_ram>( return retry<Out_of_ram>(
[&] () { [&] () {
return retry<Out_of_caps>( return retry<Out_of_caps>(
[&] () { return Pd_session_client::alloc(size, cached); }, [&] () { return Pd_session_client::alloc(size, cache); },
[&] () { _request_caps_from_parent(UPGRADE_CAPS); }, [&] () { _request_caps_from_parent(UPGRADE_CAPS); },
NUM_ATTEMPTS); NUM_ATTEMPTS);
}, },

View File

@ -1198,7 +1198,7 @@ struct Dma_wc_dataspace : Genode::Attached_ram_dataspace,
: Genode::Attached_ram_dataspace(Lx_kit::env().ram(), : Genode::Attached_ram_dataspace(Lx_kit::env().ram(),
Lx_kit::env().rm(), Lx_kit::env().rm(),
size, size,
Genode::Cache_attribute::WRITE_COMBINED) { } Genode::Cache::WRITE_COMBINED) { }
}; };
static Genode::List<Dma_wc_dataspace> &_dma_wc_ds_list() static Genode::List<Dma_wc_dataspace> &_dma_wc_ds_list()

View File

@ -31,8 +31,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
Genode::Ram_dataspace_capability Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) { Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
return Lx_kit::env().env().ram().alloc(size, cached); } return Lx_kit::env().env().ram().alloc(size, cache); }
void Lx::backend_free(Genode::Ram_dataspace_capability cap) { void Lx::backend_free(Genode::Ram_dataspace_capability cap) {

View File

@ -31,8 +31,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
Genode::Ram_dataspace_capability Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) { Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
return Lx_kit::env().env().ram().alloc(size, cached); } return Lx_kit::env().env().ram().alloc(size, cache); }
void Lx::backend_free(Genode::Ram_dataspace_capability cap) { void Lx::backend_free(Genode::Ram_dataspace_capability cap) {

View File

@ -32,8 +32,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
Genode::Ram_dataspace_capability Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) { Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
return Lx_kit::env().env().ram().alloc(size, cached); } return Lx_kit::env().env().ram().alloc(size, cache); }
void Lx::backend_free(Genode::Ram_dataspace_capability cap) { void Lx::backend_free(Genode::Ram_dataspace_capability cap) {

View File

@ -128,23 +128,32 @@ struct Lx_driver
} }
}; };
struct task_struct *current; struct task_struct *current;
struct workqueue_struct *system_wq; struct workqueue_struct *system_wq;
unsigned long jiffies; unsigned long jiffies;
Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
return Lx_kit::env().env().ram().alloc(size, cached); } Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size,
Genode::Cache cache)
{
return Lx_kit::env().env().ram().alloc(size, cache);
}
const char *dev_name(const struct device *dev) { return dev->name; } const char *dev_name(const struct device *dev) { return dev->name; }
size_t strlen(const char *s) { return Genode::strlen(s); } size_t strlen(const char *s) { return Genode::strlen(s); }
int mutex_lock_interruptible(struct mutex *m) int mutex_lock_interruptible(struct mutex *m)
{ {
mutex_lock(m); mutex_lock(m);
return 0; return 0;
} }
int driver_register(struct device_driver *drv) int driver_register(struct device_driver *drv)
{ {
if (!drv) if (!drv)

View File

@ -172,8 +172,7 @@ void backend_alloc_init(Env & env, Ram_allocator&, Allocator&)
} }
Ram_dataspace_capability Ram_dataspace_capability Lx::backend_alloc(addr_t size, Cache)
Lx::backend_alloc(addr_t size, Cache_attribute)
{ {
return resource_env().platform.alloc_dma_buffer(size); return resource_env().platform.alloc_dma_buffer(size);
} }

View File

@ -209,9 +209,12 @@ struct task_struct *current;
struct workqueue_struct *system_wq; struct workqueue_struct *system_wq;
unsigned long jiffies; unsigned long jiffies;
Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
return Lx_kit::env().env().ram().alloc(size, cached); }
Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size,
Genode::Cache cache)
{
return Lx_kit::env().env().ram().alloc(size, cache);
}
int usb_register_driver(struct usb_driver * driver, struct module *, const char *) int usb_register_driver(struct usb_driver * driver, struct module *, const char *)

View File

@ -195,9 +195,12 @@ struct task_struct *current;
struct workqueue_struct *system_wq; struct workqueue_struct *system_wq;
unsigned long jiffies; unsigned long jiffies;
Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
return Lx_kit::env().env().ram().alloc(size, cached); }
Genode::Ram_dataspace_capability Lx::backend_alloc(Genode::addr_t size,
Genode::Cache cache)
{
return Lx_kit::env().env().ram().alloc(size, cache);
}
int usb_register_driver(struct usb_driver * driver, struct module *, const char *) int usb_register_driver(struct usb_driver * driver, struct module *, const char *)

View File

@ -20,16 +20,16 @@
struct page *alloc_pages(gfp_t const gfp_mask, unsigned int order) struct page *alloc_pages(gfp_t const gfp_mask, unsigned int order)
{ {
using Genode::Cache_attribute; using Genode::Cache;
struct page *page = (struct page *)kzalloc(sizeof(struct page), 0); struct page *page = (struct page *)kzalloc(sizeof(struct page), 0);
size_t size = PAGE_SIZE << order; size_t size = PAGE_SIZE << order;
gfp_t const dma_mask = (GFP_DMA | GFP_LX_DMA | GFP_DMA32); gfp_t const dma_mask = (GFP_DMA | GFP_LX_DMA | GFP_DMA32);
Cache_attribute const cached = (gfp_mask & dma_mask) ? Genode::UNCACHED Cache const cache = (gfp_mask & dma_mask) ? Genode::UNCACHED
: Genode::CACHED; : Genode::CACHED;
Genode::Ram_dataspace_capability ds_cap = Lx::backend_alloc(size, cached); Genode::Ram_dataspace_capability ds_cap = Lx::backend_alloc(size, cache);
page->addr = Lx_kit::env().rm().attach(ds_cap); page->addr = Lx_kit::env().rm().attach(ds_cap);
page->paddr = Genode::Dataspace_client(ds_cap).phys_addr(); page->paddr = Genode::Dataspace_client(ds_cap).phys_addr();

View File

@ -25,8 +25,7 @@ namespace Lx {
using namespace Genode; using namespace Genode;
Ram_dataspace_capability backend_alloc(addr_t size, Ram_dataspace_capability backend_alloc(addr_t size, Cache);
Cache_attribute cached);
void backend_free(Ram_dataspace_capability cap); void backend_free(Ram_dataspace_capability cap);
} }

View File

@ -198,15 +198,14 @@ class Lx::Pci_dev : public pci_dev, public Lx_kit::List<Pci_dev>::Element
Io_port &io_port() { return _io_port; } Io_port &io_port() { return _io_port; }
Genode::Io_mem_session_capability io_mem(unsigned bar, Genode::Io_mem_session_capability io_mem(unsigned bar, Genode::Cache cache)
Genode::Cache_attribute cache_attribute)
{ {
if (bar >= DEVICE_COUNT_RESOURCE) if (bar >= DEVICE_COUNT_RESOURCE)
return Genode::Io_mem_session_capability(); return Genode::Io_mem_session_capability();
if (!_io_mem[bar].valid()) if (!_io_mem[bar].valid())
_io_mem[bar] = _client.io_mem(_client.phys_bar_to_virt(bar), _io_mem[bar] = _client.io_mem(_client.phys_bar_to_virt(bar),
cache_attribute); cache);
return _io_mem[bar]; return _io_mem[bar];
} }

View File

@ -24,7 +24,7 @@ namespace Lx {
using namespace Genode; using namespace Genode;
void *ioremap(addr_t, unsigned long, Cache_attribute); void *ioremap(addr_t, unsigned long, Cache);
void iounmap(volatile void*); void iounmap(volatile void*);
Dataspace_capability ioremap_lookup(addr_t, Genode::size_t); Dataspace_capability ioremap_lookup(addr_t, Genode::size_t);
} }

View File

@ -62,10 +62,10 @@ class Lx::Pci_dev_registry
Pci_dev* first() { return _devs.first(); } Pci_dev* first() { return _devs.first(); }
Genode::Io_mem_dataspace_capability io_mem(Genode::addr_t phys, Genode::Io_mem_dataspace_capability io_mem(Genode::addr_t phys,
Genode::Cache_attribute cache_attribute, Genode::Cache cache,
Genode::size_t size, Genode::size_t size,
Genode::addr_t &offset) Genode::addr_t &offset)
{ {
enum { PCI_ROM_RESOURCE = 6 }; enum { PCI_ROM_RESOURCE = 6 };
@ -85,7 +85,7 @@ class Lx::Pci_dev_registry
offset = phys - pci_resource_start(d, bar); offset = phys - pci_resource_start(d, bar);
Genode::Io_mem_session_capability io_mem_cap = Genode::Io_mem_session_capability io_mem_cap =
d->io_mem(bar, cache_attribute); d->io_mem(bar, cache);
return Genode::Io_mem_session_client(io_mem_cap).dataspace(); return Genode::Io_mem_session_client(io_mem_cap).dataspace();
} }

View File

@ -73,7 +73,7 @@ struct Memory_object_base : Genode::Object_pool<Memory_object_base>::Entry
Genode::Ram_dataspace_capability Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) Lx::backend_alloc(Genode::addr_t size, Genode::Cache)
{ {
using namespace Genode; using namespace Genode;

View File

@ -40,7 +40,7 @@ namespace Lx
Genode::Allocator&, Genode::Allocator&,
Genode::Nic_driver_mode); Genode::Nic_driver_mode);
Genode::Ram_dataspace_capability backend_alloc(Genode::addr_t, Genode::Cache_attribute); Genode::Ram_dataspace_capability backend_alloc(Genode::addr_t, Genode::Cache);
void backend_free(Genode::Ram_dataspace_capability); void backend_free(Genode::Ram_dataspace_capability);
void get_mac_address(unsigned char *); void get_mac_address(unsigned char *);

View File

@ -48,7 +48,7 @@ class Lx_kit::Slab_backend_alloc : public Lx::Slab_backend_alloc,
}; };
addr_t _base; /* virt. base address */ addr_t _base; /* virt. base address */
Genode::Cache_attribute _cached; /* non-/cached RAM */ Genode::Cache _cache; /* non-/cached RAM */
Genode::Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */ Genode::Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */ addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
int _index; /* current index in ds_cap */ int _index; /* current index in ds_cap */
@ -62,7 +62,7 @@ class Lx_kit::Slab_backend_alloc : public Lx::Slab_backend_alloc,
} }
try { try {
_ds_cap[_index] = Lx::backend_alloc(P_BLOCK_SIZE, _cached); _ds_cap[_index] = Lx::backend_alloc(P_BLOCK_SIZE, _cache);
/* attach at index * V_BLOCK_SIZE */ /* attach at index * V_BLOCK_SIZE */
Region_map_client::attach_at(_ds_cap[_index], _index * V_BLOCK_SIZE, P_BLOCK_SIZE, 0); Region_map_client::attach_at(_ds_cap[_index], _index * V_BLOCK_SIZE, P_BLOCK_SIZE, 0);
@ -81,11 +81,11 @@ class Lx_kit::Slab_backend_alloc : public Lx::Slab_backend_alloc,
public: public:
Slab_backend_alloc(Genode::Env &env, Genode::Allocator &md_alloc, Slab_backend_alloc(Genode::Env &env, Genode::Allocator &md_alloc,
Genode::Cache_attribute cached) Genode::Cache cache)
: :
Rm_connection(env), Rm_connection(env),
Region_map_client(Rm_connection::create(VM_SIZE)), Region_map_client(Rm_connection::create(VM_SIZE)),
_cached(cached), _index(0), _range(&md_alloc) _cache(cache), _index(0), _range(&md_alloc)
{ {
/* reserver attach us, anywere */ /* reserver attach us, anywere */
_base = env.rm().attach(dataspace()); _base = env.rm().attach(dataspace());
@ -170,7 +170,7 @@ class Lx_kit::Malloc : public Lx::Malloc
Slab_backend_alloc &_back_allocator; Slab_backend_alloc &_back_allocator;
Genode::Constructible<Slab_alloc> _allocator[NUM_SLABS]; Genode::Constructible<Slab_alloc> _allocator[NUM_SLABS];
Genode::Cache_attribute _cached; /* cached or un-cached memory */ Genode::Cache _cache; /* cached or un-cached memory */
addr_t _start; /* VM region of this allocator */ addr_t _start; /* VM region of this allocator */
addr_t _end; addr_t _end;
@ -217,9 +217,9 @@ class Lx_kit::Malloc : public Lx::Malloc
public: public:
Malloc(Slab_backend_alloc &alloc, Genode::Cache_attribute cached) Malloc(Slab_backend_alloc &alloc, Genode::Cache cache)
: :
_back_allocator(alloc), _cached(cached), _start(alloc.start()), _back_allocator(alloc), _cache(cache), _start(alloc.start()),
_end(alloc.end()) _end(alloc.end())
{ {
/* init slab allocators */ /* init slab allocators */
@ -253,7 +253,7 @@ class Lx_kit::Malloc : public Lx::Malloc
if (msb > SLAB_STOP_LOG2) { if (msb > SLAB_STOP_LOG2) {
Genode::error("slab too large ", Genode::error("slab too large ",
1UL << msb, " requested ", size, " cached ", (int)_cached); 1UL << msb, " requested ", size, " cached ", (int)_cache);
return 0; return 0;
} }

View File

@ -94,8 +94,7 @@ static Lx_kit::List<Lx_kit::Mapped_io_mem_range> ranges;
static Genode::Constructible<Genode::Rm_connection> _global_rm; static Genode::Constructible<Genode::Rm_connection> _global_rm;
void *Lx::ioremap(addr_t phys_addr, unsigned long size, void *Lx::ioremap(addr_t phys_addr, unsigned long size, Genode::Cache cache)
Genode::Cache_attribute cache_attribute)
{ {
using namespace Genode; using namespace Genode;
@ -112,8 +111,7 @@ void *Lx::ioremap(addr_t phys_addr, unsigned long size,
addr_t offset = 0; addr_t offset = 0;
Io_mem_dataspace_capability ds_cap = Io_mem_dataspace_capability ds_cap =
Lx::pci_dev_registry()->io_mem(phys_addr, cache_attribute, Lx::pci_dev_registry()->io_mem(phys_addr, cache, size, offset);
size, offset);
if (!ds_cap.valid()) { if (!ds_cap.valid()) {
error("failed to request I/O memory: ", error("failed to request I/O memory: ",

View File

@ -113,14 +113,14 @@ Lx::Pci_dev_registry *Lx::pci_dev_registry(Genode::Env *env)
*********************************/ *********************************/
Genode::Ram_dataspace_capability Genode::Ram_dataspace_capability
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache)
{ {
using namespace Genode; using namespace Genode;
using namespace Lx_kit; using namespace Lx_kit;
Memory_object_base *obj; Memory_object_base *obj;
Genode::Ram_dataspace_capability cap; Genode::Ram_dataspace_capability cap;
if (cached == CACHED) { if (cache == CACHED) {
cap = _global_ram->alloc(size); cap = _global_ram->alloc(size);
obj = new (_global_md_alloc) Ram_object(*_global_ram, cap); obj = new (_global_md_alloc) Ram_object(*_global_ram, cap);
} else { } else {

View File

@ -65,7 +65,7 @@ namespace Allocator {
typedef Genode::Allocator_avl Allocator_avl; typedef Genode::Allocator_avl Allocator_avl;
addr_t _base; /* virt. base address */ addr_t _base; /* virt. base address */
Cache_attribute _cached; /* non-/cached RAM */ Cache _cache; /* non-/cached RAM */
Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */ Ram_dataspace_capability _ds_cap[ELEMENTS]; /* dataspaces to put in VM */
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */ addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
int _index = 0; /* current index in ds_cap */ int _index = 0; /* current index in ds_cap */
@ -85,7 +85,7 @@ namespace Allocator {
Policy_guard<POLICY> guard; Policy_guard<POLICY> guard;
try { try {
_ds_cap[_index] = Rump::env().env().ram().alloc(BLOCK_SIZE, _cached); _ds_cap[_index] = Rump::env().env().ram().alloc(BLOCK_SIZE, _cache);
/* attach at index * BLOCK_SIZE */ /* attach at index * BLOCK_SIZE */
Region_map_client::attach_at(_ds_cap[_index], _index * BLOCK_SIZE, BLOCK_SIZE, 0); Region_map_client::attach_at(_ds_cap[_index], _index * BLOCK_SIZE, BLOCK_SIZE, 0);
/* lookup phys. address */ /* lookup phys. address */
@ -114,11 +114,11 @@ namespace Allocator {
public: public:
Backend_alloc(Cache_attribute cached) Backend_alloc(Cache cache)
: :
Rm_connection(Rump::env().env()), Rm_connection(Rump::env().env()),
Region_map_client(Rm_connection::create(VM_SIZE)), Region_map_client(Rm_connection::create(VM_SIZE)),
_cached(cached), _cache(cache),
_range(&Rump::env().heap()) _range(&Rump::env().heap())
{ {
/* reserver attach us, anywere */ /* reserver attach us, anywere */
@ -204,8 +204,7 @@ namespace Allocator {
public: public:
Fap(bool cached) Fap(bool cache) : _back_allocator(cache ? CACHED : UNCACHED) { }
: _back_allocator(cached ? CACHED : UNCACHED) { }
void *alloc(size_t size, unsigned align = 0) void *alloc(size_t size, unsigned align = 0)
{ {

View File

@ -53,9 +53,9 @@ struct Libc::Malloc_ram_allocator : Ram_allocator
_release(ds); }); _release(ds); });
} }
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached) override Ram_dataspace_capability alloc(size_t size, Cache cache) override
{ {
Ram_dataspace_capability cap = _ram.alloc(size, cached); Ram_dataspace_capability cap = _ram.alloc(size, cache);
new (_md_alloc) Registered<Dataspace>(_dataspaces, cap); new (_md_alloc) Registered<Dataspace>(_dataspaces, cap);
return cap; return cap;
} }

View File

@ -34,12 +34,12 @@ class Nic::Communication_buffers
Nic::Packet_allocator _rx_packet_alloc; Nic::Packet_allocator _rx_packet_alloc;
Genode::Attached_ram_dataspace _tx_ds, _rx_ds; Genode::Attached_ram_dataspace _tx_ds, _rx_ds;
Communication_buffers(Genode::Allocator &rx_block_md_alloc, Communication_buffers(Genode::Allocator &rx_block_md_alloc,
Genode::Ram_allocator &ram, Genode::Ram_allocator &ram,
Genode::Region_map &region_map, Genode::Region_map &region_map,
Genode::size_t tx_size, Genode::size_t tx_size,
Genode::size_t rx_size, Genode::size_t rx_size,
Genode::Cache_attribute cache_policy) Genode::Cache cache_policy)
: :
_rx_packet_alloc(&rx_block_md_alloc), _rx_packet_alloc(&rx_block_md_alloc),
_tx_ds(ram, region_map, tx_size, cache_policy), _tx_ds(ram, region_map, tx_size, cache_policy),
@ -92,11 +92,11 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
* resources and open connections from * resources and open connections from
* within the Session_component * within the Session_component
*/ */
Session_component(Genode::size_t const tx_buf_size, Session_component(Genode::size_t const tx_buf_size,
Genode::size_t const rx_buf_size, Genode::size_t const rx_buf_size,
Genode::Cache_attribute cache_policy, Genode::Cache cache_policy,
Genode::Allocator &rx_block_md_alloc, Genode::Allocator &rx_block_md_alloc,
Genode::Env &env) Genode::Env &env)
: :
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(), Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
tx_buf_size, rx_buf_size, cache_policy), tx_buf_size, rx_buf_size, cache_policy),
@ -125,12 +125,12 @@ class Nic::Session_component : Communication_buffers, public Session_rpc_object
* within the Session_component * within the Session_component
* \param ep entrypoint for RPC * \param ep entrypoint for RPC
*/ */
Session_component(Genode::size_t const tx_buf_size, Session_component(Genode::size_t const tx_buf_size,
Genode::size_t const rx_buf_size, Genode::size_t const rx_buf_size,
Genode::Cache_attribute cache_policy, Genode::Cache cache_policy,
Genode::Allocator &rx_block_md_alloc, Genode::Allocator &rx_block_md_alloc,
Genode::Env &env, Genode::Env &env,
Genode::Entrypoint &ep) Genode::Entrypoint &ep)
: :
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(), Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
tx_buf_size, rx_buf_size, cache_policy), tx_buf_size, rx_buf_size, cache_policy),

View File

@ -31,8 +31,7 @@ struct Platform::Abstract_device : Genode::Interface
/** /**
* Get IO mem session capability of specified resource id * Get IO mem session capability of specified resource id
*/ */
virtual Genode::Io_mem_session_capability io_mem(Genode::uint8_t, virtual Genode::Io_mem_session_capability io_mem(Genode::uint8_t, Genode::Cache,
Genode::Cache_attribute,
Genode::addr_t, Genode::size_t) = 0; Genode::addr_t, Genode::size_t) = 0;
}; };

View File

@ -33,9 +33,7 @@ struct Platform::Device_client : Genode::Rpc_client<Device>
} }
Genode::Io_mem_session_capability Genode::Io_mem_session_capability
io_mem(unsigned id = 0, io_mem(unsigned id = 0, Genode::Cache caching = Genode::Cache::UNCACHED) override
Genode::Cache_attribute caching =
Genode::Cache_attribute::UNCACHED) override
{ {
return call<Rpc_io_mem>(id, caching); return call<Rpc_io_mem>(id, caching);
} }
@ -46,11 +44,9 @@ struct Platform::Device_client : Genode::Rpc_client<Device>
***************************/ ***************************/
Genode::Io_mem_dataspace_capability Genode::Io_mem_dataspace_capability
io_mem_dataspace(unsigned id = 0, io_mem_dataspace(unsigned id = 0, Genode::Cache cache = Genode::Cache::UNCACHED)
Genode::Cache_attribute caching =
Genode::Cache_attribute::UNCACHED)
{ {
Genode::Io_mem_session_client session(io_mem(id, caching)); Genode::Io_mem_session_client session(io_mem(id, cache));
return session.dataspace(); return session.dataspace();
} }
}; };

View File

@ -38,8 +38,7 @@ struct Platform::Device : Genode::Session
/** /**
* Get IO mem session capability of specified resource id * Get IO mem session capability of specified resource id
*/ */
virtual Genode::Io_mem_session_capability virtual Genode::Io_mem_session_capability io_mem(unsigned id, Genode::Cache) = 0;
io_mem(unsigned id, Genode::Cache_attribute attr) = 0;
/********************* /*********************
@ -48,7 +47,7 @@ struct Platform::Device : Genode::Session
GENODE_RPC(Rpc_irq, Genode::Irq_session_capability, irq, unsigned); GENODE_RPC(Rpc_irq, Genode::Irq_session_capability, irq, unsigned);
GENODE_RPC(Rpc_io_mem, Genode::Io_mem_session_capability, io_mem, GENODE_RPC(Rpc_io_mem, Genode::Io_mem_session_capability, io_mem,
unsigned, Genode::Cache_attribute); unsigned, Genode::Cache);
GENODE_RPC_INTERFACE(Rpc_irq, Rpc_io_mem); GENODE_RPC_INTERFACE(Rpc_irq, Rpc_io_mem);
}; };

View File

@ -55,10 +55,10 @@ struct Platform::Device_client : public Genode::Rpc_client<Device>
return call<Rpc_io_port>(id); } return call<Rpc_io_port>(id); }
Genode::Io_mem_session_capability io_mem(Genode::uint8_t id, Genode::Io_mem_session_capability io_mem(Genode::uint8_t id,
Genode::Cache_attribute caching = Genode::Cache_attribute::UNCACHED, Genode::Cache cache = Genode::Cache::UNCACHED,
Genode::addr_t offset = 0, Genode::addr_t offset = 0,
Genode::size_t size = ~0UL) override { Genode::size_t size = ~0UL) override {
return call<Rpc_io_mem>(id, caching, offset, size); } return call<Rpc_io_mem>(id, cache, offset, size); }
}; };
#endif /* _INCLUDE__SPEC__X86__PLATFORM_DEVICE__CLIENT_H_ */ #endif /* _INCLUDE__SPEC__X86__PLATFORM_DEVICE__CLIENT_H_ */

View File

@ -251,7 +251,7 @@ struct Platform::Device : Platform::Abstract_device
Genode::uint8_t); Genode::uint8_t);
GENODE_RPC_THROW(Rpc_io_mem, Genode::Io_mem_session_capability, io_mem, GENODE_RPC_THROW(Rpc_io_mem, Genode::Io_mem_session_capability, io_mem,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps), GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
Genode::uint8_t, Genode::Cache_attribute, Genode::uint8_t, Genode::Cache,
Genode::addr_t, Genode::size_t); Genode::addr_t, Genode::size_t);
GENODE_RPC_INTERFACE(Rpc_bus_address, Rpc_vendor_id, Rpc_device_id, GENODE_RPC_INTERFACE(Rpc_bus_address, Rpc_vendor_id, Rpc_device_id,

View File

@ -93,8 +93,7 @@ Genode::Irq_session_capability Driver::Device::irq(unsigned idx,
Genode::Io_mem_session_capability Genode::Io_mem_session_capability
Driver::Device::io_mem(unsigned idx, Cache_attribute attr, Driver::Device::io_mem(unsigned idx, Cache cache, Session_component & sc)
Session_component & sc)
{ {
Io_mem_session_capability cap; Io_mem_session_capability cap;
@ -108,7 +107,7 @@ Driver::Device::io_mem(unsigned idx, Cache_attribute attr,
if (!io_mem.io_mem) { if (!io_mem.io_mem) {
io_mem.io_mem = new (sc.heap()) io_mem.io_mem = new (sc.heap())
Io_mem_connection(sc.env().env, io_mem.base, io_mem.size, Io_mem_connection(sc.env().env, io_mem.base, io_mem.size,
(attr == WRITE_COMBINED)); (cache == WRITE_COMBINED));
} }
cap = io_mem.io_mem->cap(); cap = io_mem.io_mem->cap();
}); });

View File

@ -82,7 +82,7 @@ class Driver::Device : private List_model<Device>::Element
Irq_session_capability irq(unsigned idx, Irq_session_capability irq(unsigned idx,
Session_component & session); Session_component & session);
Io_mem_session_capability io_mem(unsigned idx, Cache_attribute, Io_mem_session_capability io_mem(unsigned idx, Cache,
Session_component & session); Session_component & session);
void report(Xml_generator &, Session_component &); void report(Xml_generator &, Session_component &);

View File

@ -41,12 +41,12 @@ void Driver::Device_component::release()
Genode::Io_mem_session_capability Genode::Io_mem_session_capability
Device_component::io_mem(unsigned idx, Cache_attribute attr) Device_component::io_mem(unsigned idx, Cache cache)
{ {
Io_mem_session_capability cap; Io_mem_session_capability cap;
_session.env().devices.for_each([&] (Driver::Device & device) { _session.env().devices.for_each([&] (Driver::Device & device) {
if (device.name() == _device) { if (device.name() == _device) {
cap = device.io_mem(idx, attr, _session); }}); cap = device.io_mem(idx, cache, _session); }});
return cap; return cap;
} }

View File

@ -49,7 +49,7 @@ class Driver::Device_component : public Rpc_object<Platform::Device>
**************************/ **************************/
Irq_session_capability irq(unsigned) override; Irq_session_capability irq(unsigned) override;
Io_mem_session_capability io_mem(unsigned, Cache_attribute) override; Io_mem_session_capability io_mem(unsigned, Cache) override;
private: private:

View File

@ -80,7 +80,7 @@ class Nonpci::Ps2 : public Platform::Device_component
} }
Genode::Io_mem_session_capability io_mem(Genode::uint8_t, Genode::Io_mem_session_capability io_mem(Genode::uint8_t,
Genode::Cache_attribute, Genode::Cache,
Genode::addr_t, Genode::addr_t,
Genode::size_t) override Genode::size_t) override
{ {

View File

@ -44,9 +44,9 @@ Genode::Io_port_session_capability Platform::Device_component::io_port(Genode::u
} }
Genode::Io_mem_session_capability Platform::Device_component::io_mem(Genode::uint8_t const v_id, Genode::Io_mem_session_capability Platform::Device_component::io_mem(Genode::uint8_t const v_id,
Genode::Cache_attribute const caching, Genode::Cache const caching,
Genode::addr_t const offset, Genode::addr_t const offset,
Genode::size_t const size) Genode::size_t const size)
{ {
Genode::uint8_t max = sizeof(_io_mem) / sizeof(_io_mem[0]); Genode::uint8_t max = sizeof(_io_mem) / sizeof(_io_mem[0]);
Genode::uint8_t r_id = 0; Genode::uint8_t r_id = 0;
@ -77,7 +77,7 @@ Genode::Io_mem_session_capability Platform::Device_component::io_mem(Genode::uin
} }
try { try {
bool const wc = caching == Genode::Cache_attribute::WRITE_COMBINED; bool const wc = caching == Genode::Cache::WRITE_COMBINED;
Io_mem * io_mem = new (_slab_iomem) Io_mem(_env, Io_mem * io_mem = new (_slab_iomem) Io_mem(_env,
res.base() + offset, res.base() + offset,
res_size, wc); res_size, wc);

View File

@ -603,7 +603,7 @@ class Platform::Device_component : public Genode::Rpc_object<Platform::Device>,
Genode::Io_port_session_capability io_port(Genode::uint8_t) override; Genode::Io_port_session_capability io_port(Genode::uint8_t) override;
Genode::Io_mem_session_capability io_mem(Genode::uint8_t, Genode::Io_mem_session_capability io_mem(Genode::uint8_t,
Genode::Cache_attribute, Genode::Cache,
Genode::addr_t, Genode::addr_t,
Genode::size_t) override; Genode::size_t) override;
}; };

View File

@ -113,7 +113,7 @@ class Genode::Session_env : public Ram_allocator,
** Ram_allocator ** ** Ram_allocator **
*******************/ *******************/
Ram_dataspace_capability alloc(size_t size, Cache_attribute cached) override Ram_dataspace_capability alloc(size_t size, Cache cache) override
{ {
enum { MAX_SHARED_CAP = 1 }; enum { MAX_SHARED_CAP = 1 };
enum { MAX_SHARED_RAM = 4096 }; enum { MAX_SHARED_RAM = 4096 };
@ -122,7 +122,7 @@ class Genode::Session_env : public Ram_allocator,
size_t const ds_size = align_addr(size, DS_SIZE_GRANULARITY_LOG2); size_t const ds_size = align_addr(size, DS_SIZE_GRANULARITY_LOG2);
Ram_dataspace_capability ds; Ram_dataspace_capability ds;
_consume(ds_size, MAX_SHARED_RAM, 1, MAX_SHARED_CAP, [&] () { _consume(ds_size, MAX_SHARED_RAM, 1, MAX_SHARED_CAP, [&] () {
ds = _env.pd().alloc(ds_size, cached); ds = _env.pd().alloc(ds_size, cache);
}); });
return ds; return ds;
} }

View File

@ -128,8 +128,8 @@ class Gdb_monitor::Pd_session_component : public Rpc_object<Pd_session>
Cap_quota cap_quota() const override { return _pd.cap_quota(); } Cap_quota cap_quota() const override { return _pd.cap_quota(); }
Cap_quota used_caps() const override { return _pd.used_caps(); } Cap_quota used_caps() const override { return _pd.used_caps(); }
Ram_dataspace_capability alloc(size_t amount, Cache_attribute cached) override { Ram_dataspace_capability alloc(size_t amount, Cache cache) override {
return _pd.alloc(amount, cached); } return _pd.alloc(amount, cache); }
void free(Ram_dataspace_capability ds) override { _pd.free(ds); } void free(Ram_dataspace_capability ds) override { _pd.free(ds); }