1
0
Çatalla 0

config: add CONFIG_PAGE_SIZE and CONFIG_INIT_PAGE_SIZE

Bu işleme şunda yer alıyor:
Aaron Lindsay 2013-01-01 23:53:18 -05:00
ebeveyn e69440c698
işleme 1c75a68815
6 değiştirilmiş dosya ile 17 ekleme ve 16 silme

Dosyayı Görüntüle

@ -78,6 +78,7 @@ config.h: config
@sed -i 's/#.*$$//g' config.h
@sed -i '/^\s*\(CONFIG_[A-Z0-9_]\+\)\s*=\s*[nN]/d' config.h
@sed -i 's/^\s*\(CONFIG_[A-Z0-9_]\+\)\s*=\s*[yY]/#define \1/g' config.h
@sed -i 's/^\s*\(CONFIG_[A-Z0-9_]\+\)\s*=\s*\([0-9]\+\)/#define \1 \2/g' config.h
clean:
@echo ' CLEAN config.h'

Dosyayı Görüntüle

@ -1,3 +1,5 @@
CONFIG_RPI = y
#CONFIG_VEXPRESS_A9 = y
#CONFIG_INTEGRATOR_CP = n
CONFIG_PAGE_SIZE = 0x1000
CONFIG_INIT_PAGE_SIZE = 0x100000

Dosyayı Görüntüle

@ -55,7 +55,7 @@ int pl110_init(struct fb *f, unsigned int color_depth) {
/* Allocate memory for framebuffer */
fb_size = width * height * (color_depth / 8);
power = log(fb_size) - log(MM_PAGE_SIZE);
power = log(fb_size) - log(CONFIG_PAGE_SIZE);
if ((unsigned int)1<<power < fb_size)
power++;
fr = get_free_frames(power);

Dosyayı Görüntüle

@ -57,7 +57,7 @@ int pl111_init_dev(struct fb *f, unsigned int color_depth) {
/* Allocate memory for framebuffer */
fb_size = width * height * (color_depth / 8);
power = log(fb_size) - log(MM_PAGE_SIZE);
power = log(fb_size) - log(CONFIG_PAGE_SIZE);
if ((unsigned int)1<<power < fb_size)
power++;
fr = get_free_frames(power);

Dosyayı Görüntüle

@ -23,8 +23,6 @@
#include <list.h>
#define MM_PAGE_SIZE 4096
struct frame {
void *address;
struct dlist_node list;

Dosyayı Görüntüle

@ -60,16 +60,16 @@ static void add_physical_memory(void *start, void *end) {
//If region starts at 0x0, make it start at next page to not screw up null pointer detection, etc.
if (start == 0)
start = (char *)start + MM_PAGE_SIZE;
start = (char *)start + CONFIG_PAGE_SIZE;
//make sure both start and end address are aligned to the size of a page
if ((arch_uint_ptr)start % MM_PAGE_SIZE != 0)
start = (char*)start + (MM_PAGE_SIZE - ((arch_uint_ptr)start % MM_PAGE_SIZE));
if (((arch_uint_ptr)end + 1) % MM_PAGE_SIZE != 0)
end = (char*)end - ((arch_uint_ptr)end + 1) % MM_PAGE_SIZE;
if ((arch_uint_ptr)start % CONFIG_PAGE_SIZE != 0)
start = (char*)start + (CONFIG_PAGE_SIZE - ((arch_uint_ptr)start % CONFIG_PAGE_SIZE));
if (((arch_uint_ptr)end + 1) % CONFIG_PAGE_SIZE != 0)
end = (char*)end - ((arch_uint_ptr)end + 1) % CONFIG_PAGE_SIZE;
if ((char *)end + 1 - (char *)start < MM_PAGE_SIZE<<1) {
print("Error: Supplied memory area(%x,%x) is smaller than the page size (%d)\n", (arch_uint_ptr)start, (arch_uint_ptr)end, MM_PAGE_SIZE);
if ((char *)end + 1 - (char *)start < CONFIG_PAGE_SIZE<<1) {
print("Error: Supplied memory area(%x,%x) is smaller than the page size (%d)\n", (arch_uint_ptr)start, (arch_uint_ptr)end, CONFIG_PAGE_SIZE);
return;
}
@ -78,13 +78,13 @@ static void add_physical_memory(void *start, void *end) {
//TODO we're potentially losing memory here because we're calculating
//the number of page structs we need even for those pages that will contain only page structs
num_pages = ((char *)end + 1 - (char *)start) / MM_PAGE_SIZE;
usable_pages = num_pages - num_pages * sizeof(struct frame) / MM_PAGE_SIZE;
if (num_pages * sizeof(struct frame) % MM_PAGE_SIZE)
num_pages = ((char *)end + 1 - (char *)start) / CONFIG_PAGE_SIZE;
usable_pages = num_pages - num_pages * sizeof(struct frame) / CONFIG_PAGE_SIZE;
if (num_pages * sizeof(struct frame) % CONFIG_PAGE_SIZE)
usable_pages--;
p = (struct frame *)start;
for (page = ((char *)start) + (num_pages - usable_pages)*MM_PAGE_SIZE; page < end; page = (void *)(((char *)page) + MM_PAGE_SIZE)) {
for (page = ((char *)start) + (num_pages - usable_pages)*CONFIG_PAGE_SIZE; page < end; page = (void *)(((char *)page) + CONFIG_PAGE_SIZE)) {
p->address = page;
insert_page_frame(p);
p++;
@ -115,7 +115,7 @@ struct frame* get_free_frames(unsigned int power) {
for (it2 = container(it->list.next, struct frame, list);
it2->list.next != &free_frames_list && curr_pages < num_pages;
it2 = container(it2->list.next, struct frame, list)) {
if ((char*)it2->address != (char*)container(it2->list.prev, struct frame, list)->address + MM_PAGE_SIZE) {
if ((char*)it2->address != (char*)container(it2->list.prev, struct frame, list)->address + CONFIG_PAGE_SIZE) {
it = it2; //fast-forward 'it' to start of next contiguous section of pages
break;
} else {