|
From: Kenn H. <ke...@us...> - 2004-09-18 23:06:42
|
Update of /cvsroot/linux-vax/kernel-2.5/drivers/vax/bus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7464/drivers/vax/bus Modified Files: vsbus-ka4x.c vsbus.c Log Message: Move all the current VSBUS code into drivers/vax/bus/vsbus. I'm not moving the irq auto-probe code since no working driver uses it at the moment. I'm very reluctant to resurrect the autoprobe code. I'm convinced that we can avoid autoprobing by find out where the interrupt vector lookup tables are stored on all the newer machines. Index: vsbus.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/vax/bus/vsbus.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vsbus.c 10 May 2004 23:20:34 -0000 1.1 +++ vsbus.c 18 Sep 2004 23:06:33 -0000 1.2 @@ -26,12 +26,32 @@ #include <linux/init.h> #include <linux/device.h> +#include <asm/io.h> #include <asm/bus/vsbus.h> -#include <asm/vsa.h> - #define VSBUS_DEBUG 1 +static struct vsbus_registers *vs_cpu_ptr; + +static unsigned int vsbus_rom_vectors[VSBUS_NR_IRQS]; + +int init_vsbus_adapter(unsigned int *vectors, unsigned long registers) +{ + if (vs_cpu_ptr) { + printk("vsbus: already initialized\n"); + return -EBUSY; + } + + memcpy(vsbus_rom_vectors, vectors, VSBUS_NR_IRQS * sizeof(unsigned int)); + + vs_cpu_ptr = ioremap(registers, 0x80); + if (!vs_cpu_ptr) { + return -EAGAIN; + } + + return 0; +} + /* Interrupt vector handling on VSBUS devices is a bit unusual (for a VAX). There are up to 8 interrupt sources. Each source has a bit in the INTREQ/INTCLR register and the INTMSK register. @@ -57,7 +77,21 @@ at physical address 0x20040020, which contains the interrupt vectors. The hardware-specific driver fills in this table. */ -unsigned int vsbus_rom_vectors[VSBUS_NR_IRQS]; + +void vsbus_enable_int(int bit_nr) +{ + vs_cpu_ptr->vc_intmsk |= 1<<bit_nr; +} + +void vsbus_clear_int(int bit_nr) +{ + vs_cpu_ptr->vc_intclr = 1<<bit_nr; +} + +void vsbus_disable_int(int bit_nr) +{ + vs_cpu_ptr->vc_intmsk &= ~(1<<bit_nr); +} unsigned int vsbus_irqindex_to_irq(unsigned int irqindex) { @@ -97,7 +131,7 @@ } info = irqinfo + vsbus_irqindex; - + /* FIXME: need a semaphore here */ if (info->handler) { Index: vsbus-ka4x.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/drivers/vax/bus/vsbus-ka4x.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- vsbus-ka4x.c 6 Aug 2004 22:41:36 -0000 1.2 +++ vsbus-ka4x.c 18 Sep 2004 23:06:33 -0000 1.3 @@ -19,24 +19,25 @@ static int __init vsbus_ka4x_probe(struct device *busdev) { - /* - * Map the area where we expect to find our device - * interrupt vectors and copy them somewhere more - * convenient - */ + unsigned int *vectors; + int retval; - unsigned int *rom_vectors; + /* + * Map the area where we expect to find our device + * interrupt vectors so that we can copy them somewhere + * more convenient + */ - rom_vectors = ioremap(0x20040020, 0x20); - if (!rom_vectors) { + vectors = ioremap(0x20040020, 0x20); + if (!vectors) { return -EAGAIN; } - memcpy(vsbus_rom_vectors, rom_vectors, 0x20); + retval = init_vsbus_adapter(vectors, VSA_BASE_REGS); - iounmap(rom_vectors); + iounmap(vectors); - return 0; + return retval; } static struct device_driver vsbus_ka4x_driver = { |