On Thu, 26 Feb 2015 13:53:13 -0800 Ed Swierk email@example.com wrote:
On Thu, Feb 26, 2015 at 4:10 AM, Patrick Georgi firstname.lastname@example.org wrote:
2015-02-26 1:57 GMT+01:00 Ed Swierk email@example.com:
Running flashrom on a Linux system with CONFIG_STRICT_DEVMEM=y, I can now successfully program the SPI flash on an Intel 10G NIC using the
+#if !defined(__DJGPP__) && !defined(__LIBPAYLOAD__) +static void *pcidev_mapbar_sysfs(struct pci_dev *dev, const char *descr, int bar, off_t offset, size_t length)
Isn't that actually Linux specific, instead of non-djgpp-or-libpayload specific?
I suppose that's a safe assumption, though I don't know much about any of the other platforms flashrom supports. libpci already figures out whether the platform supports sysfs. I piggyback off that logic by checking pacc->method.
Here we're just deciding whether the platform uses mmap() to access physical address space. I followed the same approach used in physmap.c, since pcidev_mapbar_sysfs() is doing the same thing as sys_physmap_rw_uncached(), just with a PCI resource file instead of /dev/mem.
But I can switch to #if IS_LINUX if you think that's clearer. We can revisit that if and when some other sprouts a similar mmapped sysfs interface to PCI resources.
I have not really looked into the patch... but I did a little compile test on top of r1885. I'll just let the buildbot speak for itself: http://buildbot.flashrom.org/buildresults/flashrom-000164-Zcc/results.txt sparc7 is expected to fail with r1885.