1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-23 18:06:20 +04:00

Remove block::init, it's not necessary anymore

This commit is contained in:
Stephen Marz 2020-03-13 15:33:37 -04:00
parent 8f55a9a6ec
commit cfbc4b516a
2 changed files with 4 additions and 11 deletions

View File

@ -117,10 +117,6 @@ pub const VIRTIO_BLK_F_WRITE_ZEROES: u32 = 14;
// we initialize the block system.
static mut BLOCK_DEVICES: [Option<BlockDevice>; 8] = [None, None, None, None, None, None, None, None];
pub fn init() {
}
pub fn setup_block_device(ptr: *mut u32) -> bool {
unsafe {
// We can get the index of the device based on its address.
@ -199,6 +195,10 @@ pub fn setup_block_device(ptr: *mut u32) -> bool {
// finished. We will look at that later, but we need
// what is called a memory "fence" or barrier.
ptr.add(MmioOffsets::QueueSel.scale32()).write_volatile(0);
// Alignment is very important here. This is the memory address
// alignment between the available and used rings. If this is wrong,
// then we and the device will refer to different memory addresses
// and hence get the wrong data in the used ring.
ptr.add(MmioOffsets::QueueAlign.scale32()).write_volatile(8);
let queue_ptr = zalloc(num_pages) as *mut Queue;
let queue_pfn = queue_ptr as u32;

View File

@ -144,13 +144,6 @@ extern "C" fn kinit() {
plic::enable(i);
plic::set_priority(i, 1);
}
// println!(
// "UART interrupts have been enabled and are awaiting your \
// command."
// );
// Ordering is quite important here. Virtio::probe() will call the block
// setup which requires a block queue.
block::init();
virtio::probe();
let buffer = kmem::kmalloc(512);
block::read(8, buffer, 512, 0);