Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


SPI Flash ROM Driver

AlbertAlbert Member - All Emails Posts: 450

I started this thread a few days back : https://community.osr.com/discussion/292310/pci-device-read-crash/p1?new=1

I want to know, if one wants to write an SPI Flash ROM driver and install it into the Windows stack, what are the steps?
I am assuming PNP will try to find a best match for those devices and if a driver is installed it will be picked up? Has any one written such a driver? Or is there a sample I can follow?

I was already pointed out to this: https://docs.microsoft.com/en-us/samples/microsoft/windows-driver-samples/spbtesttool/
But I am not sure if this is the right sample to follow or is there another one that is closer to my goal?

Thanks in advance

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,109

    Which SPI ROM are you trying to read?

    We’re not in your head, right? “SPI ROM” is like saying “EEPROM” it doesn’t mean anything without some context. We’ve been guessing this has something to do with PCIe... but, please. Give us some specifics so we can help you.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • AlbertAlbert Member - All Emails Posts: 450

    @Peter_Viscarola_(OSR) said:
    Which SPI ROM are you trying to read?

    We’re not in your head, right? “SPI ROM” is like saying “EEPROM” it doesn’t mean anything without some context. We’ve been guessing this has something to do with PCIe... but, please. Give us some specifics so we can help you.

    Peter

    As am an example lets look at Intel series 300 chipset data sheet vol 2 : https://www.intel.com/content/www/us/en/products/docs/chipsets/300-series-chipset-pch-datasheet-vol-2.html

    Chapter 8.

    Intel's own drivers dont give any ioctls to achieve this task, neither do all platforms have intel's updated drivers installed.

    There is an open source project calld chipsec : https://github.com/chipsec/chipsec but given it's methods are also undocumented and tries to read the pci space directly, I do not want to use that appraoch, anything better would help.

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,642

    That device is intended to be used by the BIOS, not by system software.

    Now, this is a PCIe device with a VID and PID. That means you could write a driver to claim that device, In that case, the BAR address would be handed to you by PnP. That assume, of course, that Intel doesn't already have a driver for it.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 8,109

    Yup. What Mr. Roberts said: This device is intended for use by the BIOS.

    If you JUST want to talk to it, you could write a standard KMDF PnP driver. You have the VID and DID... go for it. The problem is how you assure your access doesn’t conflict with BIOS access.

    The other problem is how to get the system to load it if there’s already an Intel driver for it (though I doubt there is.. such devices are typically NODRV). And, if there IS a driver, how do you make yours compatible so that “other stuff” on the system doesn’t break. But that’s probably solvable.

    In general, I would say this project is a bad idea.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • AvalonAvalon Member Posts: 28

    There is nothing special that needs to be done using WDM as I've personally written a testing tool to read SPI Flash regions. The SPI Flash Controller is a hidden PNP device and does not show up on the LPC bus. It is possible to issue SPI commands to it from Ring0 as it's memory mapped with MMIO and hardware registers are also memory mapped. However why do you need to touch this hardware? And since you are not the SPI master of the regions, well you do have mastery of 1, but you will be locked to read.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE