Rev 1924 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1924 | Rev 2015 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | #include <sysinfo/sysinfo.h> |
36 | #include <sysinfo/sysinfo.h> |
37 | #include <console/klog.h> |
37 | #include <console/klog.h> |
38 | #include <print.h> |
38 | #include <print.h> |
39 | #include <ddi/device.h> |
39 | #include <ddi/device.h> |
40 | #include <ddi/irq.h> |
40 | #include <ddi/irq.h> |
- | 41 | #include <ddi/ddi.h> |
|
41 | #include <ipc/irq.h> |
42 | #include <ipc/irq.h> |
42 | 43 | ||
- | 44 | /** Physical memory area used for klog. */ |
|
- | 45 | static parea_t klog_parea; |
|
- | 46 | ||
43 | /* |
47 | /* |
44 | * For now, we use 0 as INR. |
48 | * For now, we use 0 as INR. |
45 | * However, on some architectures 0 is the clock interrupt (e.g. amd64 and ia32). |
49 | * However, on some architectures 0 is the clock interrupt (e.g. amd64 and |
46 | * It is therefore desirable to have architecture specific definition of KLOG_VIRT_INR |
50 | * ia32). It is therefore desirable to have architecture specific definition of |
47 | * in the future. |
51 | * KLOG_VIRT_INR in the future. |
48 | */ |
52 | */ |
49 | #define KLOG_VIRT_INR 0 |
53 | #define KLOG_VIRT_INR 0 |
50 | 54 | ||
51 | /* Order of frame to be allocated for klog communication */ |
55 | /* Order of frame to be allocated for klog communication */ |
52 | #define KLOG_ORDER 0 |
56 | #define KLOG_ORDER 0 |
Line 73... | Line 77... | ||
73 | void *faddr; |
77 | void *faddr; |
74 | 78 | ||
75 | faddr = frame_alloc(KLOG_ORDER, FRAME_ATOMIC); |
79 | faddr = frame_alloc(KLOG_ORDER, FRAME_ATOMIC); |
76 | if (!faddr) |
80 | if (!faddr) |
77 | panic("Cannot allocate page for klog"); |
81 | panic("Cannot allocate page for klog"); |
78 | klog = (char *)PA2KA(faddr); |
82 | klog = (char *) PA2KA(faddr); |
79 | 83 | ||
80 | devno_t devno = device_assign_devno(); |
84 | devno_t devno = device_assign_devno(); |
81 | 85 | ||
- | 86 | klog_parea.pbase = (uintptr_t) faddr; |
|
- | 87 | klog_parea.vbase = (uintptr_t) klog; |
|
- | 88 | klog_parea.frames = 1 << KLOG_ORDER; |
|
- | 89 | klog_parea.cacheable = true; |
|
- | 90 | ddi_parea_register(&klog_parea); |
|
- | 91 | ||
82 | sysinfo_set_item_val("klog.faddr", NULL, (unative_t)faddr); |
92 | sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr); |
- | 93 | sysinfo_set_item_val("klog.fcolor", NULL, (unative_t) |
|
- | 94 | PAGE_COLOR((uintptr_t) klog)); |
|
83 | sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER); |
95 | sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER); |
84 | sysinfo_set_item_val("klog.devno", NULL, devno); |
96 | sysinfo_set_item_val("klog.devno", NULL, devno); |
85 | sysinfo_set_item_val("klog.inr", NULL, KLOG_VIRT_INR); |
97 | sysinfo_set_item_val("klog.inr", NULL, KLOG_VIRT_INR); |
86 | 98 | ||
87 | irq_initialize(&klog_irq); |
99 | irq_initialize(&klog_irq); |