Re: How to "refresh" pci_resource_start and friends after devicediscovery ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 03, 2010 at 05:28:26PM +0100, Valentin Longchamp wrote:
> Hi,
> 
> I am working on a driver for a device using a PCI interface on some
> embedded hardware.
> 
> Our hardware is no x86 and thus we have no BIOS to setup the PCI config
> registers (let's take BAR0 for instance). On our devboard, these
> registers are configured though values contained in a serial EEPROM that
> is read by the device at power-up.
> 
> Now I would like to be able to modify some of these registers so that I
> can map other physical memory regions than the ones setup by the EEPROM.
> 
> When I perform these writes (with pci_write_config_xxx), the physical
> registers in the PCI config space is updated (at least I read the
> corresponding values with pci_read_config_xxx). However, the value
> returned by the call to pci_resource_start for the corresponding BAR is
> not updated and still is the initial value written from the EEPROM. I
> guess that this is due to the fact that the value read by
> pci_resource_start is only read in hardware once, at device
> enumaration/discovery on the bus.
> 
> How can my driver write new values so that they are the ones actually
> used by the kernel pci code ? Or how can I trigger a "refresh" of all
> these values in the corresponding structs for a given device ?

Couple of quick thoughts on this:
1) PCI subsystem was designed with the idea that BARs are "input"
   to the drivers and not something a PCI driver should be messing with.
   The "BIOS" is just a conceptual idea that some machine specific
   code knows where stuff can/should be mapped physically. SPARC, PARISC,
   Alpha, Arm, etc all have no "BIOS" - they have the equivalent though.
   Such code is NOT in any "PCI device driver" since those are by design
   expected to be platform/machine agnostic.

2) Look at PCI or PCMCIA hotplug support and you'll find support to
   dynamically reassign MMIO/IO Port resources. You might have user space
   generate a "fake" a hotplug event in order to get the resource
   assignment "fixed up" properly without having such code in your
   device driver.

hth,
grant

> Thank you for your help
> 
> Valentin Longchamp
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux