Date: Tue, 26 Aug 2014 14:42:55 +0000
   From: Emmanuel Dreyfus <m...@netbsd.org>

   On Tue, Aug 26, 2014 at 10:25:52AM -0400, Christos Zoulas wrote:
   > I would probably extend pcictl with cfgread and cfgwrite commands.

   Sure, once it works I can do that, but a first attempt just
   ets EINVAL, any idea what can be wrong?
   ...
           pbcr.bus = 5;
           pbcr.device = 0;
           pbcr.function = 0;
           pbcr.cfgreg.reg = 0xe6b;
           pbcr.cfgreg.val = 0x2e;

Can't do unaligned register reads/writes.  If you need other than
32-bit access, you need to select subwords for reads or do R/M/W for
writes.

   Inside the kernel, the only EINVAL is here:
               if (bdfr->bus > 255 || bdfr->device >= sc->sc_maxndevs ||
                       bdfr->function > 7)
                           return EINVAL;

Old kernel sources?  I added a check recently for 32-bit alignment --
without which you'd hit a kassert or hardware trap shortly afterward.

Reply via email to