[vbox-dev] PCI config read/write

Robert Zeljko robertzeljko at yahoo.com
Thu May 10 03:28:17 GMT 2007

Attached is the proposed patch to the PCI config read/write callback functions.
New API is called:

    PFNPCICONFIGREAD pfnPciConfigRead,
    PFNPCICONFIGREAD *ppfnPciConfigReadOld,
    PFNPCICONFIGWRITE pfnPciConfigWrite,
    PFNPCICONFIGWRITE *ppfnPciConfigWriteOld

PDMDevHlpPCISetConfigCallbacks API which should be called right after
PDMDevHlpPCISetConfigCallbacks allows user version of read/write PCI config
callbacks to be inserted in place of default callbacks.
PDMDevHlpPCISetConfigCallbacks will optionally return old read/write PCI config
callbacks so user can decide how and when to call default implementations if he
desires to do so.
I've tried to preserve coding style and architecture as much as I
could/understood but I fairly new to the Virtual Box code base.
Let me know if I can be of any further assistance.


-- robert

--- "Knut St. Osmundsen" <bird at innotek.de> wrote:

> Robert Zeljko wrote:
> > I was wondering if there is an interface which can be used to register
> callback
> > read/write functions for the PCI config space.
> > I'm adding a network device to the Virtual Box and need to trap all
> read/writes
> > to the PCI config space.
> > I've solved my problem by "hacking" VBox PCIDevice structure and exposing
> > PCIDEVICEINT structure which is embedded within. This way, after calling
> > PDMDevHlpPCIRegister, I change pfnConfigRead and pfnConfigWrite to point to
> my
> > own handlers. I also had to store original pfnConfigWrite pointer and call
> it
> > later from my write handler to keep everything in sync.
> > Again, I don't know if there is a way to do this without a hack, however,
> this
> > feature is very important one for anyone who wishes to add a new device to
> the
> > Virtual Box.
> Since we haven't yet needed this feature, there is no interface for it 
> yet. So, it has to be added and the callback prototypes has to be 
> exposed by VBox/pci.h. I'm not entirely sure what would makes the most 
> sense here, to adding a pfnPCIRegisterEx or a pfnPCISetConfigCallbacks. 
> Probably the latter since the former might be needed to deal with 
> multiple pci device/functions per device. Anyway, I won't have time to 
> implement this for a while, so a patche would be welcome.
> Kind Regards,
>   knut
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vbox-ose-1.3.8-pci-config-callback-patch.bz2
Type: application/octet-stream
Size: 3180 bytes
Desc: 2045729086-vbox-ose-1.3.8-pci-config-callback-patch.bz2
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20070509/1b22f9aa/attachment.obj>

More information about the vbox-dev mailing list