Esempio n. 1
0
File: boards.c Progetto: 274914765/C
int efx_set_board_info(struct efx_nic *efx, u16 revision_info)
{
    int rc = 0;
    struct efx_board_data *data;

    if (BOARD_TYPE(revision_info) >= EFX_BOARD_MAX) {
        EFX_ERR(efx, "squashing unknown board type %d\n",
            BOARD_TYPE(revision_info));
        revision_info = 0;
    }

    if (BOARD_TYPE(revision_info) == 0) {
        efx->board_info.major = 0;
        efx->board_info.minor = 0;
        /* For early boards that don't have revision info. there is
         * only 1 board for each PHY type, so we can work it out, with
         * the exception of the PHY-less boards. */
        switch (efx->phy_type) {
        case PHY_TYPE_10XPRESS:
            efx->board_info.type = EFX_BOARD_SFE4001;
            break;
        case PHY_TYPE_XFP:
            efx->board_info.type = EFX_BOARD_SFE4002;
            break;
        default:
            efx->board_info.type = 0;
            break;
        }
    } else {
        efx->board_info.type = BOARD_TYPE(revision_info);
        efx->board_info.major = BOARD_MAJOR(revision_info);
        efx->board_info.minor = BOARD_MINOR(revision_info);
    }

    data = &board_data[efx->board_info.type];

    /* Report the board model number or generic type for recognisable
     * boards. */
    if (efx->board_info.type != 0)
        EFX_INFO(efx, "board is %s rev %c%d\n",
             (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
             ? data->ref_model : data->gen_type,
             'A' + efx->board_info.major, efx->board_info.minor);

    efx->board_info.init = data->init;

    return rc;
}
Esempio n. 2
0
void efx_set_board_info(struct efx_nic *efx, u16 revision_info)
{
	struct efx_board_data *data = NULL;
	int i;

	efx->board_info.type = BOARD_TYPE(revision_info);
	efx->board_info.major = BOARD_MAJOR(revision_info);
	efx->board_info.minor = BOARD_MINOR(revision_info);

	for (i = 0; i < ARRAY_SIZE(board_data); i++)
		if (board_data[i].type == efx->board_info.type)
			data = &board_data[i];

	if (data) {
		EFX_INFO(efx, "board is %s rev %c%d\n",
			 (efx->pci_dev->subsystem_vendor == EFX_VENDID_SFC)
			 ? data->ref_model : data->gen_type,
			 'A' + efx->board_info.major, efx->board_info.minor);
		efx->board_info.init = data->init;
	} else {
		EFX_ERR(efx, "unknown board type %d\n", efx->board_info.type);
	}
}