summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/luna88k/conf/GENERIC3
-rw-r--r--sys/arch/luna88k/conf/files.luna88k7
-rw-r--r--sys/arch/luna88k/dev/lcd.c66
-rw-r--r--sys/arch/luna88k/luna88k/conf.c5
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c8
-rw-r--r--sys/arch/luna88k/luna88k/mainbus.c7
6 files changed, 77 insertions, 19 deletions
diff --git a/sys/arch/luna88k/conf/GENERIC b/sys/arch/luna88k/conf/GENERIC
index b7376f7b24b..1d04d3c4227 100644
--- a/sys/arch/luna88k/conf/GENERIC
+++ b/sys/arch/luna88k/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.12 2007/01/12 21:41:53 aoyama Exp $
+# $OpenBSD: GENERIC,v 1.13 2007/02/09 14:26:09 aoyama Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -31,6 +31,7 @@ config bsd swap generic
mainbus0 at root
clock0 at mainbus0
+lcd0 at mainbus0
le0 at mainbus0
sio0 at mainbus0
siotty0 at sio0
diff --git a/sys/arch/luna88k/conf/files.luna88k b/sys/arch/luna88k/conf/files.luna88k
index 5f13247499d..d7df73af3ae 100644
--- a/sys/arch/luna88k/conf/files.luna88k
+++ b/sys/arch/luna88k/conf/files.luna88k
@@ -1,4 +1,4 @@
-# $OpenBSD: files.luna88k,v 1.13 2006/08/06 13:04:31 miod Exp $
+# $OpenBSD: files.luna88k,v 1.14 2007/02/09 14:26:09 aoyama Exp $
#
maxpartitions 16
@@ -10,6 +10,10 @@ device clock
attach clock at mainbus
file arch/luna88k/dev/timekeeper.c clock
+device lcd
+attach lcd at mainbus
+file arch/luna88k/dev/lcd.c lcd needs-flag
+
attach le at mainbus
file arch/luna88k/dev/if_le.c le
@@ -76,4 +80,3 @@ file arch/luna88k/luna88k/isr.c
file arch/luna88k/luna88k/machdep.c
file arch/luna88k/luna88k/mem.c
file arch/luna88k/luna88k/pmap_table.c
-file arch/luna88k/dev/lcd.c
diff --git a/sys/arch/luna88k/dev/lcd.c b/sys/arch/luna88k/dev/lcd.c
index 8e0720552b1..739eb7f08bb 100644
--- a/sys/arch/luna88k/dev/lcd.c
+++ b/sys/arch/luna88k/dev/lcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcd.c,v 1.2 2007/01/29 14:18:00 aoyama Exp $ */
+/* $OpenBSD: lcd.c,v 1.3 2007/02/09 14:26:09 aoyama Exp $ */
/* $NetBSD: lcd.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */
/*-
@@ -43,6 +43,7 @@
#include <sys/ioctl.h>
#include <sys/fcntl.h>
+#include <machine/autoconf.h>
#include <machine/conf.h>
#include <machine/lcd.h>
@@ -79,6 +80,23 @@ struct pio {
volatile unsigned : 24;
};
+/* Autoconf stuff */
+int lcd_match(struct device *, void *, void *);
+void lcd_attach(struct device *, struct device *, void *);
+
+struct lcd_softc {
+ struct device sc_dev;
+ int sc_opened;
+};
+
+struct cfattach lcd_ca = {
+ sizeof(struct lcd_softc), lcd_match, lcd_attach
+};
+
+struct cfdriver lcd_cd = {
+ NULL, "lcd", DV_DULL, 0
+};
+
/* Internal prototypes */
void lcdbusywait(void);
void lcdput(int);
@@ -87,12 +105,39 @@ void lcdshow(const char *);
void greeting(void);
/* Internal variables */
-int lcd_opened = 0;
/* "1234567890123456" */
static const char lcd_boot_message1[] = "OpenBSD/luna88k ";
static const char lcd_boot_message2[] = " SX-9100/DT ";
/*
+ * Autoconf functions
+ */
+int
+lcd_match(parent, cf, aux)
+ struct device *parent;
+ void *cf, *aux;
+{
+ struct mainbus_attach_args *ma = aux;
+
+ if (strcmp(ma->ma_name, lcd_cd.cd_name))
+ return 0;
+ if (badaddr((vaddr_t)ma->ma_addr, 4))
+ return 0;
+ return 1;
+}
+
+void
+lcd_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ printf("\n");
+
+ /* Say hello to the world on LCD. */
+ greeting();
+}
+
+/*
* open/close/write/ioctl
*/
@@ -102,11 +147,16 @@ lcdopen(dev, flags, fmt, p)
int flags, fmt;
struct proc *p;
{
- if (minor(dev) != 0)
+ int unit = minor(dev);
+ struct lcd_softc *sc;
+
+ if (unit >= lcd_cd.cd_ndevs)
return ENXIO;
- if (lcd_opened)
+ if ((sc = lcd_cd.cd_devs[unit]) == NULL)
+ return ENXIO;
+ if (sc->sc_opened)
return EBUSY;
- lcd_opened = 1;
+ sc->sc_opened = 1;
return 0;
}
@@ -117,7 +167,11 @@ lcdclose(dev, flags, fmt, p)
int flags, fmt;
struct proc *p;
{
- lcd_opened = 0;
+ int unit = minor(dev);
+ struct lcd_softc *sc;
+
+ sc = lcd_cd.cd_devs[unit];
+ sc->sc_opened = 0;
return 0;
}
diff --git a/sys/arch/luna88k/luna88k/conf.c b/sys/arch/luna88k/luna88k/conf.c
index 85c48c71fe5..bafce4aca60 100644
--- a/sys/arch/luna88k/luna88k/conf.c
+++ b/sys/arch/luna88k/luna88k/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.3 2007/01/29 14:18:00 aoyama Exp $ */
+/* $OpenBSD: conf.c,v 1.4 2007/02/09 14:26:09 aoyama Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -59,6 +59,7 @@ cdev_decl(xfs_dev);
#endif
#include "ksyms.h"
+#include "lcd.h"
#include "siotty.h"
#include "wsdisplay.h"
@@ -105,7 +106,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 7: */
cdev_disk_init(NSD,sd), /* 8: SCSI disk */
cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- cdev_lcd_init(1, lcd), /* 10: /dev/lcd */
+ cdev_lcd_init(NLCD,lcd), /* 10: /dev/lcd */
cdev_notdef(), /* 11 */
cdev_tty_init(NSIOTTY,sio), /* 12: on-board UART (ttya) */
cdev_wsdisplay_init(NWSDISPLAY, /* 13: frame buffers, etc. */
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index f77aa0d8af4..eee1b12b19b 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.36 2007/01/12 21:41:53 aoyama Exp $ */
+/* $OpenBSD: machdep.c,v 1.37 2007/02/09 14:26:09 aoyama Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -236,7 +236,6 @@ int hwplanebits; /* set in locore.S */
extern struct consdev syscons; /* in dev/siotty.c */
-extern void greeting(void); /* in dev/lcd.c */
extern void syscnattach(int); /* in dev/siotty.c */
extern int omfb_cnattach(void); /* in dev/lunafb.c */
extern void ws_cnattach(void); /* in dev/lunaws.c */
@@ -561,11 +560,6 @@ cpu_startup()
printf("kernel does not support -c; continuing..\n");
#endif
}
-
- /*
- * Say hello to the world on LCD.
- */
- greeting();
}
/*
diff --git a/sys/arch/luna88k/luna88k/mainbus.c b/sys/arch/luna88k/luna88k/mainbus.c
index abc31ad6ef8..4dc86659cab 100644
--- a/sys/arch/luna88k/luna88k/mainbus.c
+++ b/sys/arch/luna88k/luna88k/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.6 2006/01/10 18:56:13 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.7 2007/02/09 14:26:09 aoyama Exp $ */
/* $NetBSD: mainbus.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */
/*-
@@ -48,8 +48,13 @@
#include <machine/cmmu.h>
#include <machine/cpu.h>
+#include "lcd.h"
+
static const struct mainbus_attach_args devs[] = {
{ "clock", 0x45000000, 6, LUNA_88K|LUNA_88K2 }, /* Mostek/Dallas TimeKeeper */
+#if NLCD > 0
+ { "lcd", 0x4d000000, -1, LUNA_88K|LUNA_88K2 }, /* Sharp LM16X212 LCD module */
+#endif
{ "le", 0xf1000000, 4, LUNA_88K|LUNA_88K2 }, /* Am7990 */
{ "sio", 0x51000000, 5, LUNA_88K|LUNA_88K2 }, /* uPD7201A */
{ "fb", 0xc1100000, -1, LUNA_88K|LUNA_88K2 }, /* BrookTree RAMDAC */