Allocate memory regions for XHCI
This commit is contained in:
parent
d78669df9c
commit
e3f27812ad
@ -9,7 +9,9 @@
|
||||
module hulk.usb.xhci;
|
||||
|
||||
import hulk.pci;
|
||||
import hulk.hurl;
|
||||
import hulk.hurl.a1;
|
||||
import hulk.hippo;
|
||||
import hulk.klog;
|
||||
import hulk.time;
|
||||
import hulk.volatile;
|
||||
@ -358,6 +360,39 @@ struct XHCI
|
||||
Klog.writefln("XHCI controller failed to initialize");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Allocate memory for various controller data structures. */
|
||||
ubyte * page = cast(ubyte *)Hippo.allocate_page();
|
||||
/* Device Context Index: 2K */
|
||||
void * device_context_index = page;
|
||||
/* Device Context: 2K */
|
||||
void * device_context = &page[2048];
|
||||
page = cast(ubyte *)Hippo.allocate_page();
|
||||
/* Input Control Context: 64 bytes */
|
||||
void * input_control_context = page;
|
||||
/* Slot Context: 64 bytes */
|
||||
void * slot_context = &page[64];
|
||||
/* Endpoint Context: 64 bytes */
|
||||
void * endpoint_context = &page[128];
|
||||
/* Stream Context: 16 bytes */
|
||||
void * stream_context = &page[192];
|
||||
/* Scratchpad Buffer Array: 248 bytes */
|
||||
void * scratchpad_buffer_array = &page[256];
|
||||
/* Stream Array (Linear): 1M */
|
||||
void * stream_array_linear = Hippo.allocate_aligned_region(1024 * 1024, PAGE_SIZE);
|
||||
/* Stream Array (Pri/Sec): 4K */
|
||||
void * stream_array_pri_sec = Hippo.allocate_page();
|
||||
/* Transfer Ring Segments: 64K */
|
||||
void * transfer_ring_segments = Hippo.allocate_aligned_region(64 * 1024, 64 * 1024);
|
||||
/* Command Ring Segments: 64K */
|
||||
void * command_ring_segments = Hippo.allocate_aligned_region(64 * 1024, 64 * 1024);
|
||||
/* Event Ring Segments: 64K */
|
||||
void * event_ring_segments = Hippo.allocate_aligned_region(64 * 1024, 64 * 1024);
|
||||
/* Event Ring Segment Table: 512K */
|
||||
void * event_ring_segment_table = Hippo.allocate_aligned_region(512 * 1024, PAGE_SIZE);
|
||||
/* Scratchpad Buffers: 4K */
|
||||
void * scratchpad_buffers = Hippo.allocate_page();
|
||||
|
||||
/* TODO: write dcbaap. */
|
||||
/* TODO: write cr_ctrl. */
|
||||
/+ TODO:
|
||||
|
Loading…
x
Reference in New Issue
Block a user