Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1840 → Rev 1841

/trunk/kernel/arch/sparc64/include/drivers/i8042.h
File deleted
/trunk/kernel/arch/sparc64/include/drivers/z8530.h
0,0 → 1,73
/*
* Copyright (C) 2006 Jakub Jermar
* 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.
*/
 
/** @addtogroup sparc64
* @{
*/
/** @file
*/
 
#ifndef KERN_sparc64_Z8530_H_
#define KERN_sparc64_Z8530_H_
 
#include <arch/types.h>
 
#define STATUS_REG 4
#define COMMAND_REG 4
#define DATA_REG 6
 
#define LAST_REG DATA_REG
 
extern volatile uint8_t *kbd_virt_address;
 
static inline void z8530_data_write(uint8_t data)
{
kbd_virt_address[DATA_REG] = data;
}
 
static inline uint8_t z8530_data_read(void)
{
return kbd_virt_address[DATA_REG];
}
 
static inline uint8_t z8530_status_read(void)
{
return kbd_virt_address[STATUS_REG];
}
 
static inline void z8530_command_write(uint8_t command)
{
kbd_virt_address[COMMAND_REG] = command;
}
 
extern void kbd_init(void);
 
#endif
 
/** @}
*/
/trunk/kernel/arch/sparc64/Makefile.inc
60,12 → 60,12
 
CONFIG_FB = y
 
## Compile with support for i8042 controller.
## Compile with support for z8530 controller.
#
 
CONFIG_I8042 = y
CONFIG_I8042_SUN = y
DEFS += -DCONFIG_I8042_SUN
CONFIG_Z8530 = y
CONFIG_KBD_SUN = y
DEFS += -DCONFIG_KBD_SUN
 
ARCH_SOURCES = \
arch/$(ARCH)/src/cpu/cpu.c \
88,4 → 88,4
arch/$(ARCH)/src/trap/interrupt.c \
arch/$(ARCH)/src/ddi/ddi.c \
arch/$(ARCH)/src/drivers/tick.c \
arch/$(ARCH)/src/drivers/i8042.c
arch/$(ARCH)/src/drivers/kbd.c
/trunk/kernel/arch/sparc64/src/console.c
53,12 → 53,12
void standalone_sparc64_console_init(void)
{
stdin = NULL;
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
bootinfo.screen.bpp, bootinfo.screen.scanline, true);
 
if (bootinfo.keyboard.addr)
kbd_init();
fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
bootinfo.screen.bpp, bootinfo.screen.scanline, true);
}
 
/** Kernel thread for polling keyboard.
/trunk/kernel/arch/sparc64/src/mm/page.c
46,6 → 46,22
page_mapping_operations = &ht_mapping_operations;
}
 
/** Map memory-mapped device into virtual memory.
*
* So far, only DTLB is used to map devices into memory.
* Chances are that there will be only a limited amount of
* devices that the kernel itself needs to lock in DTLB.
*
* @param physaddr Physical address of the page where the
* device is located. Must be at least
* page-aligned.
* @param size Size of the device's registers. Must not
* exceed 4M and must include extra space
* caused by the alignment.
*
* @return Virtual address of the page where the device is
* mapped.
*/
uintptr_t hw_map(uintptr_t physaddr, size_t size)
{
unsigned int order;
68,6 → 84,7
{ PAGESIZE_4M, 0, 1 } /* 4M */
};
ASSERT(ALIGN_UP(physaddr, PAGE_SIZE) == physaddr);
ASSERT(size <= 4*1024*1024);
if (size <= FRAME_SIZE)
/trunk/kernel/arch/sparc64/src/drivers/i8042.c
File deleted
/trunk/kernel/arch/sparc64/src/drivers/kbd.c
0,0 → 1,72
/*
* Copyright (C) 2006 Jakub Jermar
* 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.
*/
 
/** @addtogroup sparc64
* @{
*/
/** @file
*/
 
#ifdef CONFIG_Z8530
#include <genarch/kbd/z8530.h>
#endif
#ifdef CONFIG_16650A
#include <genarch/kbd/16650a.h>
#endif
#include <arch/boot/boot.h>
#include <arch/mm/page.h>
#include <arch/types.h>
#include <typedefs.h>
 
volatile uint8_t *kbd_virt_address = NULL;
 
void kbd_init()
{
size_t offset;
uintptr_t aligned_addr;
 
/*
* We need to pass aligned address to hw_map().
* However, the physical keyboard address can
* be pretty much unaligned on some systems
* (e.g. Ultra 5, Ultras 60).
*/
aligned_addr = ALIGN_DOWN(bootinfo.keyboard.addr, PAGE_SIZE);
offset = bootinfo.keyboard.addr - aligned_addr;
kbd_virt_address = (uint8_t *) hw_map(aligned_addr, offset + bootinfo.keyboard.size) + offset;
 
#ifdef CONFIG_Z8530
z8530_init();
#endif
#ifdef CONFIG_16650A
16650A_init();
#endif
}
 
/** @}
*/