|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "mmio.h"#include "memory_layout.h"#include "page.h"#include "arch/arch.h"#include "kernel/sync/spinlock.h"Macros | |
| #define | MAP_CACHED 0 |
| #define | MAP_UNCACHED 1 |
| #define | MAP_WRITE_COMBINING 2 |
Functions | |
| void | mmio_init (void) |
| mapping device memory (MMIO) into the kernel. | |
| void * | ioremap (phys_addr_t phys, size_t size) |
| map a range of device memory into the kernel. | |
| void * | ioremap_nocache (phys_addr_t phys, size_t size) |
| map a range of device registers into the kernel, not cached (each access goes to the device). | |
| void * | ioremap_wc (phys_addr_t phys, size_t size) |
| map memory such as a framebuffer write-combining (uncached if the CPU has no PAT): writes are combined into bursts, reads are slow. | |
| #define MAP_CACHED 0 |
| #define MAP_UNCACHED 1 |
| #define MAP_WRITE_COMBINING 2 |
| void mmio_init | ( | void | ) |
mapping device memory (MMIO) into the kernel.
device memory such as a linear framebuffer sits outside RAM, so the direct map of RAM does not cover it. ioremap maps it into a kernel-only window (MMIO_REGION_BASE..MMIO_REGION_END) shared by every address space. mappings are permanent: devices are never unplugged. reserve the MMIO window. must run after paging_init() and before the first address space is created.
| void * ioremap | ( | phys_addr_t | phys, |
| size_t | size ) |
map a range of device memory into the kernel.
| phys | physical address of the device memory (need not be aligned). |
| size | number of bytes. |
| void * ioremap_nocache | ( | phys_addr_t | phys, |
| size_t | size ) |
map a range of device registers into the kernel, not cached (each access goes to the device).
use this for controller registers; ioremap is for memory such as a framebuffer.
| phys | physical address of the registers (need not be aligned). |
| size | number of bytes. |
| void * ioremap_wc | ( | phys_addr_t | phys, |
| size_t | size ) |
map memory such as a framebuffer write-combining (uncached if the CPU has no PAT): writes are combined into bursts, reads are slow.
| phys | physical address (need not be aligned). |
| size | number of bytes. |