Support to control the leds on VAXstations, taken from Sun3 and ported
to vax by Shinmyoh Koji (yesu@rb3.so-net.ne.jp).
This commit is contained in:
parent
cc812b4ce2
commit
aa13a12702
|
@ -1,11 +1,11 @@
|
|||
# $NetBSD: GENERIC,v 1.87 2001/02/05 17:32:08 abs Exp $
|
||||
# $NetBSD: GENERIC,v 1.88 2001/02/18 10:44:22 ragge Exp $
|
||||
#
|
||||
# GENERIC VAX configuration file; all supported devices.
|
||||
#
|
||||
|
||||
include "arch/vax/conf/std.vax"
|
||||
|
||||
#ident "GENERIC-$Revision: 1.87 $"
|
||||
#ident "GENERIC-$Revision: 1.88 $"
|
||||
|
||||
# Here are all different supported CPU types listed.
|
||||
#options "VAX8800" # VAX 8500, 8530, 8550, 8700, 8800
|
||||
|
@ -241,3 +241,4 @@ pseudo-device ccd 4
|
|||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
#options RAID_AUTOCONFIG # auto-configuration of RAID components
|
||||
pseudo-device rnd # /dev/random and in-kernel generator
|
||||
#pseudo-device leds # control the leds on vaxstations.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.vax,v 1.80 2001/02/04 20:36:26 ragge Exp $
|
||||
# $NetBSD: files.vax,v 1.81 2001/02/18 10:44:22 ragge Exp $
|
||||
#
|
||||
# new style config file for vax architecture
|
||||
#
|
||||
|
@ -24,6 +24,9 @@ defopt opt_cputype.h VAX780 VAX750 VAX730
|
|||
|
||||
defopt opt_emulate.h NO_INSN_EMULATE
|
||||
|
||||
defpseudo leds
|
||||
file arch/vax/vsa/leds.c leds needs-flag
|
||||
|
||||
# NBI on KA88
|
||||
device nmi { slot=-1 }
|
||||
attach nmi at mainbus with nmi_mainbus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.13 2000/06/26 15:43:18 kleink Exp $
|
||||
# $NetBSD: Makefile,v 1.14 2001/02/18 10:44:20 ragge Exp $
|
||||
|
||||
KDIR= /sys/arch/vax/include
|
||||
INCSDIR= /usr/include/vax
|
||||
|
@ -11,7 +11,7 @@ INCS= ansi.h aout_machdep.h asm.h \
|
|||
float.h frame.h \
|
||||
ibcs2_machdep.h int_types.h ioa.h \
|
||||
ka410.h ka420.h ka43.h ka630.h ka650.h ka750.h ka820.h \
|
||||
loadfile_machdep.h lcgreg.h limits.h lock.h \
|
||||
leds.h loadfile_machdep.h lcgreg.h limits.h lock.h \
|
||||
macros.h math.h mtpr.h \
|
||||
nexus.h param.h pcb.h pmap.h proc.h profile.h psl.h pte.h ptrace.h \
|
||||
qdioctl.h qdreg.h qduser.h qevent.h \
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: leds.h,v 1.1 2001/02/18 10:44:20 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross and der Mouse.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Data structure supported by /dev/leds */
|
||||
|
||||
struct led_patterns {
|
||||
u_char divisor; /* divides 100 Hz clock (0 means 256). */
|
||||
u_char patlen; /* patterns to use (0 means 256). */
|
||||
u_char pat[256]; /* the patters... */
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
void ledsattach(int);
|
||||
void leds_intr(void);
|
||||
int leds_uio(struct uio *uio);
|
||||
#endif /* _KERNEL */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intvec.s,v 1.58 2001/01/15 20:19:58 thorpej Exp $ */
|
||||
/* $NetBSD: intvec.s,v 1.59 2001/02/18 10:44:22 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden.
|
||||
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "opt_cputype.h"
|
||||
#include "opt_emulate.h"
|
||||
#include "leds.h"
|
||||
|
||||
#define SCBENTRY(name) \
|
||||
.text ; \
|
||||
|
@ -359,6 +360,9 @@ SCBENTRY(hardclock)
|
|||
1: pushl sp
|
||||
addl2 $24,(sp)
|
||||
calls $1,_C_LABEL(hardclock)
|
||||
#if NLEDS
|
||||
calls $0,_C_LABEL(leds_intr)
|
||||
#endif
|
||||
popr $0x3f
|
||||
rei
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mem.c,v 1.20 2000/06/29 07:14:32 mrg Exp $ */
|
||||
/* $NetBSD: mem.c,v 1.21 2001/02/18 10:44:22 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -54,6 +54,10 @@
|
|||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/leds.h>
|
||||
|
||||
#include "leds.h"
|
||||
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
cdev_decl(mm);
|
||||
|
@ -137,6 +141,12 @@ mmrw(dev_t dev, struct uio *uio, int flags)
|
|||
c = min(iov->iov_len, NBPG);
|
||||
error = uiomove(zeropage, c, uio);
|
||||
continue;
|
||||
#if NLEDS
|
||||
case 13: /* /dev/leds */
|
||||
error = leds_uio(uio);
|
||||
/* Yes, return (not break) so EOF works. */
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
default:
|
||||
return (ENXIO);
|
||||
|
|
|
@ -0,0 +1,156 @@
|
|||
/* $NetBSD: leds.c,v 1.1 2001/02/18 10:44:21 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Gordon W. Ross and der Mouse.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Functions to flash the LEDs with some pattern.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/sid.h>
|
||||
#include <machine/leds.h>
|
||||
|
||||
#include "opt_cputype.h"
|
||||
|
||||
static volatile u_short *diagreg = 0;
|
||||
static u_char led_countdown = 0;
|
||||
static u_char led_px = 0;
|
||||
|
||||
/*
|
||||
* Initial value is the default pattern set.
|
||||
*/
|
||||
static struct led_patterns ledpat = {
|
||||
16, /* divisor */
|
||||
12, /* patlen */
|
||||
{ /* patterns */
|
||||
0x03, 0x06, 0x0c, 0x18,
|
||||
0x30, 0x60, 0xc0, 0x60,
|
||||
0x30, 0x18, 0x0c, 0x06,
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
ledsattach(int a)
|
||||
{
|
||||
switch (vax_boardtype) {
|
||||
#if VAX46
|
||||
case VAX_BTYP_46: {
|
||||
extern struct vs_cpu *ka46_cpu;
|
||||
diagreg = (volatile u_short *)(&ka46_cpu->vc_diagdsp);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if VAX48
|
||||
case VAX_BTYP_48: {
|
||||
extern struct vs_cpu *ka48_cpu;
|
||||
diagreg = (volatile u_short *)(&ka48_cpu->vc_diagdsp);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if VAX49
|
||||
case VAX_BTYP_49:
|
||||
diagreg = (volatile u_short *)vax_map_physmem(0x25800000, 1);
|
||||
diagreg += 2;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/* Turn on some lights. */
|
||||
leds_intr();
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called by the clock interrupt.
|
||||
*/
|
||||
void
|
||||
leds_intr()
|
||||
{
|
||||
register u_char i;
|
||||
|
||||
if (diagreg == 0)
|
||||
return;
|
||||
|
||||
if (led_countdown) {
|
||||
led_countdown--;
|
||||
return;
|
||||
}
|
||||
|
||||
led_countdown = ledpat.divisor - 1;
|
||||
i = led_px;
|
||||
|
||||
*diagreg = ~ledpat.pat[i];
|
||||
|
||||
i = i+1;
|
||||
if (i == ledpat.patlen)
|
||||
i = 0;
|
||||
led_px = i;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is called by mem.c to handle /dev/leds
|
||||
*/
|
||||
int
|
||||
leds_uio(struct uio *uio)
|
||||
{
|
||||
int cnt, error;
|
||||
int off; /* NOT off_t */
|
||||
caddr_t va;
|
||||
|
||||
off = uio->uio_offset;
|
||||
if ((off < 0) || (off > sizeof(ledpat)))
|
||||
return (EIO);
|
||||
|
||||
cnt = min(uio->uio_resid, (sizeof(ledpat) - off));
|
||||
if (cnt == 0)
|
||||
return (0); /* EOF */
|
||||
|
||||
va = ((char*)(&ledpat)) + off;
|
||||
error = uiomove(va, cnt, uio);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
Loading…
Reference in New Issue