Commit Graph

106 Commits

Author SHA1 Message Date
tsutsui
d9cc465bd0 Consistently use sc_shm_size initialized at device attach. 2017-01-08 16:41:35 +00:00
tsutsui
75dcc607e6 Fix (mostly harmless) off-by-one size check in XPIOCDOWNLD ioctl.
Pointed out by Kenji Aoyama.
2017-01-08 16:34:44 +00:00
tsutsui
97d3c24f2a Preliminary support for LUNA's HD647180X I/O processor (a.k.a. XP).
Demonstrated as "PSG tunes / PCM wav player on LUNA"
(using Z80 PSG/PCM drivers ported from NEC PC-6001)
at OSC2016 Kyoto and OSC2016 Hiroshima:
 http://mail-index.netbsd.org/netbsd-advocacy/2016/08/01/msg000712.html
 http://mail-index.netbsd.org/netbsd-advocacy/2016/11/29/msg000724.html
2016-12-03 17:38:02 +00:00
christos
f9f1ccd009 - move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
2015-08-21 10:48:06 +00:00
christos
e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
christos
b59f66e17c use the inline bcdtobin and bintobcd directly instead through a macro. 2014-11-20 16:34:25 +00:00
tsutsui
25a2e495cb Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
>> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
>> It makes 4bpp wscons putchar ~20% faster.

This Makes 4bpp wscons putchar ~30% on LUNA-II.

Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.

Tested on all 1bpp/4bpp/8bpp framebuffers.
2014-10-04 16:58:17 +00:00
tsutsui
4d52a6286a Fix unintended RCS Id substitution. 2014-10-04 14:42:41 +00:00
tsutsui
7249f0e282 Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
2014-09-28 05:00:56 +00:00
tsutsui
c3f99db636 Pull readability changes from OpenBSD/luna88k.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings

Tested on LUNA-II with 8bpp framebuffer.
2014-09-28 04:43:01 +00:00
tsutsui
126d0c71da Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL

Tested on LUNA with 4bpp framebuffer.
2014-07-25 16:40:12 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
tsutsui
a24e0636a7 Add consistent prefix to a softc member name. 2014-07-24 14:09:09 +00:00
tsutsui
0bcc9a72e9 Pull LUNA's keyboard driver changes from OpenBSD/luna88k.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
  (actually the name is wrong; it doesn't emit raw keycode but
   converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
2014-07-20 11:14:56 +00:00
tsutsui
f6ba350205 Use kmem(9) instead of malloc(9). 2014-07-18 18:17:54 +00:00
tsutsui
f3b63fd9e2 Use C99 struct initialization for wsdisplay_accessops. 2014-07-18 18:03:36 +00:00
tsutsui
b454c4acb3 Minor KNF. No binary changes. 2014-07-18 18:02:08 +00:00
tsutsui
fb7d7d5abf Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k.  Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.

Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
2014-07-13 16:00:32 +00:00
riastradh
6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
tsutsui
11a902922e Misc cleanup of sio drivers.
- register softc of child devices as an argument of the sio interrupt
  handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
  to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages.  Tested on LUNA.
2014-02-02 15:35:06 +00:00
tsutsui
96fe424ce9 Remove initialization of unused t_softc in struct tty (to make pullup easier). 2014-01-02 03:32:35 +00:00
tsutsui
bc63cd47b4 Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.

Changes details (mostly similar to com(4) and z8530tty(4)):
 - allocate RX buffer and put data and status into it in the interrupt handler
 - call t_linesw->l_rint from the software interrupt handler
 - set the only first byte in siottystart() and use t_outq buffer to send
   multiple TX data
 - call the next t_linesw->l_start on TX complete in the software interrupt
   handler

Also put more changes:
 - handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
 - allocate tty in the attach function as other drivers rather than first open
 - use proper variable types
2013-12-31 14:24:09 +00:00
tsutsui
837223a076 Pull a fix of Bt458 (8bpp framebuffer) initialization from OpenBSD/luna88k.
http://marc.info/?l=openbsd-cvs&m=138838884202196
>> Correct initialization of Bt458, used in LUNA's 8bpp frame buffer.
>>
>> According to the manual, the address register does not automatically
>> increment when we access to the control registers.  Also we disable
>> overlay planes, because we do not use them.
2013-12-30 13:14:48 +00:00
tsutsui
2098d815c2 Add preleminary support of 4bpp LUNA framebuffer.
Changes details:
- prepare and switch 4bpp rasops functions that read/write all 4 planes
  and also handle both fg and bg colors
- make 1bpp ops use first plane on write rather than common bitmap plane
  (which is prepared for multiple plane write with raster ops)
- prepare 4bpp allocattr function to handle ANSI 16 color text
- split omrasops_init() function for each bpp
- move struct hwcmap from softc to hwdevconfig to sync palette values
  on initialization
- allow mmap(2) against all available planes

Now we can use ANSI 16 color text console and also can
demonstrate mlterm-fb with color sixel graphics and wallpaper.
XXX: Xserver needs much more work.
2013-12-28 09:17:23 +00:00
tsutsui
612c55f831 Initialize capabilities in struct wsscreen_descr per omrasops settings.
Now REVERSE characters are drawn properly.
2013-12-14 19:51:13 +00:00
tsutsui
b31c3e581b Make omrasops copycols() op work even if columns are not 32 bit aligned.
This means command line editing works properly in any cases.

The bitcopy strategies for 1bpp copycols() op are taken from
recently fixed MI sys/dev/rasops/rasops_bitops.h.
GETBITS() and PUTBITS() m68k asm macro are taken from hp300.

Tested on both 1bpp (on LUNA-II) and 4bpp (on LUNA) framebuffers.
2013-12-14 19:27:41 +00:00
tsutsui
1ff88366ee Fix off by one in copyrows() backward case. 2013-12-02 13:45:40 +00:00
tsutsui
054dd51b2f Tab/space cleanup. 2013-09-23 17:27:09 +00:00
tsutsui
b0074c5d2c Add an initialization function of DS1287A RTC and call it during attach.
It looks the boot firmware doesn't initialize the control registers
of DS1287A (while it resets NVRAM settings) and RTC oscillator is not
started properly after replacement.

Now my LUNA-II can keep RTC properly even after reboot.
2013-07-19 16:42:30 +00:00
tsutsui
55a5a509a2 Properly initialize the palette for while on black even on 1bpp framebuffer.
Preparing for demonstration in Open Source Conference 2013 Kyoto.
2013-07-19 16:35:57 +00:00
tsutsui
16f89144c7 Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
2013-05-14 13:28:01 +00:00
tsutsui
b8ac92c040 Fix offset of DS1287A NVRAM address on LUNA-II. 2013-01-26 15:44:14 +00:00
tsutsui
bcc38be16f Whitespace cleanup. 2013-01-22 15:44:25 +00:00
tsutsui
9df3c44752 struct device * -> device_t, use device_xname() (from chs@) 2012-10-13 06:16:18 +00:00
tsutsui
cf893e7db3 Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4).  This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
2012-07-20 19:31:53 +00:00
tsutsui
1d8ff37891 Fix typo in comment. From OpenBSD/luna88k. 2012-07-16 11:41:05 +00:00
tsutsui
389c932068 Use & not && to mask bits. From OpenBSD/luna88k 2012-07-16 11:31:13 +00:00
tsutsui
9e163b85fb Reorganize IPL for devices. 2011-11-26 04:40:50 +00:00
tsutsui
460c94cc06 Finally complete LUNA-II support, after almost 12 years since
initial import of NetBSD/luna68k.

Note a working LUNA-II machine was found and provided by OMRON guys
after LUNA demonstration at Open Source Conference 2011 Kansai @ Kyoto:
http://mail-index.NetBSD.org/source-changes/2011/07/16/msg024675.html
and this resurrected LUNA-II which runs NetBSD/luna68k -current with Xserver
was also demonstrated on the NetBSD booth at Kansai Open Source 2011:
http://www.NetBSD.org/gallery/events.html#kansai-os-jp-2011

It's really pleasure to meet many OMRON LUNA developers and LUNA users
at the NetBSD booth.  Thank you everyone!


Changes details:

luna68k/luna68k/locore.s
 - don't use 68030 specific pflusha instruction in 68040 initialization path
 - use TBIA() to invalidate TLB instead of 68030's pflusha
   after MMU is turned on (as hp300 does)
   (these two bugs are fatal at early bootstrap)
 - pull loadustp() fixes from hp300/locore.s rev 1.82
   (more flush ops are required in it otherwise causes random coredumps)
 - specify correct %tt1 mask value
   (the mask value means actually bit mask, not transparent range)

luna68k/luna68k/machdep.c
 - use proper delay_divisor for 68040 25MHz LUNA-II

luna68k/luna68k/mainbus.c
 - prepare and use per-model mainbus device lists for mainbus_attach_args

luna68k/conf/GENERIC
luna68k/conf/INSTALL
 - enable options M68040 and FPSP
 - enable secondary spc(4) on LUNA-II

luna68k/conf/Makefile.luna68k
 - include arch/m68k/fpsp/Makefile.inc for FPSP

luna68k/dev/lcd.c
 - promote LUNA-II model on LCD

XXX: old and slow SCSI-1 drives like Hitachi DK312 seems to have
XXX: some problem with spc(4) driver, even on the original LUNA
2011-11-12 13:44:26 +00:00
tsutsui
6a6959f98c Explicitly print uPD7201A name, which is a Z80 SIO like serial chip
with 8086 I/O interfaces.
2011-07-28 10:01:44 +00:00
tsutsui
e571eaa8db KNF, use uintNN_t, tab/space cosmetics etc. 2011-07-27 14:17:54 +00:00
tsutsui
406ab3f078 - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
2011-07-27 11:54:40 +00:00
tsutsui
6f57be1369 Add and return WSKBD_TYPE_LUNA and WSDISPLAY_TYPE_LUNA on WS*_GTYPE ioctls.
XXX: should we still sync <sys/dev/wsconsio.h> and src/sbin/wsconsctl/util.c?
2011-07-21 10:33:17 +00:00
tsutsui
248af3bb25 Changes put for luna68k X.Org mono server demo at OSC 2011 Kansai @ Kyoto:
- sprinkle volatile around register access
 - initialize pallete for WHITE on BLACK text
 - add WSDISPLAYIO_LINEBYTES ioctl(2)
 - fix index count in omsetcmap()
 - make omfbmmap() return cookie for OMFB_FB_RADDR to make
   X.Org wsfb driver work on 1bpp framebuffer memory
    (XXX: should revisit later)
 - make WSDISPLAYIO_GINFO always return 1bpp to avoid pallete mangled
   by X.Org server initialization
    (XXX: should revisit later)
2011-07-21 10:06:59 +00:00
tsutsui
bf2202e183 Revive NetBSD/luna68k.
Even after almost a lost decade since NetBSD/luna68k was
switched to using ELF format by default back in 2001,
actually only one fix (bus.h) is required for a GENERIC kernel itself
to get multiuser login: prompt on a real hardware.  Hurrahhh!!!

Demonstrated with a working Xorg mono server on the NetBSD booth
at Open Source Conference 2011 Kansai @ Kyoto:
 http://www.ospn.jp/osc2011-kyoto/

"Very impressed," commented by Tomoko YOSHIDA,
Program Committee Chair of the Conference,
and some other OMRON guys.

Special Thanks to Tadashi Okamura, for providing
a working SX-9100/DT "LUNA" for this mission.


Changes details:

sys/arch/luna68k/include/bus.h
 - handle stride properly even on multi and region ops for MI spc(4)
 - also fix stride handling of (currently unused) 2 and 4 byte ops

sys/arch/luna68k/conf/Makefile.luna68k
sys/arch/luna68k/conf/kern.ldscript.head
sys/arch/luna68k/conf/kern.ldscript.tail
 - build a faked a.out kernel using elf2aout(8) tool
   and a linker script derived from cats and shark
   for the LUNA firmware that loads a.out binary directly
   via network or from a UNIOS partition on a local disk

sys/arch/luna68k/dev/omrasops.c
sys/arch/luna68k/dev/omron_rfont.h
 - use the original OMRON font derived from 4.4BSD-Lite/luna68k
   rather than gallant19 which is used on Sun workstations
   (XXX omrasops.c should be rewritten to use generic wsfont(4))

distrib/luna68k/*
distrib/utils/sysinst/arch/luna68k/*
etc/etc.luna68k/MAKEDEV.conf
etc/etc.luna68k/Makefile.inc
sys/arch/luna68k/conf/INSTALL
 - build a ramdisk based INSTALL kernel with sysinst(8) for luna68k
 - also build an installation iso image for luna68k

sys/arch/luna68k/conf/GENERIC
 - enable SYSVSHM (and other SYSV*) options for Xorg server

More Xorg changes (which need some more cleanup) and
isiboot.c fixes will come soon.
2011-07-16 15:52:20 +00:00
rmind
2626d57668 Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency.  Remove some unnecessary malloc.h inclusions as well.
2011-04-24 16:26:51 +00:00
pooka
10fe49d72c Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client.  This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached.  However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff.  ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
2010-01-19 22:06:18 +00:00
rmind
3dc24f5a91 Use lwp_getpcb() on m68k ports, clean from struct user usage. 2009-11-23 00:11:42 +00:00
cegger
62cf489d8e kill extra whitespaces
reviewed by tsutsui@
2009-10-26 19:16:54 +00:00