Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1382 → Rev 1381

/kernel/trunk/genarch/include/fb/fb.h
35,4 → 35,7
extern spinlock_t fb_lock;
void fb_init(__address addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
 
/* To be implemented by architecture. */
void fb_map_arch(__address virtaddr, __address physaddr, size_t size);
 
#endif
/kernel/trunk/genarch/src/fb/fb_map.c
0,0 → 1,41
/*
* Copyright (C) 2006 Martin Decky
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <genarch/fb/fb.h>
#include <mm/as.h>
#include <mm/page.h>
#include <mm/frame.h>
#include <align.h>
 
void fb_map_arch(__address virtaddr, __address physaddr, size_t size)
{
pfn_t i;
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
page_mapping_insert(AS_KERNEL, (__address) virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i),
PAGE_NOT_CACHEABLE);
}
/kernel/trunk/genarch/src/fb/fb.c
32,6 → 32,7
#include <console/console.h>
#include <sysinfo/sysinfo.h>
#include <mm/slab.h>
#include <bitops.h>
#include <align.h>
#include <panic.h>
#include <memstr.h>
348,10 → 349,18
}
unsigned int fbsize = scan * y;
unsigned int fborder;
if (fbsize <= FRAME_SIZE)
fborder = 0;
else
fborder = (fnzb32(fbsize - 1) + 1) - FRAME_WIDTH;
/* Map the framebuffer */
fbaddress = (__u8 *) hw_map((__address) addr, fbsize);
fbaddress = (__u8 *) PA2KA(PFN2ADDR(frame_alloc(fborder, FRAME_KA)));
fb_map_arch((__address) fbaddress, (__address) addr, fbsize);
xres = x;
yres = y;
bitspp = bpp;
/kernel/trunk/genarch/Makefile.inc
67,6 → 67,10
genarch/src/fb/font-8x16.c \
genarch/src/fb/fb.c
DEFS += -DCONFIG_FB
ifneq ($(CONFIG_FB_MAP_ARCH),y)
GENARCH_SOURCES += \
genarch/src/fb/fb_map.c
endif
endif
 
## i8042 controller
/kernel/trunk/generic/include/mm/page.h
78,6 → 78,5
extern pte_t *page_mapping_find(as_t *as, __address page);
extern pte_t *page_table_create(int flags);
extern void map_structure(__address s, size_t size);
extern __address hw_map(__address physaddr, size_t size);
 
#endif
/kernel/trunk/arch/sparc64/Makefile.inc
65,6 → 65,7
#
 
CONFIG_FB = y
CONFIG_FB_MAP_ARCH = y
 
## Compile with support for i8042 controller.
#
/kernel/trunk/arch/sparc64/src/console.c
71,6 → 71,12
ofw_console_active = 1;
}
 
void fb_map_arch(__address virtaddr, __address physaddr, size_t size)
{
dtlb_insert_mapping(virtaddr, physaddr, PAGESIZE_512K, true, false);
dtlb_insert_mapping(virtaddr + 512*1024, physaddr + 512*1024, PAGESIZE_512K, true, false);
}
 
/** Initialize kernel console to use framebuffer and keyboard directly. */
void standalone_sparc64_console_init(void)
{
/kernel/trunk/arch/sparc64/src/mm/page.c
27,29 → 27,9
*/
 
#include <arch/mm/page.h>
#include <arch/mm/tlb.h>
#include <genarch/mm/page_ht.h>
#include <mm/frame.h>
#include <bitops.h>
 
void page_arch_init(void)
{
page_mapping_operations = &ht_mapping_operations;
}
 
__address hw_map(__address physaddr, size_t size)
{
unsigned int order;
if (size <= FRAME_SIZE)
order = 0;
else
order = (fnzb32(size - 1) + 1) - FRAME_WIDTH;
__address virtaddr = PA2KA(PFN2ADDR(frame_alloc(order, FRAME_KA)));
dtlb_insert_mapping(virtaddr, physaddr, PAGESIZE_512K, true, false);
dtlb_insert_mapping(virtaddr + 512 * 1024, physaddr + 512 * 1024, PAGESIZE_512K, true, false);
return virtaddr;
}
/kernel/trunk/arch/ia32/src/mm/page.c
33,7 → 33,6
#include <mm/page.h>
#include <mm/as.h>
#include <arch/types.h>
#include <align.h>
#include <config.h>
#include <func.h>
#include <arch/interrupt.h>
43,7 → 42,6
#include <print.h>
#include <interrupt.h>
 
 
void page_arch_init(void)
{
__address cur;
71,19 → 69,3
 
paging_on();
}
 
 
__address hw_map(__address physaddr, size_t size)
{
if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
__address virtaddr = PA2KA(last_frame);
pfn_t i;
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE);
last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
return virtaddr;
}
/kernel/trunk/arch/amd64/src/mm/page.c
71,8 → 71,6
SET_FRAME_ADDRESS_ARCH(ptl3, PTL3_INDEX_ARCH(page), (__address)KA2PA(tgt)); \
SET_FRAME_FLAGS_ARCH(ptl3, PTL3_INDEX_ARCH(page), PAGE_WRITE | PAGE_EXEC); \
}
 
 
void page_arch_init(void)
{
__address cur;
110,7 → 108,6
}
}
 
 
/** Identity page mapper
*
* We need to map whole physical memory identically before the page subsystem
164,7 → 161,6
oldpage = page;
}
 
 
void page_fault(int n, istate_t *istate)
{
__address page;
176,19 → 172,3
panic("page fault\n");
}
}
 
 
__address hw_map(__address physaddr, size_t size)
{
if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
__address virtaddr = PA2KA(last_frame);
pfn_t i;
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE);
last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
return virtaddr;
}