Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osv
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Verlässliche Systemsoftware
projects
osv
Commits
b3eb642f
Commit
b3eb642f
authored
12 years ago
by
Guy Zana
Browse files
Options
Downloads
Patches
Plain Diff
Added unified access functions to mmio regions
parent
826cea48
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build.mak
+1
-0
1 addition, 0 deletions
build.mak
mmio.cc
+57
-0
57 additions, 0 deletions
mmio.cc
mmio.hh
+24
-0
24 additions, 0 deletions
mmio.hh
with
82 additions
and
0 deletions
build.mak
+
1
−
0
View file @
b3eb642f
...
...
@@ -128,6 +128,7 @@ objects += mempool.o
objects
+=
arch
/x64/elf-dl.o
objects
+=
linux.o
objects
+=
sched.o
objects
+=
mmio.o
objects
+=
kern/sglist.o
...
...
This diff is collapsed.
Click to expand it.
mmio.cc
0 → 100644
+
57
−
0
View file @
b3eb642f
#include
"types.hh"
#include
"mmu.hh"
#include
"mmio.hh"
using
namespace
mmu
;
void
mmio_setb
(
mmioaddr_t
addr
,
u8
val
)
{
*
reinterpret_cast
<
volatile
u8
*>
(
addr
)
=
val
;
}
void
mmio_setw
(
mmioaddr_t
addr
,
u16
val
)
{
*
reinterpret_cast
<
volatile
u16
*>
(
addr
)
=
val
;
}
void
mmio_setl
(
mmioaddr_t
addr
,
u32
val
)
{
*
reinterpret_cast
<
volatile
u32
*>
(
addr
)
=
val
;
}
void
mmio_setq
(
mmioaddr_t
addr
,
u64
val
)
{
*
reinterpret_cast
<
volatile
u64
*>
(
addr
)
=
val
;
}
u8
mmio_getb
(
mmioaddr_t
addr
)
{
return
(
*
reinterpret_cast
<
volatile
u8
*>
(
addr
));
}
u16
mmio_getw
(
mmioaddr_t
addr
)
{
return
(
*
reinterpret_cast
<
volatile
u16
*>
(
addr
));
}
u32
mmio_getl
(
mmioaddr_t
addr
)
{
return
(
*
reinterpret_cast
<
volatile
u32
*>
(
addr
));
}
u64
mmio_getq
(
mmioaddr_t
addr
)
{
return
(
*
reinterpret_cast
<
volatile
u64
*>
(
addr
));
}
mmioaddr_t
mmio_map
(
u64
paddr
,
size_t
size_bytes
)
{
uintptr_t
map_to
=
0xffff800000000000ull
+
paddr
;
linear_map
(
map_to
,
paddr
,
size_bytes
,
4096
);
return
reinterpret_cast
<
mmioaddr_t
>
(
map_to
);
}
void
mmio_unmap
(
mmioaddr_t
addr
,
size_t
size_bytes
)
{
// FIXME: implement
}
This diff is collapsed.
Click to expand it.
mmio.hh
0 → 100644
+
24
−
0
View file @
b3eb642f
#ifndef MMIO_HH
#define MMIO_HH
#include
"types.hh"
typedef
volatile
void
*
mmioaddr_t
;
const
mmioaddr_t
mmio_nullptr
=
0
;
// Functions used to access mmio regions
void
mmio_setb
(
mmioaddr_t
addr
,
u8
val
);
void
mmio_setw
(
mmioaddr_t
addr
,
u16
val
);
void
mmio_setl
(
mmioaddr_t
addr
,
u32
val
);
void
mmio_setq
(
mmioaddr_t
addr
,
u64
val
);
u8
mmio_getb
(
mmioaddr_t
addr
);
u16
mmio_getw
(
mmioaddr_t
addr
);
u32
mmio_getl
(
mmioaddr_t
addr
);
u64
mmio_getq
(
mmioaddr_t
addr
);
// Map mmio regions
mmioaddr_t
mmio_map
(
u64
paddr
,
size_t
size_bytes
);
void
mmio_unmap
(
mmioaddr_t
addr
,
size_t
size_bytes
);
#endif // MMIO_HH
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