Beispiel #1
0
void
machdep(void)
{
    pdc_init();
#ifdef notyet
    debug_init();
#endif
    cninit();

#ifdef PDCDEBUG
    if (debug) {
        int i;

        printf("SSTOR:\n");
        printf("pri_boot=");
        DEVPATH_PRINT(&sstor.ss_pri_boot);
        printf("alt_boot=");
        DEVPATH_PRINT(&sstor.ss_alt_boot);
        printf("console =");
        DEVPATH_PRINT(&sstor.ss_console);
        printf("keyboard=");
        DEVPATH_PRINT(&sstor.ss_keyboard);
        printf("mem=%d, fn=%s, osver=%d\nos={",
               sstor.ss_fast_size, sstor.ss_filenames,
               sstor.ss_os_version);
        for (i = 0; i < sizeof(sstor.ss_os); i++)
            printf ("%x%c", sstor.ss_os[i], (i%8)? ',' : '\n');

        printf("}\nPAGE0:\n");
        printf("ivec=%x, pf=%p[%u], toc=%p[%u], rndz=%p, clk/10ms=%u\n",
               PAGE0->ivec_special, PAGE0->ivec_mempf,
               PAGE0->ivec_mempflen, PAGE0->ivec_toc,
               PAGE0->ivec_toclen, PAGE0->ivec_rendz,
               PAGE0->mem_10msec);
        printf ("mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
                "cpu_hpa=%x, pdc=%p, imm_hpa=%p[%u,%u], soft=%u\n",
                PAGE0->memc_cont, PAGE0->memc_phsize, PAGE0->memc_adsize,
                PAGE0->memc_resv, PAGE0->mem_free, PAGE0->mem_hpa,
                PAGE0->mem_pdc, PAGE0->imm_hpa, PAGE0->imm_spa_size,
                PAGE0->imm_max_mem, PAGE0->imm_soft_boot);

        printf("console:  ");
        PZDEV_PRINT(&PAGE0->mem_cons);
        printf("boot:     ");
        PZDEV_PRINT(&PAGE0->mem_boot);
        printf("keyboard: ");
        PZDEV_PRINT(&PAGE0->mem_kbd);
    }
#endif
}
Beispiel #2
0
void
machdep()
{
	pdc_init();
#ifdef notyet
	debug_init();
#endif
	cninit();

#ifdef PDCDEBUG
	if (debug) {
		printf("SSTOR:\n");
		printf("pri_boot=");	DEVPATH_PRINT(&sstor.ss_pri_boot);
		printf("alt_boot=");	DEVPATH_PRINT(&sstor.ss_alt_boot);
		printf("console =");	DEVPATH_PRINT(&sstor.ss_console);
		printf("keyboard=");	DEVPATH_PRINT(&sstor.ss_keyboard);
		printf("mem=%d, fn=%s, osver=%d\n"
		       "os={%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\n"
		           "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x}\n",
		       sstor.ss_fast_size, sstor.ss_filenames,
		       sstor.ss_os_version,
		       sstor.ss_os[0], sstor.ss_os[1], sstor.ss_os[2],
		       sstor.ss_os[3], sstor.ss_os[4], sstor.ss_os[5],
		       sstor.ss_os[6], sstor.ss_os[7], sstor.ss_os[8],
		       sstor.ss_os[9], sstor.ss_os[10], sstor.ss_os[11],
		       sstor.ss_os[12], sstor.ss_os[13], sstor.ss_os[14],
		       sstor.ss_os[15], sstor.ss_os[16], sstor.ss_os[17],
		       sstor.ss_os[18], sstor.ss_os[19], sstor.ss_os[20],
		       sstor.ss_os[21]);

		printf("PAGE0:\n");
		printf("ivec=%x, pf=%p[%u], toc=%p[%u], rendz=%p\n"
		       "mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
		       "cpu_hpa=%p, pdc=%p, imm_hpa=%p[%u,%u]\n"
		       "soft=%u, tic/10ms=%u\n",
		       PAGE0->ivec_special, PAGE0->ivec_mempf,
		       PAGE0->ivec_mempflen, PAGE0->ivec_toc,
		       PAGE0->ivec_toclen, PAGE0->ivec_rendz,
		       PAGE0->memc_cont, PAGE0->memc_phsize, PAGE0->memc_adsize,
		       PAGE0->memc_resv, PAGE0->mem_free, PAGE0->mem_hpa,
		       PAGE0->mem_pdc, PAGE0->imm_hpa, PAGE0->imm_spa_size,
		       PAGE0->imm_max_mem, PAGE0->imm_soft_boot,
		       PAGE0->mem_10msec);
		printf("console:  ");	PZDEV_PRINT(&PAGE0->mem_cons);
		printf("boot:     ");	PZDEV_PRINT(&PAGE0->mem_boot);
		printf("keyboard: ");	PZDEV_PRINT(&PAGE0->mem_kbd);
	}
#endif
}
Beispiel #3
0
/*
 * Generic READ/WRITE through IODC.  Takes pointer to PDC device
 * information, returns (positive) number of bytes actually read or
 * the (negative) error condition, or zero if at "EOF".
 */
int
iodcstrategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf,
    size_t *rsize)
{
	struct hppa_dev *dp = devdata;
	struct pz_device *pzdev = dp->pz_dev;
	int offset, xfer, ret;

#ifdef PDCDEBUG
	if (debug)
		printf("iodcstrategy(%p, %s, %u, %u, %p, %p)\n", devdata,
		       rw==F_READ?"READ":"WRITE", (unsigned) blk, (unsigned) size, buf, rsize);

	if (debug > 1)
		PZDEV_PRINT(pzdev);
#endif

	blk <<= DEV_BSHIFT;
	blk += dp->part_off;
	if ((pzdev->pz_class & PCL_CLASS_MASK) == PCL_SEQU) {
		/* rewind and re-read to seek */
		if (blk < dp->last_blk) {
#ifdef PDCDEBUG
			if (debug)
				printf("iodc: rewind ");
#endif
			twiddle();
			if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
				IODC_IO_READ, pzdev->pz_spa, pzdev->pz_layers,
				pdcbuf, 0, dp->buf, 0, 0)) < 0) {
#ifdef DEBUG
				if (debug)
					printf("IODC_IO: %d\n", ret);
#endif
				return (EIO);
			} else {
				dp->last_blk = 0;
				dp->last_read = 0;
			}
		}

#ifdef PDCDEBUG
		if (debug)
			printf("seek %d ", (int) dp->last_blk);
#endif
		for (; (dp->last_blk + dp->last_read) <= blk;
		     dp->last_read = ret) {
			twiddle();
			dp->last_blk += dp->last_read;
			if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
				IODC_IO_READ, pzdev->pz_spa, pzdev->pz_layers,
				pdcbuf, (unsigned) dp->last_blk, dp->buf, IODC_MAXIOSIZ,
				IODC_MAXIOSIZ)) < 0) {
#ifdef DEBUG
				if (debug)
					printf("IODC_IO: %d\n", ret);
#endif
				return (EIO);
			}
			if ((ret = pdcbuf[0]) == 0)
				break;
#ifdef PDCDEBUG
			if (debug)
				printf("-");
#endif
		}
#ifdef PDCDEBUG
		if (debug)
			printf("> %d[%d]\n", (int)dp->last_blk, (int)dp->last_read);
#endif
	}

	xfer = 0;
	/* see if we can scratch anything from buffer */
	if (dp->last_blk <= blk && (dp->last_blk + dp->last_read) > blk) {
		twiddle();
		offset = blk - dp->last_blk;
		xfer = min(dp->last_read - offset, size);
		size -= xfer;
		blk += xfer;
#ifdef PDCDEBUG
		if (debug)
			printf("off=%d,xfer=%d,size=%d,blk=%d\n",
			       offset, xfer, (int)size, (int)blk);
#endif
		bcopy(dp->buf + offset, buf, xfer);
		buf = (char *) buf + xfer;
	}

	/*
	 * double buffer it all the time, to cache
	 */
	for (; size;
	    size -= ret, buf = (char *) buf + ret, blk += ret, xfer += ret) {
		twiddle();
		offset = blk & IOPGOFSET;
		if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
				(rw == F_READ? IODC_IO_READ: IODC_IO_WRITE),
				pzdev->pz_spa, pzdev->pz_layers, pdcbuf,
				(int)blk - offset, dp->buf, IODC_MAXIOSIZ,
				IODC_MAXIOSIZ)) < 0) {
#ifdef DEBUG
			if (debug)
				printf("iodc_read(%d,%d): %d\n",
					(int)blk - offset, IODC_MAXIOSIZ, ret);
#endif
			if (xfer)
				break;
			else
				return (EIO);
		}
		if ((ret = pdcbuf[0]) <= 0)
			break;
		dp->last_blk = blk - offset;
		dp->last_read = ret;
		if ((ret -= offset) > size)
			ret = size;
		bcopy(dp->buf + offset, buf, ret);
#ifdef PDCDEBUG
		if (debug)
			printf("read %d(%d,%d)@%x ", ret,
			       (int)dp->last_blk, (int)dp->last_read, (u_int)buf);
#endif
	    }

#ifdef PDCDEBUG
	if (debug)
		printf("\n");
#endif

	if (rsize)
		*rsize = xfer;
	return (0);
}