Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jD91mZM2
kernel
Commits
90b113f0
Verified
Commit
90b113f0
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Add lpss_debug
parent
331590e1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Cargo.toml
+1
-0
1 addition, 0 deletions
Cargo.toml
src/arch/x86_64/debug.rs
+16
-1
16 additions, 1 deletion
src/arch/x86_64/debug.rs
src/arch/x86_64/device/serial.rs
+28
-1
28 additions, 1 deletion
src/arch/x86_64/device/serial.rs
with
45 additions
and
2 deletions
Cargo.toml
+
1
−
0
View file @
90b113f0
...
@@ -36,6 +36,7 @@ acpi = []
...
@@ -36,6 +36,7 @@ acpi = []
doc
=
[]
doc
=
[]
graphical_debug
=
[]
graphical_debug
=
[]
live
=
[]
live
=
[]
lpss_debug
=
[]
multi_core
=
[
"acpi"
]
multi_core
=
[
"acpi"
]
pti
=
[]
pti
=
[]
qemu_debug
=
[]
qemu_debug
=
[]
...
...
This diff is collapsed.
Click to expand it.
src/arch/x86_64/debug.rs
+
16
−
1
View file @
90b113f0
...
@@ -8,11 +8,15 @@ use crate::log::{LOG, Log};
...
@@ -8,11 +8,15 @@ use crate::log::{LOG, Log};
use
syscall
::
io
::
Io
;
use
syscall
::
io
::
Io
;
#[cfg(any(feature
=
"qemu_debug"
,
feature
=
"serial_debug"
))]
#[cfg(any(feature
=
"qemu_debug"
,
feature
=
"serial_debug"
))]
use
crate
::
syscall
::
io
::
Pio
;
use
crate
::
syscall
::
io
::
Pio
;
#[cfg(feature
=
"serial_debug"
)]
#[cfg(feature
=
"lpss_debug"
)]
use
crate
::
syscall
::
io
::
Mmio
;
#[cfg(any(feature
=
"lpss_debug"
,
feature
=
"serial_debug"
))]
use
crate
::
devices
::
uart_16550
::
SerialPort
;
use
crate
::
devices
::
uart_16550
::
SerialPort
;
#[cfg(feature
=
"graphical_debug"
)]
#[cfg(feature
=
"graphical_debug"
)]
use
super
::
graphical_debug
::{
DEBUG_DISPLAY
,
DebugDisplay
};
use
super
::
graphical_debug
::{
DEBUG_DISPLAY
,
DebugDisplay
};
#[cfg(feature
=
"lpss_debug"
)]
use
super
::
device
::
serial
::
LPSS
;
#[cfg(feature
=
"serial_debug"
)]
#[cfg(feature
=
"serial_debug"
)]
use
super
::
device
::
serial
::
COM1
;
use
super
::
device
::
serial
::
COM1
;
...
@@ -23,6 +27,8 @@ pub struct Writer<'a> {
...
@@ -23,6 +27,8 @@ pub struct Writer<'a> {
log
:
MutexGuard
<
'a
,
Option
<
Log
>>
,
log
:
MutexGuard
<
'a
,
Option
<
Log
>>
,
#[cfg(feature
=
"graphical_debug"
)]
#[cfg(feature
=
"graphical_debug"
)]
display
:
MutexGuard
<
'a
,
Option
<
DebugDisplay
>>
,
display
:
MutexGuard
<
'a
,
Option
<
DebugDisplay
>>
,
#[cfg(feature
=
"lpss_debug"
)]
lpss
:
MutexGuard
<
'a
,
Option
<&
'static
mut
SerialPort
<
Mmio
<
u32
>>>>
,
#[cfg(feature
=
"qemu_debug"
)]
#[cfg(feature
=
"qemu_debug"
)]
qemu
:
MutexGuard
<
'a
,
Pio
<
u8
>>
,
qemu
:
MutexGuard
<
'a
,
Pio
<
u8
>>
,
#[cfg(feature
=
"serial_debug"
)]
#[cfg(feature
=
"serial_debug"
)]
...
@@ -35,6 +41,8 @@ impl<'a> Writer<'a> {
...
@@ -35,6 +41,8 @@ impl<'a> Writer<'a> {
log
:
LOG
.lock
(),
log
:
LOG
.lock
(),
#[cfg(feature
=
"graphical_debug"
)]
#[cfg(feature
=
"graphical_debug"
)]
display
:
DEBUG_DISPLAY
.lock
(),
display
:
DEBUG_DISPLAY
.lock
(),
#[cfg(feature
=
"lpss_debug"
)]
lpss
:
LPSS
.lock
(),
#[cfg(feature
=
"qemu_debug"
)]
#[cfg(feature
=
"qemu_debug"
)]
qemu
:
QEMU
.lock
(),
qemu
:
QEMU
.lock
(),
#[cfg(feature
=
"serial_debug"
)]
#[cfg(feature
=
"serial_debug"
)]
...
@@ -56,6 +64,13 @@ impl<'a> Writer<'a> {
...
@@ -56,6 +64,13 @@ impl<'a> Writer<'a> {
}
}
}
}
#[cfg(feature
=
"lpss_debug"
)]
{
if
let
Some
(
ref
mut
lpss
)
=
*
self
.lpss
{
lpss
.write
(
buf
);
}
}
#[cfg(feature
=
"qemu_debug"
)]
#[cfg(feature
=
"qemu_debug"
)]
{
{
for
&
b
in
buf
{
for
&
b
in
buf
{
...
...
This diff is collapsed.
Click to expand it.
src/arch/x86_64/device/serial.rs
+
28
−
1
View file @
90b113f0
use
crate
::
devices
::
uart_16550
::
SerialPort
;
use
crate
::
devices
::
uart_16550
::
SerialPort
;
use
crate
::
syscall
::
io
::
Pio
;
use
crate
::
syscall
::
io
::
{
Mmio
,
Pio
}
;
use
spin
::
Mutex
;
use
spin
::
Mutex
;
pub
static
COM1
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x3F8
));
pub
static
COM1
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x3F8
));
...
@@ -7,9 +7,36 @@ pub static COM2: Mutex<SerialPort<Pio<u8>>> = Mutex::new(SerialPort::<Pio<u8>>::
...
@@ -7,9 +7,36 @@ pub static COM2: Mutex<SerialPort<Pio<u8>>> = Mutex::new(SerialPort::<Pio<u8>>::
pub
static
COM3
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x3E8
));
pub
static
COM3
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x3E8
));
pub
static
COM4
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x2E8
));
pub
static
COM4
:
Mutex
<
SerialPort
<
Pio
<
u8
>>>
=
Mutex
::
new
(
SerialPort
::
<
Pio
<
u8
>>
::
new
(
0x2E8
));
#[cfg(feature
=
"lpss_debug"
)]
pub
static
LPSS
:
Mutex
<
Option
<&
'static
mut
SerialPort
<
Mmio
<
u32
>>>>
=
Mutex
::
new
(
None
);
pub
unsafe
fn
init
()
{
pub
unsafe
fn
init
()
{
COM1
.lock
()
.init
();
COM1
.lock
()
.init
();
COM2
.lock
()
.init
();
COM2
.lock
()
.init
();
COM3
.lock
()
.init
();
COM3
.lock
()
.init
();
COM4
.lock
()
.init
();
COM4
.lock
()
.init
();
#[cfg(feature
=
"lpss_debug"
)]
{
// TODO: Make this configurable
let
address
=
crate
::
KERNEL_OFFSET
+
0xFE032000
;
{
use
crate
::
paging
::{
ActivePageTable
,
Page
,
VirtualAddress
,
entry
::
EntryFlags
};
use
crate
::
memory
::{
Frame
,
PhysicalAddress
};
let
mut
active_table
=
ActivePageTable
::
new
();
let
page
=
Page
::
containing_address
(
VirtualAddress
::
new
(
address
));
let
frame
=
Frame
::
containing_address
(
PhysicalAddress
::
new
(
address
-
crate
::
KERNEL_OFFSET
));
let
result
=
active_table
.map_to
(
page
,
frame
,
EntryFlags
::
PRESENT
|
EntryFlags
::
WRITABLE
|
EntryFlags
::
NO_EXECUTE
);
result
.flush
(
&
mut
active_table
);
}
let
lpss
=
SerialPort
::
<
Mmio
<
u32
>>
::
new
(
crate
::
KERNEL_OFFSET
+
0xFE032000
);
lpss
.init
();
*
LPSS
.lock
()
=
Some
(
lpss
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment