/* $NetBSD: ite_sti.c,v 1.6 2025/05/29 14:50:45 tsutsui Exp $ */
/* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */
/*
* Copyright (c) 2006, 2011, Miodrag Vallat
* Copyright (c) 2000-2003 Michael Shalayeff
* 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.
*
* 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 OR HIS RELATIVES 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 MIND, 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.
*/
/*
* sti-specific data not available in the ite_data structure.
* Since we will only configure one sti display, it is ok to use a global.
*/
static struct {
uint32_t codeptr[STI_CODECNT];
uint8_t *code;
uint32_t fontbase;
u_int firstchar, lastchar;
struct sti_cfg cfg;
struct sti_ecfg ecfg;
} sti;
/*
* Initialize the sti device for ite's needs.
* We don't bother to check for failures since
* - we are in tight space already
* - since romputchar() does not work with sti devices, there is no way we
* can report errors (although we could switch to serial...)
*/
static void
sti_iteinit_common(struct ite_data *ip)
{
int i;
size_t codesize, memsize;
uint8_t *va, *code;
u_int addr, eaddr, reglist, tmp;
struct sti_inqconfout cfg;
struct sti_einqconfout ecfg;
memset(&sti, 0, sizeof sti);
va = (uint8_t *)ip->fbbase;
/*
* Read the microcode.
*/
for (i = 0; i < STI_CODECNT; i++)
sti.codeptr[i] =
parseword1(va, (STI_CODEBASE_M68K << 2) + i * 0x10);