Compare commits
No commits in common. "238659e94b52a47212109dcfc3d46f10c0494994" and "2935903baedf29ea87f50e49f2583fcc304b1740" have entirely different histories.
238659e94b
...
2935903bae
@ -4,7 +4,6 @@ import hulk.cpu;
|
|||||||
import hulk.klog;
|
import hulk.klog;
|
||||||
import hulk.hurl;
|
import hulk.hurl;
|
||||||
import hulk.hurl.a1;
|
import hulk.hurl.a1;
|
||||||
import hulk.range;
|
|
||||||
|
|
||||||
struct Pci
|
struct Pci
|
||||||
{
|
{
|
||||||
@ -36,7 +35,6 @@ struct Pci
|
|||||||
ubyte if_id;
|
ubyte if_id;
|
||||||
bool multifunction;
|
bool multifunction;
|
||||||
ubyte header_type;
|
ubyte header_type;
|
||||||
Range[6] memory_ranges;
|
|
||||||
|
|
||||||
void initialize(Address address, ushort vendor_id, ushort device_id)
|
void initialize(Address address, ushort vendor_id, ushort device_id)
|
||||||
{
|
{
|
||||||
@ -63,7 +61,6 @@ struct Pci
|
|||||||
|
|
||||||
private void map_memory_regions()
|
private void map_memory_regions()
|
||||||
{
|
{
|
||||||
size_t range_index;
|
|
||||||
uint[2] r;
|
uint[2] r;
|
||||||
uint[2] s;
|
uint[2] s;
|
||||||
for (uint reg_no = 4u; reg_no <= 9u; reg_no++)
|
for (uint reg_no = 4u; reg_no <= 9u; reg_no++)
|
||||||
@ -112,13 +109,10 @@ struct Pci
|
|||||||
{
|
{
|
||||||
s[1] = 0xFFFF_FFFFu;
|
s[1] = 0xFFFF_FFFFu;
|
||||||
}
|
}
|
||||||
ulong mm_region_address = (cast(ulong)r[0] & 0xFFFF_FFF0u) | (cast(ulong)r[1] << 32u);
|
ulong addr = (cast(ulong)r[0] & 0xFFFF_FFF0u) | (cast(ulong)r[1] << 32u);
|
||||||
ulong length = ~((cast(ulong)s[0] & 0xFFFF_FFF0u) | (cast(ulong)s[1] << 32u)) + 1u;
|
ulong length = ~((cast(ulong)s[0] & 0xFFFF_FFF0u) | (cast(ulong)s[1] << 32u)) + 1u;
|
||||||
ulong flags = (r[0] & 0x8) != 0u ? PT_WRITE_THROUGH : 0u;
|
ulong flags = (r[0] & 0x8) != 0u ? PT_WRITE_THROUGH : 0u;
|
||||||
Hurl.identity_map_range(mm_region_address, length, flags);
|
Hurl.identity_map_range(addr, length, flags);
|
||||||
memory_ranges[range_index].address = mm_region_address;
|
|
||||||
memory_ranges[range_index].length = length;
|
|
||||||
range_index++;
|
|
||||||
if (is_64bit)
|
if (is_64bit)
|
||||||
{
|
{
|
||||||
reg_no++;
|
reg_no++;
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
module hulk.range;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Representation of a memory range.
|
|
||||||
*/
|
|
||||||
struct Range
|
|
||||||
{
|
|
||||||
/** Range base address. */
|
|
||||||
void * _address;
|
|
||||||
|
|
||||||
/** Range length. */
|
|
||||||
size_t length;
|
|
||||||
|
|
||||||
/** Set the range address. */
|
|
||||||
@property void * address(T)(T a)
|
|
||||||
{
|
|
||||||
static assert(T.sizeof == size_t.sizeof);
|
|
||||||
_address = cast(void *)a;
|
|
||||||
return _address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the range address. */
|
|
||||||
@property void * address()
|
|
||||||
{
|
|
||||||
return _address;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user