MCPcopy Create free account
hub / github.com/F-Stack/f-stack / adap_init0

Function adap_init0

dpdk/drivers/net/cxgbe/cxgbe_main.c:1383–1680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1381}
1382
1383static int adap_init0(struct adapter *adap)
1384{
1385 struct fw_caps_config_cmd caps_cmd;
1386 int ret = 0;
1387 u32 v, port_vec;
1388 enum dev_state state;
1389 u32 params[7], val[7];
1390 int reset = 1;
1391 int mbox = adap->mbox;
1392
1393 /*
1394 * Contact FW, advertising Master capability.
1395 */
1396 ret = t4_fw_hello(adap, adap->mbox, adap->mbox, MASTER_MAY, &state);
1397 if (ret < 0) {
1398 dev_err(adap, "%s: could not connect to FW, error %d\n",
1399 __func__, -ret);
1400 goto bye;
1401 }
1402
1403 CXGBE_DEBUG_MBOX(adap, "%s: adap->mbox = %d; ret = %d\n", __func__,
1404 adap->mbox, ret);
1405
1406 if (ret == mbox)
1407 adap->flags |= MASTER_PF;
1408
1409 if (state == DEV_STATE_INIT) {
1410 /*
1411 * Force halt and reset FW because a previous instance may have
1412 * exited abnormally without properly shutting down
1413 */
1414 ret = t4_fw_halt(adap, adap->mbox, reset);
1415 if (ret < 0) {
1416 dev_err(adap, "Failed to halt. Exit.\n");
1417 goto bye;
1418 }
1419
1420 ret = t4_fw_restart(adap, adap->mbox, reset);
1421 if (ret < 0) {
1422 dev_err(adap, "Failed to restart. Exit.\n");
1423 goto bye;
1424 }
1425 state = (enum dev_state)((unsigned)state & ~DEV_STATE_INIT);
1426 }
1427
1428 t4_get_version_info(adap);
1429
1430 ret = t4_get_core_clock(adap, &adap->params.vpd);
1431 if (ret < 0) {
1432 dev_err(adap, "%s: could not get core clock, error %d\n",
1433 __func__, -ret);
1434 goto bye;
1435 }
1436
1437 /*
1438 * If the firmware is initialized already (and we're not forcing a
1439 * master initialization), note that we're living with existing
1440 * adapter parameters. Otherwise, it's time to try initializing the

Callers 1

cxgbe_probeFunction · 0.85

Calls 15

t4_fw_helloFunction · 0.85
t4_fw_haltFunction · 0.85
t4_fw_restartFunction · 0.85
t4_get_version_infoFunction · 0.85
t4_get_core_clockFunction · 0.85
adap_init0_configFunction · 0.85
t4_get_pfresFunction · 0.85
t4_query_paramsFunction · 0.85
hweight32Function · 0.85
t4_sge_initFunction · 0.85
memsetFunction · 0.85
t4_wr_mboxFunction · 0.85

Tested by

no test coverage detected