SPI Flash ROM Driver

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

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)” 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.

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.

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

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.

@Avalon said:
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.

I want to make this device visible in device manager by actually registering for it , a driver with PNP