/* $NetBSD: macfb.c,v 1.23 2021/08/07 16:18:57 thorpej Exp $ */
/*
* Copyright (c) 1998 Matt DeBergalis
* All rights reserved.
*
* 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 Matt DeBergalis
* 4. 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.
*/
static int
macfb_is_console(paddr_t addr)
{
if (addr != macfb_consaddr &&
(addr >= 0xf9000000 && addr <= 0xfeffffff)) {
/*
* This is in the NuBus standard slot space range, so we
* may well have to look at 0xFssxxxxx, too. Mask off the
* slot number and duplicate it in bits 20-23, per IM:V
* pp 459, 463, and IM:VI ch 30 p 17.
* Note: this is an ugly hack and I wish I knew what
* to do about it. -- sr
*/
addr = (paddr_t)(((u_long)addr & 0xff0fffff) |
(((u_long)addr & 0x0f000000) >> 4));
}
return ((mac68k_machine.serial_console & 0x03) == 0
&& (addr == macfb_consaddr));
}
void
macfb_clear(struct macfb_devconfig *dc)
{
int i, rows;
/* clear the display */
rows = dc->dc_ht;
for (i = 0; rows-- > 0; i += dc->dc_rowbytes)
memset((u_char *)dc->dc_vaddr + dc->dc_offset + i,
0, dc->dc_rowbytes);
}
case WSDISPLAYIO_GCURMAX:
case WSDISPLAYIO_GCURPOS:
case WSDISPLAYIO_GCURSOR:
case WSDISPLAYIO_GETCMAP:
case WSDISPLAYIO_GVIDEO:
case WSDISPLAYIO_PUTCMAP:
case WSDISPLAYIO_SCURPOS:
case WSDISPLAYIO_SCURSOR:
case WSDISPLAYIO_SVIDEO:
/* NONE of these operations are supported. */
return EPASSTHROUGH;
}
int
macfb_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
int *curxp, int *curyp, long *defattrp)
{
struct macfb_softc *sc = v;
long defattr;
if (sc->nscreens > 0)
return (ENOMEM);
*cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
*curxp = 0;
*curyp = 0;
rcons_allocattr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
*defattrp = defattr;
sc->nscreens++;
return (0);
}