/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran.
*
* 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 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.
*/
/*
* Driver for DEC PixelStamp graphics accelerators with onboard SRAM and
* Intel i860 co-processor (PMAG-D, E and F).
*/
#ifdef notyet
/* Load the co-processor "firmware". */
for (i = 0; i < sizeof(pxg_fwsegs) / sizeof(pxg_fwsegs[0]); i++)
pxg_load_fwseg(si, &pxg_fwsegs[i]);
static int
pxg_pbuf_post(struct stic_info *si, uint32_t *buf)
{
volatile uint32_t *poll, junk;
volatile struct stic_regs *sr;
u_long v;
int c;
sr = si->si_stic;
/* Get address of poll register for this buffer. */
v = ((u_long)buf - (u_long)si->si_buf) >> 9;
poll = (volatile uint32_t *)((char *)si->si_slotbase + v);
/*
* Read the poll register and make sure the stamp wants to accept
* our packet. This read will initiate the DMA. Don't wait for
* ever, just in case something's wrong.
*/
tc_mb();
for (c = STAMP_RETRIES; c != 0; c--) {
if ((sr->sr_ipdvint & STIC_INT_P) != 0) {
sr->sr_ipdvint = STIC_INT_P_WE;
tc_wmb();
junk = *poll;
__USE(junk);
return (0);
}
DELAY(STAMP_DELAY);
}
/* STIC has lost the plot, punish it. */
stic_reset(si);
return (-1);
}
static int
pxg_ioctl(struct stic_info *si, u_long cmd, void *data, int flag,
struct lwp *l)
{
struct stic_xinfo *sxi;
volatile uint32_t *ptr = NULL;
int rv, s;
switch (cmd) {
case STICIO_START860:
case STICIO_RESET860:
if ((rv = kauth_authorize_machdep(l->l_cred,
KAUTH_MACHDEP_PXG, KAUTH_ARG(cmd == STICIO_START860 ? 1 : 0),
NULL, NULL, NULL)) != 0)
return (rv);
if (si->si_dispmode != WSDISPLAYIO_MODE_MAPPED)
return (EBUSY);
ptr = (volatile uint32_t *)si->si_slotbase;
break;
}
switch (cmd) {
case STICIO_START860:
s = spltty();
ptr[PXG_I860_START_OFFSET >> 2] = 1;
tc_wmb();
splx(s);
rv = 0;
break;
case STICIO_RESET860:
s = spltty();
ptr[PXG_I860_RESET_OFFSET >> 2] = 0;
tc_wmb();
splx(s);
rv = 0;
break;