Home | History | Annotate | Line # | Download | only in tc
pxg.c revision 1.33
      1  1.33   tsutsui /* 	$NetBSD: pxg.c,v 1.33 2009/08/22 17:38:06 tsutsui Exp $	*/
      2   1.1        ad 
      3   1.1        ad /*-
      4   1.3        ad  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
      5   1.1        ad  * All rights reserved.
      6   1.1        ad  *
      7   1.1        ad  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1        ad  * by Andrew Doran.
      9   1.1        ad  *
     10   1.1        ad  * Redistribution and use in source and binary forms, with or without
     11   1.1        ad  * modification, are permitted provided that the following conditions
     12   1.1        ad  * are met:
     13   1.1        ad  * 1. Redistributions of source code must retain the above copyright
     14   1.1        ad  *    notice, this list of conditions and the following disclaimer.
     15   1.1        ad  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1        ad  *    notice, this list of conditions and the following disclaimer in the
     17   1.1        ad  *    documentation and/or other materials provided with the distribution.
     18   1.1        ad  *
     19   1.1        ad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1        ad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1        ad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1        ad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1        ad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1        ad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1        ad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1        ad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1        ad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1        ad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1        ad  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1        ad  */
     31   1.1        ad 
     32   1.1        ad /*
     33   1.1        ad  * Driver for DEC PixelStamp graphics accelerators with onboard SRAM and
     34   1.1        ad  * Intel i860 co-processor (PMAG-D, E and F).
     35   1.1        ad  */
     36   1.7     lukem 
     37   1.7     lukem #include <sys/cdefs.h>
     38  1.33   tsutsui __KERNEL_RCSID(0, "$NetBSD: pxg.c,v 1.33 2009/08/22 17:38:06 tsutsui Exp $");
     39   1.1        ad 
     40   1.1        ad #include <sys/param.h>
     41   1.1        ad #include <sys/systm.h>
     42   1.1        ad #include <sys/device.h>
     43   1.1        ad #include <sys/malloc.h>
     44   1.1        ad #include <sys/callout.h>
     45   1.2        ad #include <sys/proc.h>
     46  1.23      yamt #include <sys/kauth.h>
     47   1.1        ad 
     48   1.1        ad #if defined(pmax)
     49   1.1        ad #include <mips/cpuregs.h>
     50   1.1        ad #elif defined(alpha)
     51   1.1        ad #include <alpha/alpha_cpu.h>
     52   1.1        ad #endif
     53   1.1        ad 
     54   1.1        ad #include <machine/autoconf.h>
     55  1.28        ad #include <sys/cpu.h>
     56  1.28        ad #include <sys/bus.h>
     57   1.1        ad 
     58   1.1        ad #include <dev/cons.h>
     59   1.1        ad 
     60   1.1        ad #include <dev/wscons/wsconsio.h>
     61   1.1        ad #include <dev/wscons/wsdisplayvar.h>
     62   1.1        ad 
     63   1.1        ad #include <dev/ic/bt459reg.h>
     64   1.1        ad 
     65   1.1        ad #include <dev/tc/tcvar.h>
     66   1.1        ad #include <dev/tc/sticreg.h>
     67   1.6        ad #include <dev/tc/sticio.h>
     68   1.1        ad #include <dev/tc/sticvar.h>
     69   1.6        ad #include <dev/tc/pxgvar.h>
     70   1.1        ad 
     71   1.1        ad #define	PXG_STIC_POLL_OFFSET	0x000000	/* STIC DMA poll space */
     72   1.1        ad #define	PXG_STAMP_OFFSET	0x0c0000	/* pixelstamp space on STIC */
     73   1.1        ad #define	PXG_STIC_OFFSET		0x180000	/* STIC registers */
     74   1.3        ad #define	PXG_SRAM_OFFSET		0x200000	/* 128 or 256kB of SRAM */
     75   1.2        ad #define	PXG_HOST_INTR_OFFSET	0x280000	/* i860 host interrupt */
     76   1.2        ad #define	PXG_COPROC_INTR_OFFSET	0x2c0000	/* i860 coprocessor interrupt */
     77   1.1        ad #define	PXG_VDAC_OFFSET		0x300000	/* VDAC registers (bt459) */
     78   1.1        ad #define	PXG_VDAC_RESET_OFFSET	0x340000	/* VDAC reset register */
     79   1.1        ad #define	PXG_ROM_OFFSET		0x380000	/* ROM code */
     80   1.2        ad #define	PXG_I860_START_OFFSET	0x380000	/* i860 start register */
     81   1.2        ad #define	PXG_I860_RESET_OFFSET	0x3c0000	/* i860 stop register */
     82   1.1        ad 
     83  1.32    cegger static void	pxg_attach(device_t, device_t, void *);
     84  1.21   thorpej static int	pxg_intr(void *);
     85  1.32    cegger static int	pxg_match(device_t, cfdata_t, void *);
     86  1.21   thorpej 
     87  1.21   thorpej static void	pxg_init(struct stic_info *);
     88  1.26  christos static int	pxg_ioctl(struct stic_info *, u_long, void *, int, struct lwp *);
     89  1.21   thorpej static uint32_t	*pxg_pbuf_get(struct stic_info *);
     90  1.33   tsutsui static int	pxg_pbuf_post(struct stic_info *, uint32_t *);
     91  1.21   thorpej static int	pxg_probe_planes(struct stic_info *);
     92  1.21   thorpej static int	pxg_probe_sram(struct stic_info *);
     93   1.1        ad 
     94   1.1        ad void	pxg_cnattach(tc_addr_t);
     95   1.1        ad 
     96   1.1        ad struct pxg_softc {
     97   1.1        ad 	struct	stic_info *pxg_si;
     98   1.1        ad };
     99   1.1        ad 
    100  1.30     joerg CFATTACH_DECL_NEW(pxg, sizeof(struct pxg_softc),
    101  1.13   thorpej     pxg_match, pxg_attach, NULL, NULL);
    102   1.1        ad 
    103   1.1        ad static const char *pxg_types[] = {
    104   1.5        ad 	"PMAG-DA ",
    105   1.5        ad 	"PMAG-FA ",
    106   1.5        ad 	"PMAG-FB ",
    107   1.5        ad 	"PMAGB-FA",
    108   1.5        ad 	"PMAGB-FB",
    109   1.1        ad };
    110   1.1        ad 
    111  1.21   thorpej static int
    112  1.30     joerg pxg_match(device_t parent, cfdata_t match, void *aux)
    113   1.1        ad {
    114   1.1        ad 	struct tc_attach_args *ta;
    115   1.1        ad 	int i;
    116   1.1        ad 
    117   1.1        ad 	ta = aux;
    118   1.1        ad 
    119   1.5        ad 	for (i = 0; i < sizeof(pxg_types) / sizeof(pxg_types[0]); i++)
    120   1.1        ad 		if (strncmp(pxg_types[i], ta->ta_modname, TC_ROM_LLEN) == 0)
    121   1.1        ad 			return (1);
    122   1.1        ad 
    123   1.1        ad 	return (0);
    124   1.1        ad }
    125   1.1        ad 
    126  1.21   thorpej static void
    127  1.30     joerg pxg_attach(device_t parent, device_t self, void *aux)
    128   1.1        ad {
    129   1.1        ad 	struct stic_info *si;
    130   1.1        ad 	struct tc_attach_args *ta;
    131   1.1        ad 	struct pxg_softc *pxg;
    132   1.5        ad 	int console;
    133   1.1        ad 
    134  1.20   thorpej 	pxg = device_private(self);
    135   1.1        ad 	ta = (struct tc_attach_args *)aux;
    136   1.1        ad 
    137   1.1        ad 	if (ta->ta_addr == stic_consinfo.si_slotbase) {
    138   1.1        ad 		si = &stic_consinfo;
    139   1.1        ad 		console = 1;
    140   1.1        ad 	} else {
    141  1.16   mycroft 		if (stic_consinfo.si_slotbase == 0)
    142   1.1        ad 			si = &stic_consinfo;
    143   1.1        ad 		else {
    144   1.9   tsutsui 			si = malloc(sizeof(*si), M_DEVBUF, M_NOWAIT|M_ZERO);
    145   1.1        ad 		}
    146   1.1        ad 		si->si_slotbase = ta->ta_addr;
    147   1.1        ad 		pxg_init(si);
    148   1.1        ad 		console = 0;
    149   1.1        ad 	}
    150   1.1        ad 
    151   1.1        ad 	pxg->pxg_si = si;
    152   1.6        ad 	si->si_dv = self;
    153   1.1        ad 	tc_intr_establish(parent, ta->ta_cookie, IPL_TTY, pxg_intr, si);
    154   1.1        ad 
    155   1.5        ad 	printf(": %d plane, %dx%d stamp, %dkB SRAM\n", si->si_depth,
    156   1.5        ad 	    si->si_stampw, si->si_stamph, (int)si->si_buf_size >> 10);
    157   1.1        ad 
    158   1.1        ad 	stic_attach(self, si, console);
    159   1.6        ad 
    160   1.6        ad #ifdef notyet
    161   1.6        ad 	/* Load the co-processor "firmware". */
    162   1.6        ad 	for (i = 0; i < sizeof(pxg_fwsegs) / sizeof(pxg_fwsegs[0]); i++)
    163   1.6        ad 		pxg_load_fwseg(si, &pxg_fwsegs[i]);
    164   1.6        ad 
    165   1.6        ad 	/* Start the i860. */
    166   1.6        ad 	si->si_slotbase[PXG_I860_START_OFFSET >> 2] = 1;
    167   1.6        ad 	tc_wmb();
    168   1.6        ad 	tc_syncbus();
    169   1.6        ad 	DELAY(40000);
    170   1.6        ad #endif
    171   1.1        ad }
    172   1.1        ad 
    173   1.1        ad void
    174   1.1        ad pxg_cnattach(tc_addr_t addr)
    175   1.1        ad {
    176   1.1        ad 	struct stic_info *si;
    177   1.1        ad 
    178   1.1        ad 	si = &stic_consinfo;
    179   1.1        ad 	si->si_slotbase = addr;
    180   1.1        ad 	pxg_init(si);
    181   1.1        ad 	stic_cnattach(si);
    182   1.1        ad }
    183   1.1        ad 
    184  1.21   thorpej static void
    185   1.1        ad pxg_init(struct stic_info *si)
    186   1.1        ad {
    187  1.33   tsutsui 	volatile uint32_t *slot;
    188  1.27      yamt 	char *kva;
    189   1.1        ad 
    190  1.26  christos 	kva = (void *)si->si_slotbase;
    191   1.1        ad 
    192  1.33   tsutsui 	si->si_vdac = (uint32_t *)(kva + PXG_VDAC_OFFSET);
    193  1.33   tsutsui 	si->si_vdac_reset = (uint32_t *)(kva + PXG_VDAC_RESET_OFFSET);
    194   1.1        ad 	si->si_stic = (volatile struct stic_regs *)(kva + PXG_STIC_OFFSET);
    195  1.33   tsutsui 	si->si_stamp = (uint32_t *)(kva + PXG_STAMP_OFFSET);
    196  1.33   tsutsui 	si->si_buf = (uint32_t *)(kva + PXG_SRAM_OFFSET);
    197   1.4        ad 	si->si_buf_phys = STIC_KSEG_TO_PHYS(si->si_buf);
    198   1.1        ad 	si->si_buf_size = pxg_probe_sram(si);
    199   1.1        ad 	si->si_disptype = WSDISPLAY_TYPE_PXG;
    200   1.6        ad 	si->si_sxc = (volatile struct stic_xcomm *)si->si_buf;
    201   1.1        ad 
    202   1.1        ad 	si->si_pbuf_get = pxg_pbuf_get;
    203   1.1        ad 	si->si_pbuf_post = pxg_pbuf_post;
    204   1.2        ad 	si->si_ioctl = pxg_ioctl;
    205   1.1        ad 
    206   1.1        ad 	/* Disable the co-processor. */
    207  1.33   tsutsui 	slot = (volatile uint32_t *)kva;
    208   1.2        ad 	slot[PXG_I860_RESET_OFFSET >> 2] = 0;
    209   1.4        ad 	tc_wmb();
    210   1.1        ad 	slot[PXG_HOST_INTR_OFFSET >> 2] = 0;
    211   1.4        ad 	tc_wmb();
    212   1.1        ad 	tc_syncbus();
    213   1.1        ad 	DELAY(40000);
    214   1.1        ad 
    215   1.1        ad 	/* XXX Check for a second PixelStamp. */
    216   1.1        ad 	if (((si->si_stic->sr_modcl & 0x600) >> 9) > 1)
    217   1.1        ad 		si->si_depth = 24;
    218   1.1        ad 	else
    219   1.1        ad 		si->si_depth = pxg_probe_planes(si);
    220   1.1        ad 
    221   1.1        ad 	stic_init(si);
    222   1.1        ad }
    223   1.1        ad 
    224  1.21   thorpej static int
    225   1.1        ad pxg_probe_sram(struct stic_info *si)
    226   1.1        ad {
    227  1.33   tsutsui 	volatile uint32_t *a, *b;
    228   1.1        ad 
    229  1.33   tsutsui 	a = (volatile uint32_t *)si->si_slotbase + (PXG_SRAM_OFFSET >> 2);
    230   1.4        ad 	b = a + (0x20000 >> 2);
    231   1.1        ad 	*a = 4321;
    232   1.1        ad 	*b = 1234;
    233   1.4        ad 	tc_mb();
    234   1.1        ad 	return ((*a == *b) ? 0x20000 : 0x40000);
    235   1.1        ad }
    236   1.1        ad 
    237  1.21   thorpej static int
    238   1.1        ad pxg_probe_planes(struct stic_info *si)
    239   1.1        ad {
    240  1.33   tsutsui 	volatile uint32_t *vdac;
    241   1.1        ad 	int id;
    242   1.1        ad 
    243   1.1        ad 	/*
    244   1.1        ad 	 * For the visible framebuffer (# 0), we can cheat and use the VDAC
    245   1.1        ad 	 * ID.
    246   1.1        ad 	 */
    247   1.1        ad 	vdac = si->si_vdac;
    248  1.18     perry 	vdac[BT459_REG_ADDR_LOW] = (BT459_IREG_ID & 0xff) |
    249   1.1        ad 	    ((BT459_IREG_ID & 0xff) << 8) | ((BT459_IREG_ID & 0xff) << 16);
    250  1.18     perry 	vdac[BT459_REG_ADDR_HIGH] = ((BT459_IREG_ID & 0xff00) >> 8) |
    251   1.1        ad 	    (BT459_IREG_ID & 0xff00) | ((BT459_IREG_ID & 0xff00) << 8);
    252   1.4        ad 	tc_mb();
    253   1.1        ad 	id = vdac[BT459_REG_IREG_DATA] & 0x00ffffff;
    254   1.1        ad 
    255   1.1        ad 	/* 3 VDACs */
    256   1.1        ad 	if (id == 0x004a4a4a)
    257   1.1        ad 		return (24);
    258   1.1        ad 
    259   1.1        ad 	/* 1 VDAC */
    260   1.1        ad 	if ((id & 0xff0000) == 0x4a0000 || (id & 0x00ff00) == 0x004a00 ||
    261   1.1        ad 	    (id & 0x0000ff) == 0x00004a)
    262   1.1        ad 		return (8);
    263   1.1        ad 
    264   1.1        ad 	/* XXX Assume 8 planes. */
    265   1.1        ad 	printf("pxg_probe_planes: invalid VDAC ID %x\n", id);
    266   1.1        ad 	return (8);
    267   1.1        ad }
    268   1.1        ad 
    269  1.21   thorpej static int
    270   1.1        ad pxg_intr(void *cookie)
    271   1.1        ad {
    272   1.6        ad #ifdef notyet
    273   1.1        ad 	struct stic_info *si;
    274   1.1        ad 	volatile struct stic_regs *sr;
    275  1.33   tsutsui 	volatile uint32_t *hi;
    276  1.33   tsutsui 	uint32_t state;
    277   1.1        ad 	int it;
    278   1.1        ad 
    279   1.1        ad 	si = cookie;
    280   1.1        ad 	sr = si->si_stic;
    281   1.1        ad 	state = sr->sr_ipdvint;
    282  1.33   tsutsui 	hi = (volatile uint32_t *)si->si_slotbase +
    283  1.33   tsutsui 	    (PXG_HOST_INTR_OFFSET / sizeof(uint32_t));
    284   1.1        ad 
    285   1.1        ad 	/* Clear the interrupt condition */
    286   1.1        ad 	it = hi[0] & 15;
    287   1.1        ad 	hi[0] = 0;
    288   1.1        ad 	tc_wmb();
    289   1.1        ad 	hi[2] = 0;
    290   1.1        ad 	tc_wmb();
    291   1.1        ad 
    292   1.6        ad 	switch (it) {
    293   1.6        ad 	case 3:
    294   1.6        ad 		sr->sr_ipdvint = STIC_INT_V_WE | STIC_INT_V_EN;
    295   1.1        ad 		tc_wmb();
    296   1.1        ad 		stic_flush(si);
    297   1.6        ad 		break;
    298   1.1        ad 	}
    299   1.6        ad #else
    300   1.6        ad 	printf("pxg_intr: how did this happen?\n");
    301   1.6        ad #endif
    302   1.1        ad 	return (1);
    303   1.1        ad }
    304   1.1        ad 
    305  1.21   thorpej static uint32_t *
    306   1.1        ad pxg_pbuf_get(struct stic_info *si)
    307   1.1        ad {
    308   1.6        ad 	u_long off;
    309   1.1        ad 
    310   1.1        ad 	si->si_pbuf_select ^= STIC_PACKET_SIZE;
    311   1.6        ad 	off = si->si_pbuf_select + STIC_XCOMM_SIZE;
    312  1.33   tsutsui 	return ((uint32_t *)((char *)si->si_buf + off));
    313   1.1        ad }
    314   1.1        ad 
    315  1.21   thorpej static int
    316  1.33   tsutsui pxg_pbuf_post(struct stic_info *si, uint32_t *buf)
    317   1.1        ad {
    318  1.33   tsutsui 	volatile uint32_t *poll, junk;
    319   1.4        ad 	volatile struct stic_regs *sr;
    320   1.1        ad 	u_long v;
    321   1.1        ad 	int c;
    322   1.1        ad 
    323   1.4        ad 	sr = si->si_stic;
    324   1.4        ad 
    325   1.1        ad 	/* Get address of poll register for this buffer. */
    326   1.1        ad 	v = ((u_long)buf - (u_long)si->si_buf) >> 9;
    327  1.33   tsutsui 	poll = (volatile uint32_t *)((char *)si->si_slotbase + v);
    328   1.1        ad 
    329   1.1        ad 	/*
    330   1.1        ad 	 * Read the poll register and make sure the stamp wants to accept
    331   1.1        ad 	 * our packet.  This read will initiate the DMA.  Don't wait for
    332   1.1        ad 	 * ever, just in case something's wrong.
    333   1.1        ad 	 */
    334   1.4        ad 	tc_mb();
    335   1.1        ad 
    336   1.1        ad 	for (c = STAMP_RETRIES; c != 0; c--) {
    337   1.4        ad 		if ((sr->sr_ipdvint & STIC_INT_P) != 0) {
    338   1.6        ad 			sr->sr_ipdvint = STIC_INT_P_WE;
    339   1.4        ad 			tc_wmb();
    340   1.4        ad 			junk = *poll;
    341   1.3        ad 			return (0);
    342   1.4        ad 		}
    343   1.1        ad 		DELAY(STAMP_DELAY);
    344   1.1        ad 	}
    345   1.1        ad 
    346   1.1        ad 	/* STIC has lost the plot, punish it. */
    347   1.1        ad 	stic_reset(si);
    348   1.1        ad 	return (-1);
    349   1.2        ad }
    350   1.2        ad 
    351  1.21   thorpej static int
    352  1.26  christos pxg_ioctl(struct stic_info *si, u_long cmd, void *data, int flag,
    353  1.19  christos 	  struct lwp *l)
    354   1.2        ad {
    355   1.6        ad 	struct stic_xinfo *sxi;
    356  1.33   tsutsui 	volatile uint32_t *ptr = NULL;
    357   1.6        ad 	int rv, s;
    358   1.2        ad 
    359   1.6        ad 	switch (cmd) {
    360   1.6        ad 	case STICIO_START860:
    361   1.6        ad 	case STICIO_RESET860:
    362  1.24        ad 		if ((rv = kauth_authorize_generic(l->l_cred,
    363  1.25      elad 		    KAUTH_GENERIC_ISSUSER, NULL)) != 0)
    364   1.2        ad 			return (rv);
    365   1.6        ad 		if (si->si_dispmode != WSDISPLAYIO_MODE_MAPPED)
    366   1.6        ad 			return (EBUSY);
    367  1.33   tsutsui 		ptr = (volatile uint32_t *)si->si_slotbase;
    368   1.6        ad 		break;
    369   1.6        ad 	}
    370   1.6        ad 
    371   1.6        ad 	switch (cmd) {
    372   1.6        ad 	case STICIO_START860:
    373   1.6        ad 		s = spltty();
    374   1.6        ad 		ptr[PXG_I860_START_OFFSET >> 2] = 1;
    375   1.4        ad 		tc_wmb();
    376   1.6        ad 		splx(s);
    377   1.2        ad 		rv = 0;
    378   1.6        ad 		break;
    379   1.6        ad 
    380   1.6        ad 	case STICIO_RESET860:
    381   1.6        ad 		s = spltty();
    382   1.6        ad 		ptr[PXG_I860_RESET_OFFSET >> 2] = 0;
    383   1.6        ad 		tc_wmb();
    384   1.6        ad 		splx(s);
    385   1.6        ad 		rv = 0;
    386   1.6        ad 		break;
    387   1.6        ad 
    388   1.6        ad 	case STICIO_GXINFO:
    389   1.6        ad 		sxi = (struct stic_xinfo *)data;
    390   1.6        ad 		sxi->sxi_unit = si->si_unit;
    391   1.6        ad 		sxi->sxi_stampw = si->si_stampw;
    392   1.6        ad 		sxi->sxi_stamph = si->si_stamph;
    393   1.6        ad 		sxi->sxi_buf_size = si->si_buf_size;
    394   1.6        ad 		sxi->sxi_buf_phys = 0;
    395   1.6        ad 		sxi->sxi_buf_pktoff = STIC_XCOMM_SIZE;
    396   1.6        ad 		sxi->sxi_buf_pktcnt = 2;
    397   1.6        ad 		sxi->sxi_buf_imgoff = STIC_XCOMM_SIZE + STIC_PACKET_SIZE * 2;
    398   1.6        ad 		rv = 0;
    399   1.6        ad 		break;
    400   1.6        ad 
    401   1.6        ad 	default:
    402  1.10    atatat 		rv = EPASSTHROUGH;
    403   1.6        ad 		break;
    404   1.6        ad 	}
    405   1.2        ad 
    406   1.2        ad 	return (rv);
    407   1.1        ad }
    408   1.6        ad 
    409   1.6        ad #ifdef notyet
    410   1.6        ad void
    411   1.6        ad pxg_load_fwseg(struct stic_info *si, struct pxg_fwseg *pfs)
    412   1.6        ad {
    413  1.33   tsutsui 	const uint32_t *src;
    414  1.33   tsutsui 	uint32_t *dst;
    415   1.6        ad 	u_int left, i;
    416   1.6        ad 
    417  1.33   tsutsui 	dst = (uint32_t *)((void *)si->si_buf + pfs->pfs_addr);
    418   1.6        ad 	src = pfs->pfs_data;
    419   1.6        ad 
    420   1.6        ad 	for (left = pfs->pfs_compsize; left != 0; left -= 4) {
    421   1.6        ad 		if (src[0] == PXGFW_RLE_MAGIC) {
    422   1.6        ad 			for (i = src[2]; i != 0; i--)
    423   1.6        ad 				*dst++ = src[1];
    424   1.6        ad 			src += 3;
    425   1.6        ad 		} else {
    426   1.6        ad 			*dst++ = src[0];
    427   1.6        ad 			src++;
    428   1.6        ad 		}
    429   1.6        ad 	}
    430   1.6        ad 
    431   1.6        ad 	if (src == NULL)
    432   1.6        ad 		memset(dst, 0, pfs->pfs_realsize);
    433   1.6        ad }
    434   1.6        ad #endif
    435