Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/lab/ocptap/kern/ocptap.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * OCP-TAP time card driver
 */
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"../port/error.h"
#include	"io.h"


static void
addmemseg(char *name, ulong pa, ulong size)
{
	Physseg seg;

	memset(&seg, 0, sizeof seg);
	seg.attr = SG_PHYSICAL;
	seg.name = name;
	seg.pa = pa;
	seg.size = size;
	addphysseg(&seg);
}

static void
reset(void)
{
	Pcidev *p;

	p = pcimatch(0, 0x1ad7, 0xa000);
	if(p == nil) {
		print("ocptap: device not found\n");
		return;
	}
	if(p->mem[0].bar == 0){
		/* unpatched pci.c:/pcilscan */
		print("ocp timecard driver needs a patch to pci.c:/pcilscan (add case 0xFF)\n");
		return;
	}
	addmemseg("ocptap.mmio", p->mem[0].bar & ~0x0F, p->mem[0].size);
	print("ocptap: timecard detected:");
	pcihinv(p);
	
}


void
ocptaplink(void)
{
	reset();
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.