[LinuxBIOS] winflashrom architecture (Windows port of flashrom) -- looking for suggestions

Darmawan Salihun darmawan.salihun at gmail.com
Tue May 1 19:09:39 CEST 2007


On 5/1/07, Darmawan Salihun <darmawan.salihun at gmail.com> wrote:
>
>
>
> On 5/1/07, Peter Stuge < stuge-linuxbios at cdy.org> wrote:
> >
> > On Mon, Apr 30, 2007 at 10:50:07AM +0700, Darmawan Salihun wrote:
> > > 1. The kernel mode code a.k.a kernel mode device driver is as
> > > simple as possible and only provides "raw" functionality, i.e.
> > > capability to map the physical address space in which the BIOS
> > > chip is mapped into the requesting user mode code.
> >
> > This would be OK, but there's a constant race between making the
> > window large enough and new flash chips.
> >
> In my current experimental code. The "window" in the kernel driver is
> programmable, i.e. the user mode application
> passes the starting address of the MMIO range along with the size of the
> range to be mapped.
>

I'll elaborate more on this. The current kernel mode driver provides the
following set of interface functions:
------------------------------------------------------------------------------------------
int InitDriver(); // returns 0 on error, 1 on success
void CleanupDriver(); // must be called after done using the driver

void* MapPhysicalAddressRange( unsigned long phyAddrStart,
                         unsigned long size ); // returns NULL on error,
valid pointer on success
int UnmapPhysicalAddressRange( void* virtAddrStart,
                unsigned long size ); // must be called when finished with
the mapped physical memory

void outb(unsigned char value, unsigned short port);
void outw(unsigned short value, unsigned short port);
void outl(unsigned long value, unsigned short port);

unsigned char inb(unsigned short port);
unsigned short inw(unsigned short port);
unsigned long inl(unsigned short port);
------------------------------------------------------------------------------
The inX and outX match exactly with the Linux version of flashrom, therefore
practically no changes in code.
The MapPhysicalAddressRange() replaces the mmap() function in the Linux
version of flashrom.

Do you think that this approach is foolproof and extensible enough for the
time being?

PS: I'm still grepping through the latest flashrom to see wheter this is
enough or I need to rework it.

-- Darmawan
--------------------------------------------------------------------
-= Human knowledge belongs to the world =-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20070502/9db4244b/attachment.html>


More information about the coreboot mailing list