Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3939 → Rev 3940

/trunk/kernel/genarch/include/drivers/legacy/ia32/io.h
30,8 → 30,8
* @{
*/
/** @file
* @brief This file contains definitions used by architectures with the
* ia32 legacy I/O space (i.e. ia32, amd64 and ia64).
* @brief This file contains definitions used by architectures with the
* ia32 legacy I/O space (i.e. ia32, amd64 and ia64).
*/
 
#ifndef KERN_LEGACY_IA32_IO_H
39,13 → 39,12
 
#include <arch/types.h>
 
#define I8042_BASE ((ioport8_t *)0x60)
#define I8042_BASE ((ioport8_t *) 0x60)
#define EGA_BASE ((ioport8_t *) 0x3d4)
#define NS16550_BASE ((ioport8_t *) 0x3f8)
 
#define EGA_VIDEORAM 0xb8000
#define EGA_BASE ((ioport8_t *)0x3d4)
#define EGA_VIDEORAM 0xb8000
 
#define NS16550_BASE ((ioport8_t *)0x3f8)
 
#endif
 
/** @}
/trunk/kernel/genarch/include/drivers/ega/ega.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch_drivers
/** @addtogroup genarch_drivers
* @{
*/
/** @file
37,13 → 37,14
 
#include <arch/types.h>
 
#define ROW 80
#define ROWS 25
#define SCREEN (ROW * ROWS)
#define EGA_COLS 80
#define EGA_ROWS 25
#define EGA_SCREEN (EGA_COLS * EGA_ROWS)
#define EGA_VRAM_SIZE (2 * EGA_SCREEN)
 
/* EGA device registers. */
#define EGA_INDEX_REG 0
#define EGA_DATA_REG 1
#define EGA_INDEX_REG 0
#define EGA_DATA_REG 1
 
extern void ega_redraw(void);
extern void ega_init(ioport8_t *, uintptr_t);
/trunk/kernel/genarch/src/drivers/ega/ega.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup genarch_drivers
/** @addtogroup genarch_drivers
* @{
*/
/**
67,16 → 67,16
*/
static void ega_check_cursor(void)
{
if (ega_cursor < SCREEN)
if (ega_cursor < EGA_SCREEN)
return;
 
memmove((void *) videoram, (void *) (videoram + ROW * 2),
(SCREEN - ROW) * 2);
memmove((void *) backbuf, (void *) (backbuf + ROW * 2),
(SCREEN - ROW) * 2);
memsetw(videoram + (SCREEN - ROW) * 2, ROW, 0x0720);
memsetw(backbuf + (SCREEN - ROW) * 2, ROW, 0x0720);
ega_cursor = ega_cursor - ROW;
memmove((void *) videoram, (void *) (videoram + EGA_COLS * 2),
(EGA_SCREEN - EGA_COLS) * 2);
memmove((void *) backbuf, (void *) (backbuf + EGA_COLS * 2),
(EGA_SCREEN - EGA_COLS) * 2);
memsetw(videoram + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720);
memsetw(backbuf + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720);
ega_cursor = ega_cursor - EGA_COLS;
}
 
static void ega_move_cursor(void)
84,7 → 84,7
pio_write_8(ega_base + EGA_INDEX_REG, 0xe);
pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) ((ega_cursor >> 8) & 0xff));
pio_write_8(ega_base + EGA_INDEX_REG, 0xf);
pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff));
pio_write_8(ega_base + EGA_DATA_REG, (uint8_t) (ega_cursor & 0xff));
}
 
static void ega_display_char(char ch, bool silent)
104,13 → 104,13
switch (ch) {
case '\n':
ega_cursor = (ega_cursor + ROW) - ega_cursor % ROW;
ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS;
break;
case '\t':
ega_cursor = (ega_cursor + 8) - ega_cursor % 8;
break;
case '\b':
if (ega_cursor % ROW)
if (ega_cursor % EGA_COLS)
ega_cursor--;
break;
default:
133,18 → 133,18
 
void ega_init(ioport8_t *base, uintptr_t videoram_phys)
{
/* Initialize the software structure. */
/* Initialize the software structure. */
ega_base = base;
backbuf = (uint8_t *) malloc(SCREEN * 2, 0);
backbuf = (uint8_t *) malloc(EGA_VRAM_SIZE, 0);
if (!backbuf)
panic("Unable to allocate backbuffer.");
videoram = (uint8_t *) hw_map(videoram_phys, SCREEN * 2);
videoram = (uint8_t *) hw_map(videoram_phys, EGA_VRAM_SIZE);
/* Clear the screen and set the cursor position. */
memsetw(videoram, SCREEN, 0x0720);
memsetw(backbuf, SCREEN, 0x0720);
memsetw(videoram, EGA_SCREEN, 0x0720);
memsetw(backbuf, EGA_SCREEN, 0x0720);
ega_move_cursor();
chardev_initialize("ega_out", &ega_console, &ega_ops);
152,8 → 152,8
sysinfo_set_item_val("fb", NULL, true);
sysinfo_set_item_val("fb.kind", NULL, 2);
sysinfo_set_item_val("fb.width", NULL, ROW);
sysinfo_set_item_val("fb.height", NULL, ROWS);
sysinfo_set_item_val("fb.width", NULL, EGA_COLS);
sysinfo_set_item_val("fb.height", NULL, EGA_ROWS);
sysinfo_set_item_val("fb.blinking", NULL, true);
sysinfo_set_item_val("fb.address.physical", NULL, videoram_phys);
}
160,7 → 160,7
 
void ega_redraw(void)
{
memcpy(videoram, backbuf, SCREEN * 2);
memcpy(videoram, backbuf, EGA_VRAM_SIZE);
ega_move_cursor();
}
 
/trunk/kernel/generic/include/mm/page.h
61,7 → 61,7
extern void map_structure(uintptr_t s, size_t size);
 
extern uintptr_t hw_map(uintptr_t physaddr, size_t size);
extern void hw_area(uintptr_t *physaddr, pfn_t *frames);
extern void hw_area(void);
 
#endif
 
/trunk/kernel/generic/src/ddi/ddi.c
58,14 → 58,10
/** List with enabled physical memory areas. */
static LIST_INITIALIZE(parea_head);
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
/** Initialize DDI. */
void ddi_init(void)
{
hw_area(&dev_area.pbase, &dev_area.frames);
ddi_parea_register(&dev_area);
hw_area();
}
 
/** Enable piece of physical memory for mapping by physmem_map().
/trunk/kernel/arch/sparc64/src/mm/page.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup sparc64mm
/** @addtogroup sparc64mm
* @{
*/
/** @file
41,7 → 41,11
#include <debug.h>
#include <align.h>
#include <config.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
#ifdef CONFIG_SMP
/** Entries locked in DTLB of BSP.
*
164,10 → 168,11
return virtaddr;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0x7ffffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0x7ffffffffff - end_frame);
ddi_parea_register(&dev_area);
}
 
/** @}
/trunk/kernel/arch/ia64/include/mm/tlb.h
35,9 → 35,6
#ifndef KERN_ia64_TLB_H_
#define KERN_ia64_TLB_H_
 
#define tlb_arch_init()
#define tlb_print()
 
#include <arch/mm/page.h>
#include <arch/mm/asid.h>
#include <arch/interrupt.h>
/trunk/kernel/arch/ia64/src/mm/tlb.c
749,5 → 749,13
}
}
 
void tlb_arch_init(void)
{
}
 
void tlb_print(void)
{
}
 
/** @}
*/
/trunk/kernel/arch/ia64/src/mm/page.c
27,7 → 27,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup ia64mm
/** @addtogroup ia64mm
* @{
*/
/** @file
48,7 → 48,11
#include <arch/barrier.h>
#include <memstr.h>
#include <align.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
static void set_environment(void);
 
/** Initialize ia64 virtual address translation subsystem. */
274,10 → 278,11
return PA2KA(physaddr);
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0x7fffffffffffffffUL - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0x7fffffffffffffffUL - end_frame);
ddi_parea_register(&dev_area);
}
 
/** @}
/trunk/kernel/arch/arm32/include/mm/tlb.h
36,9 → 36,6
#ifndef KERN_arm32_TLB_H_
#define KERN_arm32_TLB_H_
 
#define tlb_arch_init()
#define tlb_print()
 
#endif
 
/** @}
/trunk/kernel/arch/arm32/src/mm/tlb.c
89,5 → 89,13
invalidate_page(page + i * PAGE_SIZE);
}
 
void tlb_arch_init(void)
{
}
 
void tlb_print(void)
{
}
 
/** @}
*/
/trunk/kernel/arch/arm32/src/mm/page.c
43,7 → 43,11
#include <arch/types.h>
#include <interrupt.h>
#include <arch/mm/frame.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
/** Initializes page tables.
*
* 1:1 virtual-physical mapping is created in kernel address space. Mapping
106,10 → 110,11
return virtaddr;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0xffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);
ddi_parea_register(&dev_area);
}
 
/** @}
/trunk/kernel/arch/ppc32/src/mm/page.c
37,7 → 37,11
#include <mm/as.h>
#include <align.h>
#include <config.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
void page_arch_init(void)
{
if (config.cpu_active == 1)
63,10 → 67,11
return virtaddr;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0xffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);
ddi_parea_register(&dev_area);
}
 
/** @}
/trunk/kernel/arch/amd64/include/mm/tlb.h
35,9 → 35,6
#ifndef KERN_amd64_TLB_H_
#define KERN_amd64_TLB_H_
 
#define tlb_arch_init()
#define tlb_print()
 
#endif
 
/** @}
/trunk/kernel/arch/amd64/src/mm/page.c
34,6 → 34,8
 
#include <arch/mm/page.h>
#include <genarch/mm/page_pt.h>
#include <genarch/drivers/ega/ega.h>
#include <genarch/drivers/legacy/ia32/io.h>
#include <arch/mm/frame.h>
#include <mm/page.h>
#include <mm/frame.h>
46,7 → 48,12
#include <print.h>
#include <panic.h>
#include <align.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
static parea_t ega_area;
 
/* Definitions for identity page mapper */
pte_t helper_ptl1[512] __attribute__((aligned (PAGE_SIZE)));
pte_t helper_ptl2[512] __attribute__((aligned (PAGE_SIZE)));
214,10 → 221,15
return virtaddr;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0xfffffffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0xfffffffffffff - end_frame);
ddi_parea_register(&dev_area);
ega_area.pbase = EGA_VIDEORAM;
ega_area.frames = SIZE2FRAMES(EGA_VRAM_SIZE);
ddi_parea_register(&ega_area);
}
 
/** @}
/trunk/kernel/arch/mips32/src/mm/page.c
36,7 → 36,11
#include <genarch/mm/page_pt.h>
#include <mm/page.h>
#include <mm/frame.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
 
void page_arch_init(void)
{
page_mapping_operations = &pt_mapping_operations;
51,10 → 55,11
return physaddr + 0xa0000000;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0xffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);
ddi_parea_register(&dev_area);
}
 
/** @}
/trunk/kernel/arch/ia32/include/mm/tlb.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup ia32mm
/** @addtogroup ia32mm
* @{
*/
/** @file
35,9 → 35,6
#ifndef KERN_ia32_TLB_H_
#define KERN_ia32_TLB_H_
 
#define tlb_arch_init()
#define tlb_print()
 
#endif
 
/** @}
/trunk/kernel/arch/ia32/src/mm/tlb.c
67,5 → 67,13
invlpg(page + i * PAGE_SIZE);
}
 
void tlb_arch_init(void)
{
}
 
void tlb_print(void)
{
}
 
/** @}
*/
/trunk/kernel/arch/ia32/src/mm/page.c
34,6 → 34,8
 
#include <arch/mm/page.h>
#include <genarch/mm/page_pt.h>
#include <genarch/drivers/ega/ega.h>
#include <genarch/drivers/legacy/ia32/io.h>
#include <arch/mm/frame.h>
#include <mm/frame.h>
#include <mm/page.h>
48,7 → 50,12
#include <memstr.h>
#include <print.h>
#include <interrupt.h>
#include <ddi/ddi.h>
 
/** Physical memory area for devices. */
static parea_t dev_area;
static parea_t ega_area;
 
void page_arch_init(void)
{
uintptr_t cur;
93,10 → 100,15
return virtaddr;
}
 
void hw_area(uintptr_t *physaddr, pfn_t *frames)
void hw_area(void)
{
*physaddr = end_frame;
*frames = ADDR2PFN(0xffffffff - end_frame);
dev_area.pbase = end_frame;
dev_area.frames = SIZE2FRAMES(0xffffffff - end_frame);
ddi_parea_register(&dev_area);
ega_area.pbase = EGA_VIDEORAM;
ega_area.frames = SIZE2FRAMES(EGA_VRAM_SIZE);
ddi_parea_register(&ega_area);
}
 
void page_fault(int n __attribute__((unused)), istate_t *istate)