How to write to a PCIe config space during kernel boot up

Khalid F. Sabzwari kfsabzwari at yahoo.com
Wed Apr 13 03:01:01 EDT 2022


 Thanks Ozgur for quick reply.The link you shared below seems to work with MDIO interface.The PHY used on my board is Intel's i211 PHY which is controlled by PCIe interface.I found this link:https://docs.kernel.org/PCI/pci.html#how-to-access-pci-config-space

I never wrote a kernel code before, and am trying to just hack for an experiment to write to config space of this PHY. so I will give it a try to see if i can read/write to i211's config space, during early kernel boot time, using pci_(read|write)_config_(byte|word|dword)
thanks,Khalid.

    On Tuesday, April 12, 2022, 12:11:21 PM PDT, Ozgur Karatas <ozgurk at ieee.org> wrote:  
 
 

On Tue, Apr 12, 2022 at 11:00 PM Khalid F. Sabzwari <kfsabzwari at yahoo.com> wrote:

Hi,

Hello, 
My CPU is Intel x86 (Broadwell DE). I want to write to the command register of the management ethernet PHY's PCIeconfig space during Linux boot up. And I want to do that before kernel start loading the igb (ethernet) driver for this PHY.Can I do that inside the start_kernel() routine in init.main.c, or is the driver is already installed once code reaches this point (I am assuming probably not) ?If this is the correct routine to do this job, is there any kernel code that I can use to write to this config space? 

I dont think this right way, there should be a phy.h header file in kernel and i think should use PHY Abstraction Layer.

https://docs.kernel.org/networking/phy.html

 
I have bus/device/function info for this management PHY which is already set by the BIOS.
thanks,Khalid.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20220413/0d12f675/attachment.html>


More information about the Kernelnewbies mailing list