From 358e682bad73f6e508e1977d4805fea3e30a6e5f Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Tue, 9 Apr 2019 01:08:49 +0800 Subject: [PATCH] Enable PCI initialization for matal, update mips crate and user app repo Signed-off-by: Harry Chen --- kernel/Cargo.lock | 8 ++++---- kernel/Cargo.toml | 2 +- kernel/src/arch/mipsel/board/malta/mod.rs | 2 +- kernel/src/drivers/gpu/qemu_stdvga.rs | 6 ++++-- user | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index c89c9d5..1d95c85 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -229,8 +229,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mips" -version = "0.1.0" -source = "git+https://github.com/Harry-Chen/rust-mips#7410a6aa107fce681378e7850c03f9b6befec2d2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -372,7 +372,7 @@ dependencies = [ "isomorphic_drivers 0.1.0 (git+https://github.com/rcore-os/isomorphic_drivers)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mips 0.1.0 (git+https://github.com/Harry-Chen/rust-mips)", + "mips 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -688,7 +688,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6" -"checksum mips 0.1.0 (git+https://github.com/Harry-Chen/rust-mips)" = "" +"checksum mips 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4cbf449a63e4db77af9f662d6b42068c0925e779a3a7c70ad02f191cf1e6c802" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "931fb7a4cf34610cf6cbe58d52a8ca5ef4c726d4e2e178abd0dc13a6551c6d73" "checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index a5c490d..e1d0288 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -78,7 +78,7 @@ aarch64 = { git = "https://github.com/rcore-os/aarch64" } bcm2837 = { git = "https://github.com/rcore-os/bcm2837", optional = true } [target.'cfg(target_arch = "mips")'.dependencies] -mips = { git = "https://github.com/Harry-Chen/rust-mips" } +mips = "^0.2.0" paste = "0.1" [package.metadata.bootimage] diff --git a/kernel/src/arch/mipsel/board/malta/mod.rs b/kernel/src/arch/mipsel/board/malta/mod.rs index 9917c70..b37fa97 100644 --- a/kernel/src/arch/mipsel/board/malta/mod.rs +++ b/kernel/src/arch/mipsel/board/malta/mod.rs @@ -33,7 +33,7 @@ pub fn init_serial_early() { pub fn init_driver() { // TODO: add possibly more drivers vga::init(0xbbe00000, 0xb2050000, 800, 600); - // pci::init(); + pci::init(); fb::init(); } diff --git a/kernel/src/drivers/gpu/qemu_stdvga.rs b/kernel/src/drivers/gpu/qemu_stdvga.rs index 7467667..c6885f0 100644 --- a/kernel/src/drivers/gpu/qemu_stdvga.rs +++ b/kernel/src/drivers/gpu/qemu_stdvga.rs @@ -19,6 +19,7 @@ const VBE_DISPI_INDEX_VIDEO_MEMORY_64K : u16 = 0xa; const VGA_AR_PAS : u8 = 0x20; const VBE_DISPI_ENABLED : u16 = 0x01; +const VBE_DISPI_8BIT_DAC : u16 = 0x20; const VBE_DISPI_LFB_ENABLED : u16 = 0x40; const PCI_COMMAND: u8 = 0x04; @@ -89,10 +90,11 @@ pub fn init(pci_base: usize, vga_base: usize, x_res: u16, y_res: u16) { debug!("VGA Endianess: {:x}", read::(vga_base + 0x604)); // unblank vga output - vga_read_io(0x3DA); vga_write_io(VGA_AR_ADDR, VGA_AR_PAS); debug!("VGA AR: {}", vga_read_io(VGA_AR_ADDR)); + vga_write_vbe(VBE_DISPI_INDEX_ENABLE, 0); + // set resolution and color depth vga_write_vbe(VBE_DISPI_INDEX_XRES, x_res); vga_write_vbe(VBE_DISPI_INDEX_YRES, y_res); @@ -106,7 +108,7 @@ pub fn init(pci_base: usize, vga_base: usize, x_res: u16, y_res: u16) { // enable vbe let vbe_enable = vga_read_vbe(VBE_DISPI_INDEX_ENABLE); - vga_write_vbe(VBE_DISPI_INDEX_ENABLE, vbe_enable | VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED); + vga_write_vbe(VBE_DISPI_INDEX_ENABLE, vbe_enable | VBE_DISPI_ENABLED | VBE_DISPI_LFB_ENABLED | VBE_DISPI_8BIT_DAC); debug!("VBE Status: {:04x}", vga_read_vbe(VBE_DISPI_INDEX_ENABLE)); info!("QEMU STDVGA driver initialized @ {:x}", vga_base); diff --git a/user b/user index 07619a4..2c80f1e 160000 --- a/user +++ b/user @@ -1 +1 @@ -Subproject commit 07619a48d4e8051766c294d9d616337869e4c1a0 +Subproject commit 2c80f1e46fbd6808b80bee9b7fbbb24c11afd29d