mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-01 08:48:20 +00:00
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:
parent
3ed8df9089
commit
468e7a825c
@ -49,8 +49,7 @@ class Genode::Mapping
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute cacheability, bool,
|
||||
Mapping(addr_t dst_addr, addr_t src_addr, Cache cacheability, bool,
|
||||
unsigned l2size, bool rw, bool)
|
||||
:
|
||||
_dst_addr(dst_addr),
|
||||
|
@ -42,21 +42,20 @@ class Genode::Mapping
|
||||
{
|
||||
private:
|
||||
|
||||
addr_t _dst_addr;
|
||||
addr_t _dst_addr;
|
||||
Foc::l4_fpage_t _fpage { };
|
||||
Cache_attribute _cacheability;
|
||||
bool _iomem;
|
||||
Cache _cacheability;
|
||||
bool _iomem;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute c, bool io_mem,
|
||||
Mapping(addr_t dst_addr, addr_t src_addr, Cache cache, bool io_mem,
|
||||
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;
|
||||
Rights rights = ( write && executable) ? Foc::L4_FPAGE_RWX :
|
||||
@ -73,11 +72,12 @@ class Genode::Mapping
|
||||
Mapping() : _dst_addr(0), _fpage(Foc::l4_fpage_invalid()),
|
||||
_cacheability(UNCACHED), _iomem(false) { }
|
||||
|
||||
Foc::l4_umword_t dst_addr() const { return _dst_addr; }
|
||||
bool grant() const { return false; }
|
||||
Foc::l4_fpage_t fpage() const { return _fpage; }
|
||||
Cache_attribute cacheability() const { return _cacheability; }
|
||||
bool iomem() const { return _iomem; }
|
||||
Foc::l4_umword_t dst_addr() const { return _dst_addr; }
|
||||
bool grant() const { return false; }
|
||||
Foc::l4_fpage_t fpage() const { return _fpage; }
|
||||
Cache cacheability() const { return _cacheability; }
|
||||
bool iomem() const { return _iomem; }
|
||||
|
||||
/**
|
||||
* Prepare map operation is not needed on Fiasco.OC, since we clear the
|
||||
* dataspace before this function is called.
|
||||
|
@ -60,13 +60,13 @@ struct Genode::Mapping : Hw::Mapping
|
||||
{
|
||||
Mapping() {}
|
||||
|
||||
Mapping(addr_t virt,
|
||||
addr_t phys,
|
||||
Cache_attribute cacheable,
|
||||
bool io,
|
||||
Mapping(addr_t virt,
|
||||
addr_t phys,
|
||||
Cache cacheable,
|
||||
bool io,
|
||||
unsigned size_log2,
|
||||
bool writeable,
|
||||
bool executable)
|
||||
bool writeable,
|
||||
bool executable)
|
||||
:
|
||||
Hw::Mapping(phys, virt, 1 << size_log2,
|
||||
{ writeable ? Hw::RW : Hw::RO,
|
||||
|
@ -65,8 +65,7 @@ Capability<Vm_session::Native_vcpu> Vm_session_component::create_vcpu(Thread_cap
|
||||
Vcpu & vcpu = *_vcpus[_vcpu_id_alloc];
|
||||
|
||||
try {
|
||||
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(),
|
||||
Cache_attribute::UNCACHED);
|
||||
vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED);
|
||||
vcpu.ds_addr = _region_map.attach(vcpu.ds_cap);
|
||||
} catch (...) {
|
||||
if (vcpu.ds_cap.valid())
|
||||
|
@ -31,12 +31,12 @@ namespace Hw {
|
||||
|
||||
struct Hw::Page_flags
|
||||
{
|
||||
Writeable writeable;
|
||||
Executeable executable;
|
||||
Privileged privileged;
|
||||
Global global;
|
||||
Type type;
|
||||
Genode::Cache_attribute cacheable;
|
||||
Writeable writeable;
|
||||
Executeable executable;
|
||||
Privileged privileged;
|
||||
Global global;
|
||||
Type type;
|
||||
Genode::Cache cacheable;
|
||||
|
||||
void print(Genode::Output & out) const
|
||||
{
|
||||
|
@ -199,8 +199,8 @@ class Hw::Long_translation_table
|
||||
struct Attribute_index : Base::template Bitfield<2, 3>
|
||||
{
|
||||
enum {
|
||||
UNCACHED = Genode::Cache_attribute::UNCACHED,
|
||||
CACHED = Genode::Cache_attribute::CACHED,
|
||||
UNCACHED = Genode::Cache::UNCACHED,
|
||||
CACHED = Genode::Cache::CACHED,
|
||||
DEVICE
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ class Hw::Level_4_translation_table
|
||||
|
||||
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)
|
||||
| G::bits(flags.global)
|
||||
@ -303,7 +303,7 @@ class Hw::Page_directory
|
||||
static typename Base::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 Base::create(flags)
|
||||
| Base::Ps::bits(1)
|
||||
|
@ -74,8 +74,7 @@ class Genode::Dataspace_component : public Rpc_object<Linux_dataspace>
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Dataspace_component(size_t size, addr_t addr,
|
||||
Cache_attribute, bool writable,
|
||||
Dataspace_component(size_t size, addr_t addr, Cache, bool writable,
|
||||
Dataspace_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.
|
||||
*/
|
||||
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
|
||||
|
@ -34,9 +34,9 @@ class Genode::Io_mem_session_component : public Rpc_object<Io_mem_session>
|
||||
Rpc_entrypoint &_ds_ep;
|
||||
Io_mem_dataspace_capability _ds_cap;
|
||||
|
||||
size_t get_arg_size(const char *);
|
||||
addr_t get_arg_phys(const char *);
|
||||
Cache_attribute get_arg_wc(const char *);
|
||||
size_t get_arg_size(char const *);
|
||||
addr_t get_arg_phys(char const *);
|
||||
Cache get_arg_wc (char const *);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -73,7 +73,7 @@ Dataspace_component::Dataspace_component(const char *args)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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");
|
||||
return UNCACHED;
|
||||
|
@ -72,7 +72,7 @@ Dataspace_component::Dataspace_component(const char *args)
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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);
|
||||
if (a.valid() && a.bool_value(0)) {
|
||||
|
@ -79,8 +79,7 @@ class Stack_area_region_map : public Genode::Region_map
|
||||
|
||||
struct Stack_area_ram_allocator : Genode::Ram_allocator
|
||||
{
|
||||
Genode::Ram_dataspace_capability alloc(Genode::size_t,
|
||||
Genode::Cache_attribute) override {
|
||||
Genode::Ram_dataspace_capability alloc(Genode::size_t, Genode::Cache) override {
|
||||
return Genode::Ram_dataspace_capability(); }
|
||||
|
||||
void free(Genode::Ram_dataspace_capability) override { }
|
||||
|
@ -31,9 +31,9 @@ class Genode::Mapping
|
||||
{
|
||||
private:
|
||||
|
||||
addr_t const _dst_addr;
|
||||
Cache_attribute const _attr;
|
||||
Nova::Mem_crd const _mem_crd;
|
||||
addr_t const _dst_addr;
|
||||
Cache const _cache;
|
||||
Nova::Mem_crd const _mem_crd;
|
||||
|
||||
enum { PAGE_SIZE_LOG2 = 12 };
|
||||
|
||||
@ -43,12 +43,12 @@ class Genode::Mapping
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t source_addr,
|
||||
Cache_attribute c, bool /* io_mem */,
|
||||
Cache cache, bool /* io_mem */,
|
||||
unsigned size_log2,
|
||||
bool writeable, bool executable)
|
||||
:
|
||||
_dst_addr(dst_addr),
|
||||
_attr(c),
|
||||
_cache(cache),
|
||||
_mem_crd(source_addr >> PAGE_SIZE_LOG2,
|
||||
size_log2 - PAGE_SIZE_LOG2,
|
||||
Nova::Rights(true, writeable, executable))
|
||||
@ -56,12 +56,10 @@ class Genode::Mapping
|
||||
|
||||
void prepare_map_operation() { }
|
||||
|
||||
Nova::Mem_crd mem_crd() const { return _mem_crd; }
|
||||
|
||||
bool dma() { return _attr != CACHED; };
|
||||
bool write_combined() { return _attr == WRITE_COMBINED; };
|
||||
|
||||
addr_t dst_addr() { return _dst_addr; }
|
||||
Nova::Mem_crd mem_crd() const { return _mem_crd; }
|
||||
bool dma() const { return _cache != CACHED; };
|
||||
bool write_combined() const { return _cache == WRITE_COMBINED; };
|
||||
addr_t dst_addr() const { return _dst_addr; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,8 +41,7 @@ class Genode::Mapping
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute cacheability, bool io_mem,
|
||||
Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool io_mem,
|
||||
unsigned l2size, bool rw, bool executable);
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ static inline L4_ThreadId_t thread_get_my_global_id()
|
||||
** 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)
|
||||
:
|
||||
_fpage(L4_FpageLog2(dst_addr, l2size)),
|
||||
|
@ -47,10 +47,8 @@ class Genode::Mapping
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute, bool io_mem,
|
||||
unsigned l2size,
|
||||
bool rw, bool executable);
|
||||
Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool io_mem,
|
||||
unsigned l2size, bool rw, bool executable);
|
||||
|
||||
/**
|
||||
* Construct invalid mapping
|
||||
|
@ -32,9 +32,8 @@ using namespace Pistachio;
|
||||
** Mapping **
|
||||
*************/
|
||||
|
||||
Mapping::Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute, bool, unsigned l2size,
|
||||
bool rw, bool)
|
||||
Mapping::Mapping(addr_t dst_addr, addr_t src_addr, Cache, bool,
|
||||
unsigned l2size, bool rw, bool)
|
||||
{
|
||||
bool const grant = false;
|
||||
|
||||
|
@ -30,13 +30,13 @@ class Genode::Mapping
|
||||
|
||||
private:
|
||||
|
||||
addr_t _from_phys_addr { 0 };
|
||||
addr_t _to_virt_addr { 0 };
|
||||
Cache_attribute _attr { CACHED };
|
||||
size_t _num_pages { 0 };
|
||||
addr_t _fault_type { 0 };
|
||||
bool _writeable { false };
|
||||
bool _executable { false };
|
||||
addr_t _from_phys_addr { 0 };
|
||||
addr_t _to_virt_addr { 0 };
|
||||
Cache _cache { CACHED };
|
||||
size_t _num_pages { 0 };
|
||||
addr_t _fault_type { 0 };
|
||||
bool _writeable { false };
|
||||
bool _executable { false };
|
||||
|
||||
enum { PAGE_SIZE_LOG2 = 12 };
|
||||
|
||||
@ -45,13 +45,12 @@ class Genode::Mapping
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Mapping(addr_t dst_addr, addr_t src_addr,
|
||||
Cache_attribute const cacheability, bool,
|
||||
Mapping(addr_t dst_addr, addr_t src_addr, Cache const cache, bool,
|
||||
unsigned l2size, bool rw, bool executable)
|
||||
:
|
||||
_from_phys_addr(src_addr),
|
||||
_to_virt_addr(dst_addr),
|
||||
_attr(cacheability),
|
||||
_cache(cache),
|
||||
_num_pages(1 << (l2size - PAGE_SIZE_LOG2)),
|
||||
_writeable(rw), _executable(executable)
|
||||
{ }
|
||||
@ -69,13 +68,13 @@ class Genode::Mapping
|
||||
*/
|
||||
void prepare_map_operation() { }
|
||||
|
||||
addr_t from_phys() const { return _from_phys_addr; }
|
||||
addr_t to_virt() const { return _to_virt_addr; }
|
||||
size_t num_pages() const { return _num_pages; }
|
||||
bool writeable() const { return _writeable; }
|
||||
bool executable() const { return _executable; }
|
||||
Cache_attribute cacheability() const { return _attr; }
|
||||
addr_t fault_type() const { return _fault_type; }
|
||||
addr_t from_phys() const { return _from_phys_addr; }
|
||||
addr_t to_virt() const { return _to_virt_addr; }
|
||||
size_t num_pages() const { return _num_pages; }
|
||||
bool writeable() const { return _writeable; }
|
||||
bool executable() const { return _executable; }
|
||||
Cache cacheability() const { return _cache; }
|
||||
addr_t fault_type() const { return _fault_type; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Genode {
|
||||
try {
|
||||
platform = platform ? platform : &platform_specific();
|
||||
platform->core_vm_space().map(from_phys, to_virt, num_pages,
|
||||
Cache_attribute::CACHED,
|
||||
Cache::CACHED,
|
||||
WRITEABLE, NON_EXECUTABLE,
|
||||
DONT_FLUSH);
|
||||
} catch (Page_table_registry::Mapping_cache_full) {
|
||||
|
@ -182,7 +182,7 @@ class Genode::Vm_space
|
||||
|
||||
template <typename FN>
|
||||
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 flush_support, bool guest, FN const &fn)
|
||||
{
|
||||
@ -242,9 +242,9 @@ class Genode::Vm_space
|
||||
/**
|
||||
* Platform specific map/unmap of a page frame
|
||||
*/
|
||||
long _map_page(Genode::Cap_sel const &idx, Genode::addr_t const virt,
|
||||
Cache_attribute const cacheability, bool const write,
|
||||
bool const writable, bool guest);
|
||||
long _map_page(Genode::Cap_sel const &idx, addr_t virt,
|
||||
Cache cacheability, bool const write,
|
||||
bool writable, bool guest);
|
||||
long _unmap_page(Genode::Cap_sel const &idx);
|
||||
long _invalidate_page(Genode::Cap_sel 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,
|
||||
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)
|
||||
{
|
||||
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,
|
||||
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)
|
||||
{
|
||||
auto fn_unmap = [&] (Cap_sel const &idx, addr_t const) {
|
||||
|
@ -101,7 +101,7 @@ bool Platform_pd::bind_thread(Platform_thread &thread)
|
||||
enum { WRITABLE = true, ONE_PAGE = 1, FLUSHABLE = true, NON_EXECUTABLE = false };
|
||||
_vm_space.alloc_page_tables(utcb, get_page_size());
|
||||
_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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
Genode::addr_t const virt,
|
||||
Cache_attribute const cacheability,
|
||||
Cache const cacheability,
|
||||
bool const writable,
|
||||
bool const executable,
|
||||
bool)
|
||||
|
@ -54,7 +54,7 @@ Vm_session_component::Vcpu::Vcpu(Rpc_entrypoint &ep,
|
||||
_ep(ep),
|
||||
_ram_alloc(ram_alloc),
|
||||
_ds_cap (_ram_alloc.alloc(align_addr(sizeof(Genode::Vcpu_state), 12),
|
||||
Cache_attribute::CACHED))
|
||||
Cache::CACHED))
|
||||
{
|
||||
try {
|
||||
/* notification cap */
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include <vm_space.h>
|
||||
|
||||
long Genode::Vm_space::_map_page(Genode::Cap_sel const &idx,
|
||||
Genode::addr_t const virt,
|
||||
Cache_attribute const cacheability,
|
||||
Genode::addr_t const virt,
|
||||
Cache const cacheability,
|
||||
bool const writable,
|
||||
bool const, bool ept)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ class Stack_area_region_map : public Region_map
|
||||
|
||||
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()); }
|
||||
|
||||
void free(Ram_dataspace_capability) override {
|
||||
|
@ -39,7 +39,7 @@ class Genode::Attached_ram_dataspace
|
||||
Region_map *_rm = nullptr;
|
||||
Ram_dataspace_capability _ds { };
|
||||
void *_local_addr = nullptr;
|
||||
Cache_attribute const _cached = CACHED;
|
||||
Cache const _cache = CACHED;
|
||||
|
||||
template <typename T>
|
||||
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;
|
||||
|
||||
try {
|
||||
_ds = _ram->alloc(_size, _cached);
|
||||
_ds = _ram->alloc(_size, _cache);
|
||||
_local_addr = _rm->attach(_ds);
|
||||
}
|
||||
/* 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
|
||||
* dataspace before writing actual content to it.
|
||||
*/
|
||||
if (_cached != CACHED) {
|
||||
if (_cache != CACHED) {
|
||||
enum { PAGE_SIZE = 4096 };
|
||||
unsigned char volatile *base = (unsigned char volatile *)_local_addr;
|
||||
for (size_t i = 0; i < _size; i += PAGE_SIZE)
|
||||
@ -100,9 +100,9 @@ class Genode::Attached_ram_dataspace
|
||||
* \throw Region_map::Invalid_dataspace
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
enum Cache_attribute { UNCACHED, WRITE_COMBINED, CACHED };
|
||||
enum Cache { UNCACHED, WRITE_COMBINED, CACHED };
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__BASE__CACHE_H_ */
|
||||
|
@ -36,17 +36,16 @@ struct Genode::Ram_allocator : Interface
|
||||
/**
|
||||
* Allocate RAM dataspace
|
||||
*
|
||||
* \param size size of RAM dataspace
|
||||
* \param cached selects cacheability attributes of the memory,
|
||||
* uncached memory, i.e., for DMA buffers
|
||||
* \param size size of RAM dataspace
|
||||
* \param cache selects cacheability attributes of the memory,
|
||||
* uncached memory, i.e., for DMA buffers
|
||||
*
|
||||
* \throw Out_of_ram
|
||||
* \throw Out_of_caps
|
||||
*
|
||||
* \return capability to new RAM dataspace
|
||||
*/
|
||||
virtual Ram_dataspace_capability alloc(size_t size,
|
||||
Cache_attribute cached = CACHED) = 0;
|
||||
virtual Ram_dataspace_capability alloc(size_t size, Cache cache = CACHED) = 0;
|
||||
|
||||
/**
|
||||
* 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_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);
|
||||
|
||||
@ -92,7 +91,7 @@ class Genode::Constrained_ram_allocator : public Ram_allocator
|
||||
/*
|
||||
* \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();
|
||||
caps.acknowledge();
|
||||
|
@ -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 used_caps() const override { return call<Rpc_used_caps>(); }
|
||||
|
||||
Ram_dataspace_capability alloc(size_t size,
|
||||
Cache_attribute cached = CACHED) override
|
||||
Ram_dataspace_capability alloc(size_t size, Cache cache = 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); }
|
||||
|
@ -350,7 +350,7 @@ struct Genode::Pd_session : Session, Ram_allocator
|
||||
|
||||
GENODE_RPC_THROW(Rpc_alloc, Ram_dataspace_capability, alloc,
|
||||
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_THROW(Rpc_transfer_ram_quota, void, transfer_quota,
|
||||
GENODE_TYPE_LIST(Out_of_ram, Invalid_session, Undefined_ref_account),
|
||||
|
@ -45,7 +45,7 @@ namespace Genode {
|
||||
/*
|
||||
* 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 */
|
||||
Mutex _mutex { };
|
||||
@ -79,7 +79,7 @@ namespace Genode {
|
||||
* This constructor is used by RAM and ROM dataspaces.
|
||||
*/
|
||||
Dataspace_component(size_t size, addr_t core_local_addr,
|
||||
Cache_attribute cache, bool writable,
|
||||
Cache cache, bool writable,
|
||||
Dataspace_owner *owner)
|
||||
:
|
||||
_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.
|
||||
*/
|
||||
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)
|
||||
:
|
||||
_phys_addr(phys_addr), _core_local_addr(core_local_addr),
|
||||
@ -117,9 +117,9 @@ namespace Genode {
|
||||
*/
|
||||
virtual Native_capability sub_rm() { return Dataspace_capability(); }
|
||||
|
||||
addr_t core_local_addr() const { return _core_local_addr; }
|
||||
bool io_mem() const { return _io_mem; }
|
||||
Cache_attribute cacheability() const { return _cache; }
|
||||
addr_t core_local_addr() const { return _core_local_addr; }
|
||||
bool io_mem() const { return _io_mem; }
|
||||
Cache cacheability() const { return _cache; }
|
||||
|
||||
/**
|
||||
* Return dataspace base address to be used for map operations
|
||||
|
@ -35,10 +35,10 @@ namespace Genode {
|
||||
*/
|
||||
struct Dataspace_attr
|
||||
{
|
||||
size_t size { 0 };
|
||||
addr_t core_local_addr { 0 };
|
||||
addr_t phys_addr { 0 };
|
||||
Cache_attribute cacheable { UNCACHED };
|
||||
size_t size { 0 };
|
||||
addr_t core_local_addr { 0 };
|
||||
addr_t phys_addr { 0 };
|
||||
Cache cacheable { UNCACHED };
|
||||
|
||||
/**
|
||||
* Base address of request used for freeing mem-ranges
|
||||
@ -59,7 +59,7 @@ namespace Genode {
|
||||
* An invalid dataspace is represented by setting all
|
||||
* 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)
|
||||
:
|
||||
size(s), core_local_addr(cla), phys_addr(pa),
|
||||
@ -88,7 +88,7 @@ namespace Genode {
|
||||
Io_dataspace_component _ds;
|
||||
Rpc_entrypoint &_ds_ep;
|
||||
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);
|
||||
|
||||
|
@ -315,7 +315,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
|
||||
** 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;
|
||||
|
||||
|
@ -106,7 +106,7 @@ class Genode::Ram_dataspace_factory : public Ram_allocator,
|
||||
** 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;
|
||||
size_t dataspace_size(Ram_dataspace_capability ds) const override;
|
||||
};
|
||||
|
@ -33,10 +33,10 @@ class Genode::Synced_ram_allocator : public Ram_allocator
|
||||
|
||||
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);
|
||||
return _alloc.alloc(size, cached);
|
||||
return _alloc.alloc(size, cache);
|
||||
}
|
||||
|
||||
void free(Ram_dataspace_capability ds) override
|
||||
|
@ -21,7 +21,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
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 */
|
||||
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_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.
|
||||
|
@ -21,7 +21,7 @@ using namespace Genode;
|
||||
|
||||
|
||||
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 */
|
||||
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
|
||||
*/
|
||||
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 */
|
||||
try { _export_ram_ds(ds); }
|
||||
|
@ -121,7 +121,7 @@ class Stack_area_region_map : public Region_map
|
||||
|
||||
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()); }
|
||||
|
||||
void free(Ram_dataspace_capability) override { }
|
||||
|
@ -38,7 +38,7 @@ struct Genode::Expanding_pd_session_client : Pd_session_client
|
||||
Expanding_pd_session_client(Parent &parent, Pd_session_capability cap)
|
||||
: 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
|
||||
@ -49,7 +49,7 @@ struct Genode::Expanding_pd_session_client : Pd_session_client
|
||||
return retry<Out_of_ram>(
|
||||
[&] () {
|
||||
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); },
|
||||
NUM_ATTEMPTS);
|
||||
},
|
||||
|
@ -1198,7 +1198,7 @@ struct Dma_wc_dataspace : Genode::Attached_ram_dataspace,
|
||||
: Genode::Attached_ram_dataspace(Lx_kit::env().ram(),
|
||||
Lx_kit::env().rm(),
|
||||
size,
|
||||
Genode::Cache_attribute::WRITE_COMBINED) { }
|
||||
Genode::Cache::WRITE_COMBINED) { }
|
||||
};
|
||||
|
||||
static Genode::List<Dma_wc_dataspace> &_dma_wc_ds_list()
|
||||
|
@ -31,8 +31,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
|
||||
|
||||
Genode::Ram_dataspace_capability
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cached); }
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cache); }
|
||||
|
||||
|
||||
void Lx::backend_free(Genode::Ram_dataspace_capability cap) {
|
||||
|
@ -31,8 +31,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
|
||||
|
||||
Genode::Ram_dataspace_capability
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cached); }
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cache); }
|
||||
|
||||
|
||||
void Lx::backend_free(Genode::Ram_dataspace_capability cap) {
|
||||
|
@ -32,8 +32,8 @@ void backend_alloc_init(Genode::Env&, Genode::Ram_allocator&,
|
||||
|
||||
|
||||
Genode::Ram_dataspace_capability
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache_attribute cached) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cached); }
|
||||
Lx::backend_alloc(Genode::addr_t size, Genode::Cache cache) {
|
||||
return Lx_kit::env().env().ram().alloc(size, cache); }
|
||||
|
||||
|
||||
void Lx::backend_free(Genode::Ram_dataspace_capability cap) {
|
||||
|
@ -128,23 +128,32 @@ struct Lx_driver
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct task_struct *current;
|
||||
struct workqueue_struct *system_wq;
|
||||
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; }
|
||||
|
||||
|
||||
size_t strlen(const char *s) { return Genode::strlen(s); }
|
||||
|
||||
|
||||
int mutex_lock_interruptible(struct mutex *m)
|
||||
{
|
||||
mutex_lock(m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int driver_register(struct device_driver *drv)
|
||||
{
|
||||
if (!drv)
|
||||
|
@ -172,8 +172,7 @@ void backend_alloc_init(Env & env, Ram_allocator&, Allocator&)
|
||||
}
|
||||
|
||||
|
||||
Ram_dataspace_capability
|
||||
Lx::backend_alloc(addr_t size, Cache_attribute)
|
||||
Ram_dataspace_capability Lx::backend_alloc(addr_t size, Cache)
|
||||
{
|
||||
return resource_env().platform.alloc_dma_buffer(size);
|
||||
}
|
||||
|
@ -209,9 +209,12 @@ struct task_struct *current;
|
||||
struct workqueue_struct *system_wq;
|
||||
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 *)
|
||||
|
@ -195,9 +195,12 @@ struct task_struct *current;
|
||||
struct workqueue_struct *system_wq;
|
||||
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 *)
|
||||
|
@ -20,16 +20,16 @@
|
||||
|
||||
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);
|
||||
|
||||
size_t size = PAGE_SIZE << order;
|
||||
|
||||
gfp_t const dma_mask = (GFP_DMA | GFP_LX_DMA | GFP_DMA32);
|
||||
Cache_attribute const cached = (gfp_mask & dma_mask) ? Genode::UNCACHED
|
||||
: Genode::CACHED;
|
||||
Genode::Ram_dataspace_capability ds_cap = Lx::backend_alloc(size, cached);
|
||||
Cache const cache = (gfp_mask & dma_mask) ? Genode::UNCACHED
|
||||
: Genode::CACHED;
|
||||
Genode::Ram_dataspace_capability ds_cap = Lx::backend_alloc(size, cache);
|
||||
page->addr = Lx_kit::env().rm().attach(ds_cap);
|
||||
page->paddr = Genode::Dataspace_client(ds_cap).phys_addr();
|
||||
|
||||
|
@ -25,8 +25,7 @@ namespace Lx {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
Ram_dataspace_capability backend_alloc(addr_t size,
|
||||
Cache_attribute cached);
|
||||
Ram_dataspace_capability backend_alloc(addr_t size, Cache);
|
||||
void backend_free(Ram_dataspace_capability cap);
|
||||
}
|
||||
|
||||
|
@ -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; }
|
||||
|
||||
Genode::Io_mem_session_capability io_mem(unsigned bar,
|
||||
Genode::Cache_attribute cache_attribute)
|
||||
Genode::Io_mem_session_capability io_mem(unsigned bar, Genode::Cache cache)
|
||||
{
|
||||
if (bar >= DEVICE_COUNT_RESOURCE)
|
||||
return Genode::Io_mem_session_capability();
|
||||
|
||||
if (!_io_mem[bar].valid())
|
||||
_io_mem[bar] = _client.io_mem(_client.phys_bar_to_virt(bar),
|
||||
cache_attribute);
|
||||
cache);
|
||||
|
||||
return _io_mem[bar];
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace Lx {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
void *ioremap(addr_t, unsigned long, Cache_attribute);
|
||||
void *ioremap(addr_t, unsigned long, Cache);
|
||||
void iounmap(volatile void*);
|
||||
Dataspace_capability ioremap_lookup(addr_t, Genode::size_t);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ class Lx::Pci_dev_registry
|
||||
|
||||
Pci_dev* first() { return _devs.first(); }
|
||||
|
||||
Genode::Io_mem_dataspace_capability io_mem(Genode::addr_t phys,
|
||||
Genode::Cache_attribute cache_attribute,
|
||||
Genode::size_t size,
|
||||
Genode::addr_t &offset)
|
||||
Genode::Io_mem_dataspace_capability io_mem(Genode::addr_t phys,
|
||||
Genode::Cache cache,
|
||||
Genode::size_t size,
|
||||
Genode::addr_t &offset)
|
||||
{
|
||||
enum { PCI_ROM_RESOURCE = 6 };
|
||||
|
||||
@ -85,7 +85,7 @@ class Lx::Pci_dev_registry
|
||||
offset = phys - pci_resource_start(d, bar);
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ struct Memory_object_base : Genode::Object_pool<Memory_object_base>::Entry
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Lx
|
||||
Genode::Allocator&,
|
||||
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 get_mac_address(unsigned char *);
|
||||
|
@ -48,7 +48,7 @@ class Lx_kit::Slab_backend_alloc : public Lx::Slab_backend_alloc,
|
||||
};
|
||||
|
||||
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 */
|
||||
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
|
||||
int _index; /* current index in ds_cap */
|
||||
@ -62,7 +62,7 @@ class Lx_kit::Slab_backend_alloc : public Lx::Slab_backend_alloc,
|
||||
}
|
||||
|
||||
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 */
|
||||
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:
|
||||
|
||||
Slab_backend_alloc(Genode::Env &env, Genode::Allocator &md_alloc,
|
||||
Genode::Cache_attribute cached)
|
||||
Genode::Cache cache)
|
||||
:
|
||||
Rm_connection(env),
|
||||
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 */
|
||||
_base = env.rm().attach(dataspace());
|
||||
@ -170,7 +170,7 @@ class Lx_kit::Malloc : public Lx::Malloc
|
||||
|
||||
Slab_backend_alloc &_back_allocator;
|
||||
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 _end;
|
||||
|
||||
@ -217,9 +217,9 @@ class Lx_kit::Malloc : public Lx::Malloc
|
||||
|
||||
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())
|
||||
{
|
||||
/* init slab allocators */
|
||||
@ -253,7 +253,7 @@ class Lx_kit::Malloc : public Lx::Malloc
|
||||
|
||||
if (msb > SLAB_STOP_LOG2) {
|
||||
Genode::error("slab too large ",
|
||||
1UL << msb, " requested ", size, " cached ", (int)_cached);
|
||||
1UL << msb, " requested ", size, " cached ", (int)_cache);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,7 @@ static Lx_kit::List<Lx_kit::Mapped_io_mem_range> ranges;
|
||||
static Genode::Constructible<Genode::Rm_connection> _global_rm;
|
||||
|
||||
|
||||
void *Lx::ioremap(addr_t phys_addr, unsigned long size,
|
||||
Genode::Cache_attribute cache_attribute)
|
||||
void *Lx::ioremap(addr_t phys_addr, unsigned long size, Genode::Cache cache)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -112,8 +111,7 @@ void *Lx::ioremap(addr_t phys_addr, unsigned long size,
|
||||
|
||||
addr_t offset = 0;
|
||||
Io_mem_dataspace_capability ds_cap =
|
||||
Lx::pci_dev_registry()->io_mem(phys_addr, cache_attribute,
|
||||
size, offset);
|
||||
Lx::pci_dev_registry()->io_mem(phys_addr, cache, size, offset);
|
||||
|
||||
if (!ds_cap.valid()) {
|
||||
error("failed to request I/O memory: ",
|
||||
|
@ -113,14 +113,14 @@ Lx::Pci_dev_registry *Lx::pci_dev_registry(Genode::Env *env)
|
||||
*********************************/
|
||||
|
||||
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 Lx_kit;
|
||||
|
||||
Memory_object_base *obj;
|
||||
Genode::Ram_dataspace_capability cap;
|
||||
if (cached == CACHED) {
|
||||
if (cache == CACHED) {
|
||||
cap = _global_ram->alloc(size);
|
||||
obj = new (_global_md_alloc) Ram_object(*_global_ram, cap);
|
||||
} else {
|
||||
|
@ -65,7 +65,7 @@ namespace Allocator {
|
||||
typedef Genode::Allocator_avl Allocator_avl;
|
||||
|
||||
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 */
|
||||
addr_t _ds_phys[ELEMENTS]; /* physical bases of dataspaces */
|
||||
int _index = 0; /* current index in ds_cap */
|
||||
@ -85,7 +85,7 @@ namespace Allocator {
|
||||
Policy_guard<POLICY> guard;
|
||||
|
||||
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 */
|
||||
Region_map_client::attach_at(_ds_cap[_index], _index * BLOCK_SIZE, BLOCK_SIZE, 0);
|
||||
/* lookup phys. address */
|
||||
@ -114,11 +114,11 @@ namespace Allocator {
|
||||
|
||||
public:
|
||||
|
||||
Backend_alloc(Cache_attribute cached)
|
||||
Backend_alloc(Cache cache)
|
||||
:
|
||||
Rm_connection(Rump::env().env()),
|
||||
Region_map_client(Rm_connection::create(VM_SIZE)),
|
||||
_cached(cached),
|
||||
_cache(cache),
|
||||
_range(&Rump::env().heap())
|
||||
{
|
||||
/* reserver attach us, anywere */
|
||||
@ -204,8 +204,7 @@ namespace Allocator {
|
||||
|
||||
public:
|
||||
|
||||
Fap(bool cached)
|
||||
: _back_allocator(cached ? CACHED : UNCACHED) { }
|
||||
Fap(bool cache) : _back_allocator(cache ? CACHED : UNCACHED) { }
|
||||
|
||||
void *alloc(size_t size, unsigned align = 0)
|
||||
{
|
||||
|
@ -53,9 +53,9 @@ struct Libc::Malloc_ram_allocator : Ram_allocator
|
||||
_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);
|
||||
return cap;
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ class Nic::Communication_buffers
|
||||
Nic::Packet_allocator _rx_packet_alloc;
|
||||
Genode::Attached_ram_dataspace _tx_ds, _rx_ds;
|
||||
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::size_t tx_size,
|
||||
Genode::size_t rx_size,
|
||||
Genode::Cache_attribute cache_policy)
|
||||
Communication_buffers(Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Ram_allocator &ram,
|
||||
Genode::Region_map ®ion_map,
|
||||
Genode::size_t tx_size,
|
||||
Genode::size_t rx_size,
|
||||
Genode::Cache cache_policy)
|
||||
:
|
||||
_rx_packet_alloc(&rx_block_md_alloc),
|
||||
_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
|
||||
* within the Session_component
|
||||
*/
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache_attribute cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env)
|
||||
:
|
||||
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
|
||||
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
|
||||
* \param ep entrypoint for RPC
|
||||
*/
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache_attribute cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env,
|
||||
Genode::Entrypoint &ep)
|
||||
Session_component(Genode::size_t const tx_buf_size,
|
||||
Genode::size_t const rx_buf_size,
|
||||
Genode::Cache cache_policy,
|
||||
Genode::Allocator &rx_block_md_alloc,
|
||||
Genode::Env &env,
|
||||
Genode::Entrypoint &ep)
|
||||
:
|
||||
Communication_buffers(rx_block_md_alloc, env.ram(), env.rm(),
|
||||
tx_buf_size, rx_buf_size, cache_policy),
|
||||
|
@ -31,8 +31,7 @@ struct Platform::Abstract_device : Genode::Interface
|
||||
/**
|
||||
* Get IO mem session capability of specified resource id
|
||||
*/
|
||||
virtual Genode::Io_mem_session_capability io_mem(Genode::uint8_t,
|
||||
Genode::Cache_attribute,
|
||||
virtual Genode::Io_mem_session_capability io_mem(Genode::uint8_t, Genode::Cache,
|
||||
Genode::addr_t, Genode::size_t) = 0;
|
||||
};
|
||||
|
||||
|
@ -33,9 +33,7 @@ struct Platform::Device_client : Genode::Rpc_client<Device>
|
||||
}
|
||||
|
||||
Genode::Io_mem_session_capability
|
||||
io_mem(unsigned id = 0,
|
||||
Genode::Cache_attribute caching =
|
||||
Genode::Cache_attribute::UNCACHED) override
|
||||
io_mem(unsigned id = 0, Genode::Cache caching = Genode::Cache::UNCACHED) override
|
||||
{
|
||||
return call<Rpc_io_mem>(id, caching);
|
||||
}
|
||||
@ -46,11 +44,9 @@ struct Platform::Device_client : Genode::Rpc_client<Device>
|
||||
***************************/
|
||||
|
||||
Genode::Io_mem_dataspace_capability
|
||||
io_mem_dataspace(unsigned id = 0,
|
||||
Genode::Cache_attribute caching =
|
||||
Genode::Cache_attribute::UNCACHED)
|
||||
io_mem_dataspace(unsigned id = 0, Genode::Cache cache = Genode::Cache::UNCACHED)
|
||||
{
|
||||
Genode::Io_mem_session_client session(io_mem(id, caching));
|
||||
Genode::Io_mem_session_client session(io_mem(id, cache));
|
||||
return session.dataspace();
|
||||
}
|
||||
};
|
||||
|
@ -38,8 +38,7 @@ struct Platform::Device : Genode::Session
|
||||
/**
|
||||
* Get IO mem session capability of specified resource id
|
||||
*/
|
||||
virtual Genode::Io_mem_session_capability
|
||||
io_mem(unsigned id, Genode::Cache_attribute attr) = 0;
|
||||
virtual Genode::Io_mem_session_capability io_mem(unsigned id, Genode::Cache) = 0;
|
||||
|
||||
|
||||
/*********************
|
||||
@ -48,7 +47,7 @@ struct Platform::Device : Genode::Session
|
||||
|
||||
GENODE_RPC(Rpc_irq, Genode::Irq_session_capability, irq, unsigned);
|
||||
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);
|
||||
};
|
||||
|
@ -55,10 +55,10 @@ struct Platform::Device_client : public Genode::Rpc_client<Device>
|
||||
return call<Rpc_io_port>(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::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_ */
|
||||
|
@ -251,7 +251,7 @@ struct Platform::Device : Platform::Abstract_device
|
||||
Genode::uint8_t);
|
||||
GENODE_RPC_THROW(Rpc_io_mem, Genode::Io_mem_session_capability, io_mem,
|
||||
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_RPC_INTERFACE(Rpc_bus_address, Rpc_vendor_id, Rpc_device_id,
|
||||
|
@ -93,8 +93,7 @@ Genode::Irq_session_capability Driver::Device::irq(unsigned idx,
|
||||
|
||||
|
||||
Genode::Io_mem_session_capability
|
||||
Driver::Device::io_mem(unsigned idx, Cache_attribute attr,
|
||||
Session_component & sc)
|
||||
Driver::Device::io_mem(unsigned idx, Cache cache, Session_component & sc)
|
||||
{
|
||||
Io_mem_session_capability cap;
|
||||
|
||||
@ -108,7 +107,7 @@ Driver::Device::io_mem(unsigned idx, Cache_attribute attr,
|
||||
if (!io_mem.io_mem) {
|
||||
io_mem.io_mem = new (sc.heap())
|
||||
Io_mem_connection(sc.env().env, io_mem.base, io_mem.size,
|
||||
(attr == WRITE_COMBINED));
|
||||
(cache == WRITE_COMBINED));
|
||||
}
|
||||
cap = io_mem.io_mem->cap();
|
||||
});
|
||||
|
@ -82,7 +82,7 @@ class Driver::Device : private List_model<Device>::Element
|
||||
|
||||
Irq_session_capability irq(unsigned idx,
|
||||
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);
|
||||
|
||||
void report(Xml_generator &, Session_component &);
|
||||
|
@ -41,12 +41,12 @@ void Driver::Device_component::release()
|
||||
|
||||
|
||||
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;
|
||||
_session.env().devices.for_each([&] (Driver::Device & device) {
|
||||
if (device.name() == _device) {
|
||||
cap = device.io_mem(idx, attr, _session); }});
|
||||
cap = device.io_mem(idx, cache, _session); }});
|
||||
return cap;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Driver::Device_component : public Rpc_object<Platform::Device>
|
||||
**************************/
|
||||
|
||||
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:
|
||||
|
||||
|
@ -80,7 +80,7 @@ class Nonpci::Ps2 : public Platform::Device_component
|
||||
}
|
||||
|
||||
Genode::Io_mem_session_capability io_mem(Genode::uint8_t,
|
||||
Genode::Cache_attribute,
|
||||
Genode::Cache,
|
||||
Genode::addr_t,
|
||||
Genode::size_t) override
|
||||
{
|
||||
|
@ -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::Cache_attribute const caching,
|
||||
Genode::addr_t const offset,
|
||||
Genode::size_t const size)
|
||||
Genode::Cache const caching,
|
||||
Genode::addr_t const offset,
|
||||
Genode::size_t const size)
|
||||
{
|
||||
Genode::uint8_t max = sizeof(_io_mem) / sizeof(_io_mem[0]);
|
||||
Genode::uint8_t r_id = 0;
|
||||
@ -77,7 +77,7 @@ Genode::Io_mem_session_capability Platform::Device_component::io_mem(Genode::uin
|
||||
}
|
||||
|
||||
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,
|
||||
res.base() + offset,
|
||||
res_size, wc);
|
||||
|
@ -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_mem_session_capability io_mem(Genode::uint8_t,
|
||||
Genode::Cache_attribute,
|
||||
Genode::Cache,
|
||||
Genode::addr_t,
|
||||
Genode::size_t) override;
|
||||
};
|
||||
|
@ -113,7 +113,7 @@ class Genode::Session_env : public 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_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);
|
||||
Ram_dataspace_capability ds;
|
||||
_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;
|
||||
}
|
||||
|
@ -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 used_caps() const override { return _pd.used_caps(); }
|
||||
|
||||
Ram_dataspace_capability alloc(size_t amount, Cache_attribute cached) override {
|
||||
return _pd.alloc(amount, cached); }
|
||||
Ram_dataspace_capability alloc(size_t amount, Cache cache) override {
|
||||
return _pd.alloc(amount, cache); }
|
||||
|
||||
void free(Ram_dataspace_capability ds) override { _pd.free(ds); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user