
Hi Pali,
On Fri, Nov 5, 2021 at 2:09 PM Pali Rohár pali@kernel.org wrote:
On Friday 05 November 2021 12:54:24 Roman Bacik wrote:
- pci_read_word16(bp->pdev,
PCI_SUBSYSTEM_VENDOR_ID,
&bp->subsystem_vendor);
- pci_read_word16(bp->pdev, PCI_SUBSYSTEM_ID, &bp-
subsystem_device);
- pci_read_word16(bp->pdev, PCI_COMMAND, &bp->cmd_reg);
- pci_read_byte(bp->pdev, PCICFG_ME_REGISTER, &bp->pf_num);
PCICFG_ME_REGISTER looks like an error as there is no such PCI config space macro. What you are trying to read into pf_num? Currently I do not know what "pf" abbreviation could mean.
PF stands for physical function and pf_num is the number of physical functions configured. The macro is defined in bnxt.h: #define PCICFG_ME_REGISTER 0x98
pci_read_byte() reads from PCI(e) config space, which is standardized. Therefore only standard macro constants from include/pci.h should be used. Standard PCI config header is 64 byte long and after that is linked list of capabilities. Order of capabilities is not defined. Extended capabilities from linked list should be located by macro constants PCI_CAP_ID_*.
So above register is part of some extended capability. Correctly it should be used some function to locate starting offset of that extended capability based on PCI_CAP_ID_* (see pci.h file for these functions) and then access that register as offset + PCI_* constant (which defined as relative to the start of extended capability). In case standard macro for this constant in pci.h is missing, it is a good idea to define it, or copy it from linux header file pci_regs.h (to have consistent naming of macros).
Could you provide output of 'lspci -nn -vv' from linux for this card? Or 'pci display.b ?.?.? 0 0x1000' dump from U-Boot? This could help me to under what kind of register that 0x98 is.
I can write this part of code, no problem, just I need to see layout of config space of that card.
Here it is:
u-boot> pci display.b ?.?.? 0 1000 00000000: e4 14 50 d7 06 00 10 00 00 00 04 06 08 00 01 00 00000010: 00 00 00 00 00 00 00 00 00 01 01 00 00 00 00 00 00000020: 00 10 50 10 01 10 01 00 00 00 00 00 00 00 00 00 00000030: 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00000040: 00 00 00 00 00 00 00 00 01 ac 03 c8 08 20 00 00 00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000a0: 00 00 00 00 00 00 00 00 00 00 00 00 10 00 42 00 000000b0: 00 80 00 00 10 2c 10 00 03 5d 65 00 00 00 03 11 000000c0: 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 000000d0: 1f 08 00 00 00 00 00 00 0e 00 00 00 02 00 00 00 000000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000180: 0b 00 01 24 00 00 80 02 00 00 00 00 00 00 00 00 00000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000002f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000003f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000410: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000430: 00 00 00 00 50 d7 e4 14 00 00 00 00 00 04 06 00 00000440: 00 00 00 00 e4 02 00 00 00 00 00 00 00 00 00 00 00000450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000004d0: 40 00 00 00 00 80 00 00 00 00 00 00 03 5f 31 00 000004e0: 00 00 00 00 1f 00 00 00 00 00 00 00 00 00 00 00 000004f0: 02 00 00 00 00 00 00 00 0e 00 00 00 00 00 00 00 00000500: 01 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00000510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000550: 00 00 00 00 00 00 80 02 00 00 00 00 00 00 00 00 00000560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000590: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000005f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000006f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000740: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000760: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000770: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000007f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000810: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000008f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000950: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000009f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000a90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000aa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000b90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000bd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000bf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000c90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ca0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000cb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000cc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000cd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ce0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000cf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000d90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000da0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000db0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000dd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000de0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000df0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000e90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- pci_read_byte(bp->pdev, PCI_INTERRUPT_LINE, &bp->irq);
- bp->bar0 = pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_0,
PCI_REGION_MEM);
- bp->bar1 = pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_2,
PCI_REGION_MEM);
- bp->bar2 = pci_map_bar(bp->pdev, PCI_BASE_ADDRESS_4,
PCI_REGION_MEM);
pci_map_bar() is obsolete and should not be used in a new code. Please switch to DM and use new DM API.
We will replace with dm_pci_map_bar().
Check that you can compile driver without CONFIG_DM_PCI_COMPAT option. I think it should throw compile error on usage of this function.
We do not enable CONFIG_DM_PCI_COMPAT.
That is interesting as pci_map_bar() function is declared in section: #if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
So without COMPAT macro it should not be possible to use pci_map_bar() function at all.
- cmd_reg = bp->cmd_reg | PCI_COMMAND_MEMORY |
PCI_COMMAND_MASTER;
- cmd_reg |= PCI_COMMAND_INTX_DISABLE; /* disable intr */
- pci_write_word(bp->pdev, PCI_COMMAND, cmd_reg);
- pci_read_word16(bp->pdev, PCI_COMMAND, &cmd_reg);
- dbg_pci(bp, __func__, cmd_reg);
+}
...
+static int bnxt_read_rom_hwaddr(struct udevice *dev) +{
- struct eth_pdata *plat = dev_get_plat(dev);
- struct bnxt *bp = dev_get_priv(dev);
- bnxt_bring_pci(bp);
- if (bnxt_bring_chip(bp))
It looks suspicious if read_rom_hwaddr() function is doing initialization of PCIe device. Is there any reason for it in this place?
Opposite of bnxt_bring_pci+bnxt_bring_chip is bnxt_down_chip and it is called in bnxt_eth_remove() function.
The method bnxt_bring_pci() fills priv data bp and needs to be called before bnxt_bring_chip(). The data does not need to be cleaned in bnxt_eth_remove(). We were asked by another reviewer to use bnxt_read_rom_hwaddr() to set up hw address (instead of doing it in probe)
Yes, that is correct way.
but bnxt_bring_chip() has to be called to get the hw addr. So both methods bnxt_bring_pci and bnxt_bring_chip were moved there.
printf("*** warning: bnxt_bring_chip failed! ***\n");
It is only warning? I guess that failed initialization is fatal error and should be propagated via return value... but that is not easily possible if initialization is called from read_rom_hwaddr().
It is only warning, since there is usually another 1G eth available, besides this 100G bnxt eth. Originally, we had it probed via bnxt commands on demand. But another reviewer asked to remove bnxt commands so we bring up bnxt each boot. But it is not necessarily an error causing the boot to fail.
Ok! So let it as is for now.
We have posted v7 but 1/2 is on hold by list moderator as usual because of the size. Thanks,
Roman