view arch/io.c @ 14:c75be274ce23

Now functioning arch code
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 07 Apr 2011 23:29:10 -0400
parents 40af39d064fa
children 3d69c66b2610
line wrap: on
line source

#include "channel.h"
#include <die.h>

u32 find_dev(int devnum)
{
	struct schib schib;
	u32 sch;

	for(sch=0x10000; sch<=0x1ffff; sch++) {
		if (store_sch(sch, &schib))
			continue;

		if (!schib.pmcw.v)
			continue;

		if (schib.pmcw.dev_num != devnum)
			continue;

		if (!schib.pmcw.e) {
			schib.pmcw.e = 1;

			if (modify_sch(sch, &schib))
				continue;
		}

		return sch;
	}

	return 0;
}

extern void IOINT(void);

void init_io_int()
{
	struct psw psw;

	// set up the IO interrupt handler
	psw.ea  = 1;
	psw.ba  = 1;
	psw.ptr = (u64) &IOINT;

	__builtin_memcpy(((void*) 0x1f0), &psw, sizeof(struct psw));
}