芯片驱动选择
看src/soc/common/cm.c -> soc_dev_info这个全局变量,这个才是最准确最标准的,其结构体定义如下:
/* information about a device type */
typedef struct soc_cm_device_info_s {
uint16 dev_id; /* Chip ID as found in table */
uint8 rev_id;
const char *dev_name;
uint16 dev_id_driver; /* Chip ID of driver to use */
uint8 rev_id_driver; /* (zero if same as real ID) */
uint32 dev_type;
} soc_cm_device_info_t;
分别制定了芯片ID、芯片版本ID和应当使用的芯片驱动ID和芯片驱动版本ID,例如:
{ /* Hurricane4 */ // 这个是芯片系列
BCM56277_DEVICE_ID, BCM56277_A1_REV_ID, // 这是我要适配的56277这块芯片,版本为A1
"BCM56277_A1",
BCM56275_DEVICE_ID, BCM56275_A0_REV_ID, // 这是SDK给的需要使用的驱动为56275的驱动,版本为A0
(SOC_PCI_DEV_TYPE | SOC_SWITCH_DEV_TYPE)
},
要适配的芯片型号跟硬件确定,或者在SDK加载的时候会打印:
Broadcom Command Monitor: Copyright (c) 1998-2021 Broadcom
Release: sdk-6.5.19 built 20210119 (Tue Jan 19 09:15:56 2021)
From root@linux:/home/wns/source/wns/apps/openswitch_ori/sdk-xgs-robo-6.5.19
Platform: unknown
OS: Unix (Posix)
cmdlist_init done
DMA pool size: 16777216
BDE dev 0 (PCI), Dev 0xb277, Rev 0x02, Chip BCM56277_A1, Driver BCM56275_A0
SOC unit 0 attached to PCI device BCM56277_A1
rcload bcm config soc(0) complete
```c