/trunk/kernel/kernel.config |
---|
141,8 → 141,14 |
# Support for NS16550 serial port |
! [ARCH=sparc64|ARCH=ia64] CONFIG_NS16550 (y/n) |
# IOSapic on default address support (including legacy IRQ) |
! [ARCH=ia64] CONFIG_IOSAPIC (y/n) |
# Interrupt-driven driver for Legacy Keyboard? |
! [CONFIG_IOSAPIC=y] CONFIG_I8042_INTERRUPT_DRIVEN (y/n) |
# Interrupt-driven driver for NS16550? |
! [CONFIG_NS16550=y] CONFIG_NS16550_INTERRUPT_DRIVEN (n/y) |
! [CONFIG_NS16550=y&((ARCH!=ia64)|CONFIG_IOSAPIC=y)] CONFIG_NS16550_INTERRUPT_DRIVEN (y/n) |
# Virtually indexed D-cache support |
! [ARCH=sparc64] CONFIG_VIRT_IDX_DCACHE (y/n) |
/trunk/kernel/genarch/src/kbd/ns16550.c |
---|
38,8 → 38,8 |
#include <genarch/kbd/key.h> |
#include <genarch/kbd/scanc.h> |
#include <genarch/kbd/scanc_sun.h> |
#include <arch/drivers/kbd.h> |
#ifndef ia64 |
#include <arch/drivers/kbd.h> |
#include <arch/drivers/ns16550.h> |
#endif |
#include <ddi/irq.h> |
130,14 → 130,18 |
ns16550_irq.cir = cir; |
ns16550_irq.cir_arg = cir_arg; |
irq_register(&ns16550_irq); |
while ((ns16550_lsr_read(&ns16550) & LSR_DATA_READY)) |
ns16550_rbr_read(&ns16550); |
sysinfo_set_item_val("kbd", NULL, true); |
#ifndef ia64 |
sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); |
#endif |
sysinfo_set_item_val("kbd.devno", NULL, devno); |
sysinfo_set_item_val("kbd.inr", NULL, inr); |
sysinfo_set_item_val("kbd.address.virtual", NULL, port); |
sysinfo_set_item_val("kbd.port", NULL, port); |
#ifdef CONFIG_NS16550_INTERRUPT_DRIVEN |
/* Enable interrupts */ |
147,6 → 151,7 |
#ifdef ia64 |
uint8_t c; |
// This switches rbr & ier to mode when accept baudrate constant |
c = ns16550_lcr_read(&ns16550); |
ns16550_lcr_write(&ns16550, 0x80 | c); |
ns16550_rbr_write(&ns16550, 0x0c); |
/trunk/kernel/generic/src/ipc/irq.c |
---|
100,7 → 100,7 |
*((uint64_t *) code->cmds[i].addr) = |
code->cmds[i].value; |
break; |
#if defined(ia32) || defined(amd64) |
#if defined(ia32) || defined(amd64) || defined(ia64) |
case CMD_PORT_READ_1: |
dstval = inb((long) code->cmds[i].addr); |
break; |
/trunk/kernel/Makefile |
---|
126,10 → 126,18 |
DEFS += -DCONFIG_NS16550 |
endif |
ifeq ($(CONFIG_I8042_INTERRUPT_DRIVEN),y) |
DEFS += -DCONFIG_I8042_INTERRUPT_DRIVEN |
endif |
ifeq ($(CONFIG_NS16550_INTERRUPT_DRIVEN),y) |
DEFS += -DCONFIG_NS16550_INTERRUPT_DRIVEN |
endif |
ifeq ($(CONFIG_IOSAPIC),y) |
DEFS += -DCONFIG_IOSAPIC |
endif |
ifeq ($(CONFIG_VIRT_IDX_DCACHE),y) |
DEFS += -DCONFIG_VIRT_IDX_DCACHE |
endif |
/trunk/kernel/arch/ia64/include/interrupt.h |
---|
56,6 → 56,7 |
#define IRQ_KBD 241 |
#define IRQ_MOUSE 252 |
#define INTERRUPT_SPURIOUS 15 |
#define LAGACY_INTERRUPT_BASE 0x20 |
/** General Exception codes. */ |
#define GE_ILLEGALOP 0 |
152,6 → 153,7 |
extern void external_interrupt(uint64_t vector, istate_t *istate); |
extern void disabled_fp_register(uint64_t vector, istate_t *istate); |
#endif |
/** @} |
/trunk/kernel/arch/ia64/include/drivers/kbd.h |
---|
0,0 → 1,49 |
/* |
* Copyright (c) 2006 Jakub Jermar, Jakub Vana |
* 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 ia6464 |
* @{ |
*/ |
/** @file |
*/ |
#ifndef KERN_ia64_KBD_H_ |
#define KERN_ia64_KBD_H_ |
typedef enum { |
KBD_UNKNOWN, |
KBD_SKI, |
KBD_LEGACY, |
KBD_NS16550 |
} kbd_type_t; |
#endif |
/** @} |
*/ |
/trunk/kernel/arch/ia64/src/ia64.c |
---|
63,11 → 63,13 |
#include <sysinfo/sysinfo.h> |
/*NS16550 as a COM 1*/ |
#define NS16550_IRQ 4 |
#define NS16550_IRQ (4+LAGACY_INTERRUPT_BASE) |
#define NS16550_PORT 0x3f8 |
bootinfo_t *bootinfo; |
static uint64_t iosapic_base=0xfec00000; |
void arch_pre_main(void) |
{ |
/* Setup usermode init tasks. */ |
111,10 → 113,36 |
} |
static void iosapic_init(void) |
{ |
uint64_t IOSAPIC = PA2KA((unative_t)(iosapic_base))|FW_OFFSET; |
int i; |
for(i=0;i<16;i++) |
{ |
if(i==2) continue; //Disable Cascade interrupt |
((uint32_t*)(IOSAPIC+0x00))[0]=0x10+2*i; |
srlz_d(); |
((uint32_t*)(IOSAPIC+0x10))[0]=LAGACY_INTERRUPT_BASE+i; |
srlz_d(); |
((uint32_t*)(IOSAPIC+0x00))[0]=0x10+2*i+1; |
srlz_d(); |
((uint32_t*)(IOSAPIC+0x10))[0]=1<<(56-32); |
srlz_d(); |
} |
} |
void arch_post_mm_init(void) |
{ |
if(config.cpu_active==1) |
{ |
iosapic_init(); |
irq_init(INR_COUNT, INR_COUNT); |
#ifdef SKI |
ski_init_console(); |
122,7 → 150,8 |
ega_init(); |
#endif |
} |
it_init(); |
it_init(); |
} |
void arch_post_cpu_init(void) |
142,7 → 171,9 |
while (1) { |
i8042_poll(); |
#ifdef CONFIG_NS16550 |
#ifndef CONFIG_NS16550_INTERRUPT_DRIVEN |
ns16550_poll(); |
#endif |
#endif |
thread_usleep(POLL_INTERVAL); |
} |
149,6 → 180,13 |
} |
#endif |
static void end_of_irq_void(void *cir_arg __attribute__((unused)),inr_t inr __attribute__((unused))) |
{ |
return; |
} |
void arch_post_smp_init(void) |
{ |
171,7 → 209,7 |
i8042_init(kbd, IRQ_KBD, mouse, IRQ_MOUSE); |
#ifdef CONFIG_NS16550 |
ns16550_init(kbd, NS16550_IRQ, NS16550_PORT); // as a COM 1 |
ns16550_init(kbd, NS16550_IRQ, NS16550_PORT,end_of_irq_void,NULL); // as a COM 1 |
#else |
#endif |
thread_t *t; |
188,6 → 226,10 |
sysinfo_set_item_val("ia64_iospace.address", NULL, true); |
sysinfo_set_item_val("ia64_iospace.address.virtual", NULL, IO_OFFSET); |
} |
237,6 → 279,12 |
{ |
#ifdef SKI |
ski_kbd_grab(); |
#else |
i8042_grab(); |
#ifdef CONFIG_NS16550 |
ns16550_grab(); |
#endif |
#endif |
} |
/** Return console to userspace |
246,6 → 294,12 |
{ |
#ifdef SKI |
ski_kbd_release(); |
i8042_release(); |
#else |
#ifdef CONFIG_NS16550 |
ns16550_release(); |
#endif |
#endif |
} |
/trunk/kernel/arch/ia64/src/ski/ski.c |
---|
44,6 → 44,7 |
#include <proc/thread.h> |
#include <synch/spinlock.h> |
#include <arch/asm.h> |
#include <drivers/kbd.h> |
#define SKI_KBD_INR 0 |
227,6 → 228,7 |
sysinfo_set_item_val("kbd", NULL, true); |
sysinfo_set_item_val("kbd.inr", NULL, SKI_KBD_INR); |
sysinfo_set_item_val("kbd.devno", NULL, ski_kbd_devno); |
sysinfo_set_item_val("kbd.type", NULL, KBD_SKI); |
} |
void ski_kbd_grab(void) |
/trunk/kernel/arch/ia64/src/interrupt.c |
---|
235,7 → 235,7 |
vector_to_string(vector)); |
} |
static void end_of_local_irq() |
static void end_of_local_irq(void) |
{ |
asm volatile ("mov cr.eoi=r0;;"); |
} |
243,17 → 243,11 |
void external_interrupt(uint64_t vector, istate_t *istate) |
{ |
irq_t *irq; |
cr_ivr_t ivr; |
ivr.value = ivr_read(); |
srlz_d(); |
irq = irq_dispatch_and_lock(ivr.vector); |
if (irq) { |
irq->handler(irq, irq->arg); |
spinlock_unlock(&irq->lock); |
} else { |
switch (ivr.vector) { |
case INTERRUPT_SPURIOUS: |
#ifdef CONFIG_DEBUG |
270,11 → 264,39 |
default: |
panic("\nUnhandled External Interrupt Vector %d\n", |
ivr.vector); |
{ |
int ack=false; |
irq_t *irq = irq_dispatch_and_lock(ivr.vector); |
if (irq) { |
/* |
* The IRQ handler was found. |
*/ |
if (irq->preack) { |
/* Send EOI before processing the interrupt */ |
end_of_local_irq(); |
ack=true; |
} |
irq->handler(irq, irq->arg); |
spinlock_unlock(&irq->lock); |
} else { |
/* |
* Unhandled interrupt. |
*/ |
end_of_local_irq(); |
ack=true; |
#ifdef CONFIG_DEBUG |
printf("\nUnhandled External Interrupt Vector %d\n",ivr.vector); |
#endif |
} |
if(!ack) end_of_local_irq(); |
} |
break; |
} |
} |
} |
/** @} |
/trunk/kernel/arch/ia64/src/drivers/ega.c |
---|
94,6 → 94,7 |
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.blinking", NULL, true); |
sysinfo_set_item_val("fb.address.physical", NULL, VIDEORAM & 0xffffffff); |
#ifndef CONFIG_FB |