mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
pci_decode: export prefetchable attribute of BARs
Memory descriptors in PCI BARs have a prefetchable bit, which can be used to optimize memory access when setting, e.g. write-combined in page-table entries. Ref genodelabs/genode#4578
This commit is contained in:
committed by
Christian Helmuth
parent
1d0b9ed302
commit
7334128a2e
@@ -96,6 +96,8 @@ struct Pci::Config : Genode::Mmio
|
|||||||
enum { SIZE_32BIT = 0, SIZE_64BIT = 2 };
|
enum { SIZE_32BIT = 0, SIZE_64BIT = 2 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Memory_prefetchable : Bitfield<3,1> {};
|
||||||
|
|
||||||
struct Io_base : Bitfield<2, 30> {};
|
struct Io_base : Bitfield<2, 30> {};
|
||||||
struct Memory_base : Bitfield<7, 25> {};
|
struct Memory_base : Bitfield<7, 25> {};
|
||||||
};
|
};
|
||||||
@@ -123,6 +125,9 @@ struct Pci::Config : Genode::Mmio
|
|||||||
Bar_32bit::Memory_type::SIZE_64BIT;
|
Bar_32bit::Memory_type::SIZE_64BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool prefetchable() {
|
||||||
|
return Bar_32bit::Memory_prefetchable::get(_conf); }
|
||||||
|
|
||||||
Genode::size_t size()
|
Genode::size_t size()
|
||||||
{
|
{
|
||||||
return 1 + (memory() ? ~Bar_32bit::Memory_base::masked(_conf)
|
return 1 + (memory() ? ~Bar_32bit::Memory_base::masked(_conf)
|
||||||
@@ -524,7 +529,7 @@ struct Pci::Config : Genode::Mmio
|
|||||||
if (!reg0.valid())
|
if (!reg0.valid())
|
||||||
continue;
|
continue;
|
||||||
if (reg0.memory()) {
|
if (reg0.memory()) {
|
||||||
memory(reg0.addr(), reg0.size(), i);
|
memory(reg0.addr(), reg0.size(), i, reg0.prefetchable());
|
||||||
if (reg0.bit64()) i++;
|
if (reg0.bit64()) i++;
|
||||||
} else
|
} else
|
||||||
io(reg0.addr(), reg0.size(), i);
|
io(reg0.addr(), reg0.size(), i);
|
||||||
|
|||||||
@@ -126,12 +126,15 @@ void Main::parse_pci_function(Bdf bdf,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
cfg.for_each_bar([&] (uint64_t addr, size_t size, unsigned bar) {
|
cfg.for_each_bar([&] (uint64_t addr, size_t size,
|
||||||
|
unsigned bar, bool pf)
|
||||||
|
{
|
||||||
gen.node("io_mem", [&]
|
gen.node("io_mem", [&]
|
||||||
{
|
{
|
||||||
gen.attribute("pci_bar", bar);
|
gen.attribute("pci_bar", bar);
|
||||||
gen.attribute("address", string(addr));
|
gen.attribute("address", string(addr));
|
||||||
gen.attribute("size", string(size));
|
gen.attribute("size", string(size));
|
||||||
|
if (pf) gen.attribute("prefetchable", true);
|
||||||
});
|
});
|
||||||
}, [&] (uint64_t addr, size_t size, unsigned bar) {
|
}, [&] (uint64_t addr, size_t size, unsigned bar) {
|
||||||
gen.node("io_port_range", [&]
|
gen.node("io_port_range", [&]
|
||||||
|
|||||||
Reference in New Issue
Block a user