This is a discussion on Re: [9fans] The late upamalloc - Plan9 ; > Okay, I've been taking a crack at the broadcom driver > that's been lying around. It's pretty old and used > the upamalloc call. But upamalloc is now gone and > I don't seem to be able to find ...
> Okay, I've been taking a crack at the broadcom driver
> that's been lying around. It's pretty old and used
> the upamalloc call. But upamalloc is now gone and
> I don't seem to be able to find the right way to
> replace it. After looking at other drivers and at
> the old upamalloc code on sourcesdump, I've tried
> several way to replace it, but most end up in a panic.
> The original code (edited to the relevant lines)
> looked like:
> port = upamalloc(bar & ~0x0F, p->mem.size, 0);
> ctlr->port = port;
> ctlr->nic = KADDR(ctlr->port);
> My most recent attempt replaced the upamalloc call
> upareserve(bar & ~0x0F, p->mem.size);
> pdbmap(MACH(0)->pdb, bar & ~0x0F, 0, p->mem.size);
> port = bar & ~0x0F;
> There is currently a upaalloc call, and the comment
> to it seems to imply that vmap should be used either
> in conjunction with upaalloc or by it self. I've
> tried a few permutations of that with no luck.
> If someone knows off the top of their head the right
> way to replace an old upamalloc call, it would save
> me some time, and I could get on to seeing if I can
> manage to get the controller to work.
upamalloc should be replaced with vmap. but be careful.
the address returned is a virtual kernel address. so anyone
assuming that the address returned is going to be a physical
address is going to loose. i think you wish
ctlr->nic = vmap(p->mem[Abar].bar & ~0xf, p->mem.size);
ctlr->port = PCIWADDR(ctlr->nic);