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
VPCI code cleanup/reorg #3334
VPCI code cleanup/reorg #3334
Conversation
find_pci_pdev is not used any more, remove it. Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
Add get_offset_of_caplist() function to return capability offset based on header type: For normal pci device and bridge, its capability offset is at offset 0x34 For cardbus, its capability offset is at offset 0x14 Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
union pci_bar uses bit fields and follows the PCI bar spec definition to define the bar flags portion and base address, this is to keep the same hardware format for vbar register. The base/type of union pci_bar are still kept to minimize code changes in one patch, they will be removed in subsequent patches. define pci_pdev_get_bar_base() function to extract bar base address given a 32-bit raw bar value define a utility function pci_get_bar_type() to extract bar types from raw bar value to simply code, as this function will be used in multiple places later on: this function can be called on reg->value stored in struct pci_bar to derive bar type. Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
nr_bars in struct pci_pdev is used to store the actual # of bars ( 6 for normal pci device and 2 for pci bridge), nr_bars will be used in subsequent patches Use uint32_t for bar related variables (bar index, etc) to unify the bar related code (no casting between uint32_t and uint8_t) Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
And put the checking in vdev_pt_write_cfg instead to have less nesting in vdev_pt_write_vbar to improve code readability. Rename function: vdev_pt_remap_generic_bar --> vdev_pt_remap_generic_mem_vbar vdev_pt_read_cfg's function declaration is merged into one line instead of 2 lines Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Use nr_bars instead of PCI_BAR_COUNT to check bar access offset. As while normal pci device has max 6 bars, pci bridge only has 2 bars, so for pci normal pci device, pci cfg offsets 0x10-0x24 are for bar access, but for pci bridge, only 0x10-0x14 are for bar access (0x18-0x24 are for other accesses). Rename function: pci_bar_access --> is_bar_offset Tracked-On: #3241 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
OK to verify |
Can one of the admins verify this patch? |
7 new potential violations to the coding guideline detected. Please help check. Thanks! |
Remove unused function find_pci_pdev
Add get_offset_of_caplist() function to return capability offset based on header type
Add union pci_bar and is_64bit_high to struct pci_bar
Add uint32_t nr_bars to struct struct pci_pdevpci_vdev to track # of bars
Tracked-On: #3241
Signed-off-by: dongshen dongsheng.x.zhang@intel.com
Acked-by: Eddie Dong eddie.dong@intel.com