| 1 |
|
| 2 |
|
| 3 |
#include <types.h> |
| 4 |
#include <device/device.h> |
| 5 |
#include "smbios_onboard.h" |
| 6 |
#include <smbios.h> |
| 7 |
|
| 8 |
const char *e810_cam1_port_name[E810_CAM1_PORT_NUMBER] = { |
| 9 |
"E810 CAM1 Port1", |
| 10 |
"E810 CAM1 Port2", |
| 11 |
"E810 CAM1 Port3", |
| 12 |
"E810 CAM1 Port4", |
| 13 |
}; |
| 14 |
|
| 15 |
const char *e810_cam2_port_name[E810_CAM2_PORT_NUMBER] = { |
| 16 |
"E810 CAM2 Port1", |
| 17 |
"E810 CAM2 Port2", |
| 18 |
"E810 CAM2 Port3", |
| 19 |
"E810 CAM2 Port4", |
| 20 |
"E810 CAM2 Port5", |
| 21 |
"E810 CAM2 Port6", |
| 22 |
"E810 CAM2 Port7", |
| 23 |
"E810 CAM2 Port8", |
| 24 |
}; |
| 25 |
|
| 26 |
static int ws_2_onboard_smbios_data(struct device *dev, int *handle, |
| 27 |
unsigned long *current) |
| 28 |
{ |
| 29 |
int data_length = 0; |
| 30 |
int type_instance = 0; |
| 31 |
|
| 32 |
for (int i = 0; i < E810_CAM1_PORT_NUMBER; i++) { |
| 33 |
data_length += smbios_write_type41( |
| 34 |
current, handle, |
| 35 |
e810_cam1_port_name[i], |
| 36 |
++type_instance, |
| 37 |
0, |
| 38 |
E810_CAM1_BUS_NUMBER, |
| 39 |
0, |
| 40 |
i, |
| 41 |
SMBIOS_DEVICE_TYPE_ETHERNET); |
| 42 |
} |
| 43 |
|
| 44 |
for (int i = 0; i < E810_CAM2_PORT_NUMBER; i++) { |
| 45 |
data_length += smbios_write_type41( |
| 46 |
current, handle, |
| 47 |
e810_cam2_port_name[i], |
| 48 |
++type_instance, |
| 49 |
0, |
| 50 |
E810_CAM2_BUS_NUMBER, |
| 51 |
0, |
| 52 |
i, |
| 53 |
SMBIOS_DEVICE_TYPE_ETHERNET); |
| 54 |
} |
| 55 |
return data_length; |
| 56 |
} |
| 57 |
|
| 58 |
static void mainboard_enable(struct device *dev) |
| 59 |
{ |
| 60 |
dev->ops->get_smbios_data = ws_2_onboard_smbios_data; |
| 61 |
} |
| 62 |
|
| 63 |
struct chip_operations mainboard_ops = { |
| 64 |
.enable_dev = mainboard_enable, |
| 65 |
}; |