/*
* 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();
}
|