#include "devices/input.h"
#include "devices/serial.h"
#include "devices/shutdown.h"
+#include "devices/pci.h"
#include "devices/timer.h"
#include "devices/vga.h"
#include "devices/rtc.h"
+#include "devices/usb.h"
#include "threads/interrupt.h"
#include "threads/io.h"
#include "threads/loader.h"
/* Page directory with kernel mappings only. */
uint32_t *init_page_dir;
+bool init_page_dir_initialized;
#ifdef FILESYS
/* -f: Format the file system? */
static void bss_init (void);
static void paging_init (void);
+static void pci_zone_init (void);
static char **read_command_line (void);
static char **parse_options (char **argv);
intr_init ();
timer_init ();
kbd_init ();
+ pci_init ();
input_init ();
#ifdef USERPROG
exception_init ();
thread_start ();
serial_init_queue ();
timer_calibrate ();
+ usb_init ();
#ifdef FILESYS
/* Initialize file system. */
+ usb_storage_init ();
ide_init ();
locate_block_devices ();
filesys_init (format_filesys);
if (pd[pde_idx] == 0)
{
pt = palloc_get_page (PAL_ASSERT | PAL_ZERO);
- pd[pde_idx] = pde_create (pt);
+ pd[pde_idx] = pde_create_kernel (pt);
}
pt[pte_idx] = pte_create_kernel (vaddr, !in_kernel_text);
}
+ pci_zone_init ();
+
/* Store the physical address of the page directory into CR3
aka PDBR (page directory base register). This activates our
new page tables immediately. See [IA32-v2a] "MOV--Move
to/from Control Registers" and [IA32-v3a] 3.7.5 "Base Address
of the Page Directory". */
asm volatile ("movl %0, %%cr3" : : "r" (vtop (init_page_dir)));
+
+ init_page_dir_initialized = true;
+}
+
+/* initialize PCI zone at PCI_ADDR_ZONE_BEGIN - PCI_ADDR_ZONE_END*/
+static void
+pci_zone_init (void)
+{
+ int i;
+ for (i = 0; i < PCI_ADDR_ZONE_PDES; i++)
+ {
+ size_t pde_idx = pd_no ((void *) PCI_ADDR_ZONE_BEGIN) + i;
+ uint32_t pde;
+ void *pt;
+
+ pt = palloc_get_page (PAL_ASSERT | PAL_ZERO);
+ pde = pde_create_kernel (pt);
+ init_page_dir[pde_idx] = pde;
+ }
}
/* Breaks the kernel command line into words and returns them as