On Sun, Feb 13, 2011 at 06:26:32PM -0800, Stefan Reinauer wrote:
On Sat, Feb 12, 2011 at 2:30 PM, Kevin O'Connor kevin@koconnor.net wrote:
- while ((readb((void *)OXPCIE_COM1+SEROFF_LSR) & 0x60) != 0x60)
I'm not sure how this will work. The bar is likely to be in high memory, yet this code can be run from 16bit mode.
There is now pci_readl/pci_writel for trampolining into 32bit mode to read/write BARs. Would you want to trampoline to 32bit mode for a debug device though?
Ok, does it sound reasonable to add pci_readw and pci_readb for that, too?
Adding the extra functions should be fine.
However, the trampoline is not transparent - there's no way to know which flavor of 16bit mode to return to. So, having debug functions trampoline could cause "heisenbugs".
I suggest disabling the debugging when MODESEGMENT is true, so we can commit that. Then an incremental patch that adds debugging via the trampoline functions can be added on top if you wish.
Also, the functionality of those functions is somewhat pci unrelated, it just happens to be useful for access to pci bars. I suggest renaming them to pmode_readl or something like that in order to make it easier to understand what the function really does. Sounds ok? Then I would go ahead and implement it this way.
If you wish. Please send the rename as a separate patch though.
-Kevin