Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/pcie: Change pcie_get_mbar() to return size and flags #29819

Merged
merged 1 commit into from
Nov 20, 2020
Merged

drivers/pcie: Change pcie_get_mbar() to return size and flags #29819

merged 1 commit into from
Nov 20, 2020

Conversation

maxbachmann
Copy link
Contributor

@maxbachmann maxbachmann commented Nov 5, 2020

currently pcie_get_mbar only returns the physical address.
This changes the function to return the size of the mbar and
the flags (IO Bar vs MEM BAR).

This implements #26491. I did decide to change the existing function instead of adding another function to retrieve the size for the following reasons:

  1. in most of the cases both size and physical address are required anyways
  2. The flags might be interesting aswell e.g. to select IO Bar vs Mem Bar

This fixes the macros for the use with IO Bars

include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
@nashif nashif requested a review from jhedberg November 5, 2020 14:35
Copy link
Collaborator

@tbursztyka tbursztyka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we still enforce 80 chars limit, but in doubt please do.

I needed something like that recently, in #29479 but getting both adress and size at once makes sense.

drivers/pcie/host/pcie.c Outdated Show resolved Hide resolved
drivers/pcie/host/pcie.c Outdated Show resolved Hide resolved
include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
drivers/pcie/host/pcie.c Outdated Show resolved Hide resolved
include/drivers/pcie/pcie.h Outdated Show resolved Hide resolved
drivers/pcie/host/pcie.c Show resolved Hide resolved
drivers/pcie/host/pcie.c Outdated Show resolved Hide resolved
drivers/pcie/host/pcie.c Outdated Show resolved Hide resolved
@tbursztyka
Copy link
Collaborator

tbursztyka commented Nov 6, 2020

Actually, about differentiating IO and MEM. I don't know if that's relevant anymore since no platform so far make use of IO stuff. We only needed it for galileo board back in the days.

@maxbachmann
Copy link
Contributor Author

Actually, about differentiating IO and MEM. I don't know if that's relevant anymore since no platform so far make use of IO stuff. We only needed it for galileo board back in the days.

I personally only care about this info, since e.g. The Realtek 8111G Controller has the following bars

  1. address=0xE000 size=256 type=IO
  2. address=0x91404000 size=4k type=MEM (64 bit)
  3. address=0x91400000 size=16k type=MEM (64 bit)

I want to use the first MEM Bar. So I either need this info, or since as you said nobody uses the IO stuff, we could skip all IO Bars aswell.

@pfalcon pfalcon removed their request for review November 6, 2020 09:09
@tbursztyka
Copy link
Collaborator

I want to use the first MEM Bar. So I either need this info, or since as you said nobody uses the IO stuff, we could skip all IO Bars aswell.
Yes somes devices expose both types for legacy support, but the MEM is the way to go in zephyr so far, so skipping IO bars would be fine

@maxbachmann
Copy link
Contributor Author

maxbachmann commented Nov 6, 2020

Yes somes devices expose both types for legacy support, but the MEM is the way to go in zephyr so far, so skipping IO bars would be fine

Ok I skip I/O Bars now aswell

@maxbachmann

This comment has been minimized.

currently pcie_get_mbar only returns the physical address.
This changes the function to return the size of the mbar and
the flags (IO Bar vs MEM BAR).

Signed-off-by: Maximilian Bachmann <[email protected]>
@tbursztyka
Copy link
Collaborator

@jhedberg Can you merge this one? I need that function for msi-x and ivshmem

@jhedberg jhedberg merged commit 3c8e98c into zephyrproject-rtos:master Nov 20, 2020
@tbursztyka
Copy link
Collaborator

Maybe proposing a function in parallel to the existing one would have been more aligned with https://docs.zephyrproject.org/latest/development_process/api_lifecycle.html

@maxbachmann maxbachmann deleted the patch-9 branch November 23, 2020 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants