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
redox-os
kernel
Commits
661ebb63
Unverified
Commit
661ebb63
authored
8 years ago
by
Connor Wood
Browse files
Options
Downloads
Patches
Plain Diff
Saved FADT in a pointer accessible elsewhere in the kernel
parent
1d5c7d6a
No related branches found
No related tags found
1 merge request
!6
Implemented reading from RTC Century counter in x86_64 arch, if available
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arch/x86_64/src/acpi/mod.rs
+37
-7
37 additions, 7 deletions
arch/x86_64/src/acpi/mod.rs
with
37 additions
and
7 deletions
arch/x86_64/src/acpi/mod.rs
+
37
−
7
View file @
661ebb63
...
...
@@ -27,7 +27,13 @@ pub mod xsdt;
const
TRAMPOLINE
:
usize
=
0x7E00
;
const
AP_STARTUP
:
usize
=
TRAMPOLINE
+
512
;
pub
fn
init_sdt
(
sdt
:
&
'static
Sdt
,
active_table
:
&
mut
ActivePageTable
)
{
pub
enum
AcpiTable
{
fadt
(
Fadt
),
madt
(
Madt
),
dmar
(
Dmar
)
}
pub
fn
init_sdt
(
sdt
:
&
'static
Sdt
,
active_table
:
&
mut
ActivePageTable
)
->
Option
<
AcpiTable
>
{
print!
(
" "
);
for
&
c
in
sdt
.signature
.iter
()
{
print!
(
"{}"
,
c
as
char
);
...
...
@@ -35,6 +41,7 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
if
let
Some
(
fadt
)
=
Fadt
::
new
(
sdt
)
{
println!
(
": {:#?}"
,
fadt
);
Some
(
AcpiTable
::
fadt
(
fadt
))
}
else
if
let
Some
(
madt
)
=
Madt
::
new
(
sdt
)
{
println!
(
": {:>08X}: {}"
,
madt
.local_address
,
madt
.flags
);
...
...
@@ -138,6 +145,7 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
// Unmap trampoline
let
result
=
active_table
.unmap
(
trampoline_page
);
result
.flush
(
active_table
);
Some
(
AcpiTable
::
madt
(
madt
))
}
else
if
let
Some
(
dmar
)
=
Dmar
::
new
(
sdt
)
{
println!
(
": {}: {}"
,
dmar
.addr_width
,
dmar
.flags
);
...
...
@@ -157,8 +165,10 @@ pub fn init_sdt(sdt: &'static Sdt, active_table: &mut ActivePageTable) {
_
=>
()
}
}
Some
(
AcpiTable
::
dmar
(
dmar
))
}
else
{
println!
(
": Unknown"
);
None
}
}
...
...
@@ -167,6 +177,8 @@ pub unsafe fn init(active_table: &mut ActivePageTable) -> Option<Acpi> {
let
start_addr
=
0xE0000
;
let
end_addr
=
0xFFFFF
;
let
mut
theFADT
:
Option
<
Fadt
>
=
None
;
// Map all of the ACPI RSDP space
{
let
start_frame
=
Frame
::
containing_address
(
PhysicalAddress
::
new
(
start_addr
));
...
...
@@ -212,14 +224,26 @@ pub unsafe fn init(active_table: &mut ActivePageTable) -> Option<Acpi> {
if
let
Some
(
rsdt
)
=
Rsdt
::
new
(
rxsdt
)
{
for
sdt_address
in
rsdt
.iter
()
{
let
(
sdt
,
mapped
)
=
get_sdt
(
sdt_address
,
active_table
);
init_sdt
(
sdt
,
active_table
);
drop_sdt
(
sdt
,
mapped
,
active_table
);
// If we find the FADT, rather than drop it, save a copy of the pointer, as this is needed elsewhere.
// TODO: Eventually, save pointers to all tables containing pertinent information to other parts of
// the kernel
match
init_sdt
(
sdt
,
active_table
)
{
Some
(
AcpiTable
::
fadt
(
fadt
))
=>
theFADT
=
Some
(
fadt
),
_
=>
drop_sdt
(
sdt
,
mapped
,
active_table
)
}
}
}
else
if
let
Some
(
xsdt
)
=
Xsdt
::
new
(
rxsdt
)
{
for
sdt_address
in
xsdt
.iter
()
{
let
(
sdt
,
mapped
)
=
get_sdt
(
sdt_address
,
active_table
);
init_sdt
(
sdt
,
active_table
);
drop_sdt
(
sdt
,
mapped
,
active_table
);
// If we find the FADT, rather than drop it, save a copy of the pointer, as this is needed elsewhere.
// TODO: Eventually, save pointers to all tables containing pertinent information to other parts of
// the kernel
match
init_sdt
(
sdt
,
active_table
)
{
Some
(
AcpiTable
::
fadt
(
fadt
))
=>
theFADT
=
Some
(
fadt
),
_
=>
drop_sdt
(
sdt
,
mapped
,
active_table
)
}
}
}
else
{
println!
(
"UNKNOWN RSDT OR XSDT SIGNATURE"
);
...
...
@@ -241,10 +265,16 @@ pub unsafe fn init(active_table: &mut ActivePageTable) -> Option<Acpi> {
}
}
None
if
let
Some
(
fadt
)
=
theFADT
{
Some
(
Acpi
{
fadt
:
fadt
})
}
else
{
None
}
}
pub
struct
Acpi
;
pub
struct
Acpi
{
pub
fadt
:
Fadt
}
/// RSDP
#[derive(Copy,
Clone,
Debug)]
...
...
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