Port-ofppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Current EFIKA status?



On Sat, 06 Oct 2007 12:37:22 +0100
Matt Sealey <matt%genesi-usa.com@localhost> wrote:

> too much "we must poke the hardware directly".
Seconded. When available NetBSD should use the firmware functions.

> If you use
> the device-tree to probe PCI and the RTAS functions to access PCI
> configuration space, you needn't deal with the host controller at all.
You don't even need RTAS for this. You can proble the devices by walking
the device tree. Configuration space is accessible by the "config-l@"
and "config-l!" methods of the PCI device node. This are the
pci_conf_read(9) and pci_conf_write(9) functions I wrote for RS/6000.
They worked on the Pegasos too when Jorge tested my hacks.

pc_conf_read(pci_chipset_tag_t pct, pcitag_t tag, int reg)
{
        pcireg_t val;

        tag &= OFW_PCI_PHYS_HI_BUSMASK | OFW_PCI_PHYS_HI_DEVICEMASK |
            OFW_PCI_PHYS_HI_FUNCTIONMASK;
        tag |= reg & OFW_PCI_PHYS_HI_REGISTERMASK;
        if (OF_call_method("config-l@", pct->pc_ihandle, 1, 1, tag, &val) < 0)
                return (pcireg_t) -1;
        return val;
}


void
pc_conf_write(pci_chipset_tag_t pct, pcitag_t tag, int reg, pcireg_t val)
{
        tag &= OFW_PCI_PHYS_HI_BUSMASK | OFW_PCI_PHYS_HI_DEVICEMASK |
            OFW_PCI_PHYS_HI_FUNCTIONMASK;
        tag |= reg & OFW_PCI_PHYS_HI_REGISTERMASK;
        OF_call_method("config-l!", pct->pc_ihandle, 2, 0, val, tag);
}
-- 


tschüß,
       Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/




Home | Main Index | Thread Index | Old Index