• Home
  • Raw
  • Download

Lines Matching +full:step +full:- +full:up

2  * Copyright(c) 2015 - 2017 Intel Corporation.
24 * - Redistributions of source code must retain the above copyright
26 * - Redistributions in binary form must reproduce the above copyright
30 * - Neither the name of Intel Corporation nor the names of its
146 #define AUGMENT_SIZE (sizeof(struct augmented_firmware_file) - \
260 * Read a single 64-bit value from 8051 data memory.
263 * o caller to have already set up data read, no auto increment
267 * ignored - i.e. the hardware will always do aligned 8-byte reads as if
270 * Return 0 on success, -ENXIO on a read error (timeout).
277 /* step 1: set the address, clear enable */ in __read_8051_data()
281 /* step 2: enable */ in __read_8051_data()
293 return -ENXIO; in __read_8051_data()
305 * Read 8051 data starting at addr, for len bytes. Will read in 8-byte chunks.
306 * Return 0 on success, -errno on error.
314 spin_lock_irqsave(&dd->dc8051_memlock, flags); in read_8051_data()
316 /* data read set-up, no auto-increment */ in read_8051_data()
328 spin_unlock_irqrestore(&dd->dc8051_memlock, flags); in read_8051_data()
346 /* write set-up */ in write_8051()
358 int bytes = len - offset; in write_8051()
378 return -ENXIO; in write_8051()
391 /* return 0 if values match, non-zero and complain otherwise */
410 if (invalid_header(dd, "module_type", css->module_type, in verify_css_header()
412 invalid_header(dd, "header_len", css->header_len, in verify_css_header()
414 invalid_header(dd, "header_version", css->header_version, in verify_css_header()
416 invalid_header(dd, "module_vendor", css->module_vendor, in verify_css_header()
418 invalid_header(dd, "key_size", css->key_size, KEY_SIZE / 4) || in verify_css_header()
419 invalid_header(dd, "modulus_size", css->modulus_size, in verify_css_header()
421 invalid_header(dd, "exponent_size", css->exponent_size, in verify_css_header()
423 return -EINVAL; in verify_css_header()
439 return -EINVAL; in payload_check()
448 * Returns 0 on success, -ERRNO on error.
458 ret = request_firmware(&fdet->fw, name, &dd->pcidev->dev); in obtain_one_firmware()
466 if (fdet->fw->size < sizeof(struct css_header)) { in obtain_one_firmware()
468 ret = -EINVAL; in obtain_one_firmware()
471 css = (struct css_header *)fdet->fw->data; in obtain_one_firmware()
474 hfi1_cdbg(FIRMWARE, "file size: 0x%lx bytes", fdet->fw->size); in obtain_one_firmware()
476 hfi1_cdbg(FIRMWARE, " module_type 0x%x", css->module_type); in obtain_one_firmware()
478 css->header_len, 4 * css->header_len); in obtain_one_firmware()
479 hfi1_cdbg(FIRMWARE, " header_version 0x%x", css->header_version); in obtain_one_firmware()
480 hfi1_cdbg(FIRMWARE, " module_id 0x%x", css->module_id); in obtain_one_firmware()
481 hfi1_cdbg(FIRMWARE, " module_vendor 0x%x", css->module_vendor); in obtain_one_firmware()
482 hfi1_cdbg(FIRMWARE, " date 0x%x", css->date); in obtain_one_firmware()
484 css->size, 4 * css->size); in obtain_one_firmware()
486 css->key_size, 4 * css->key_size); in obtain_one_firmware()
488 css->modulus_size, 4 * css->modulus_size); in obtain_one_firmware()
490 css->exponent_size, 4 * css->exponent_size); in obtain_one_firmware()
492 fdet->fw->size - sizeof(struct firmware_file)); in obtain_one_firmware()
502 * Note: css->size is in DWORDs, multiply by 4 to get bytes. in obtain_one_firmware()
507 } else if ((css->size * 4) == fdet->fw->size) { in obtain_one_firmware()
508 /* non-augmented firmware file */ in obtain_one_firmware()
510 fdet->fw->data; in obtain_one_firmware()
513 ret = payload_check(dd, name, fdet->fw->size, in obtain_one_firmware()
516 fdet->css_header = css; in obtain_one_firmware()
517 fdet->modulus = ff->modulus; in obtain_one_firmware()
518 fdet->exponent = ff->exponent; in obtain_one_firmware()
519 fdet->signature = ff->signature; in obtain_one_firmware()
520 fdet->r2 = fdet->dummy_header.r2; /* use dummy space */ in obtain_one_firmware()
521 fdet->mu = fdet->dummy_header.mu; /* use dummy space */ in obtain_one_firmware()
522 fdet->firmware_ptr = ff->firmware; in obtain_one_firmware()
523 fdet->firmware_len = fdet->fw->size - in obtain_one_firmware()
526 * Header does not include r2 and mu - generate here. in obtain_one_firmware()
530 ret = -EINVAL; in obtain_one_firmware()
532 } else if ((css->size * 4) + AUGMENT_SIZE == fdet->fw->size) { in obtain_one_firmware()
535 (struct augmented_firmware_file *)fdet->fw->data; in obtain_one_firmware()
538 ret = payload_check(dd, name, fdet->fw->size, in obtain_one_firmware()
541 fdet->css_header = css; in obtain_one_firmware()
542 fdet->modulus = aff->modulus; in obtain_one_firmware()
543 fdet->exponent = aff->exponent; in obtain_one_firmware()
544 fdet->signature = aff->signature; in obtain_one_firmware()
545 fdet->r2 = aff->r2; in obtain_one_firmware()
546 fdet->mu = aff->mu; in obtain_one_firmware()
547 fdet->firmware_ptr = aff->firmware; in obtain_one_firmware()
548 fdet->firmware_len = fdet->fw->size - in obtain_one_firmware()
552 /* css->size check failed */ in obtain_one_firmware()
555 fdet->fw->size / 4, in obtain_one_firmware()
556 (fdet->fw->size - AUGMENT_SIZE) / 4, in obtain_one_firmware()
557 css->size); in obtain_one_firmware()
559 ret = -EINVAL; in obtain_one_firmware()
563 /* if returning an error, clean up after ourselves */ in obtain_one_firmware()
571 release_firmware(fdet->fw); in dispose_one_firmware()
657 if (fw_state == FW_EMPTY && dd->icode == ICODE_RTL_SILICON) { in __obtain_firmware()
664 fw_err = -ENOENT; in __obtain_firmware()
668 dd->icode != ICODE_FUNCTIONAL_SIMULATOR) in __obtain_firmware()
676 * Called by all HFIs when loading their firmware - i.e. device probe time.
701 fw_err = -ETIMEDOUT; in obtain_firmware()
810 for (; qw_size > 0; qw_size--, ptr++) in write_streamed_rsa_data()
816 * RSA_ENGINE_TIMEOUT before giving up.
840 dd_dev_err(dd, "%s security engine not idle - giving up\n", in run_rsa()
842 return -EBUSY; in run_rsa()
851 * The RSA engine is hooked up to two MISC errors. The driver in run_rsa()
859 * re-initializing the RSA engine, then clearing the status bit. in run_rsa()
860 * Do not re-init the RSA angine immediately after a successful in run_rsa()
861 * run - this will reset the current authorization. in run_rsa()
879 ret = -EINVAL; in run_rsa()
886 ret = -EINVAL; in run_rsa()
898 ret = -ETIMEDOUT; in run_rsa()
907 * errors. All current errors will stick - the RSA logic is keeping in run_rsa()
908 * error high. All previous errors will clear - the RSA logic in run_rsa()
935 write_rsa_data(dd, MISC_CFG_RSA_MODULUS, fdet->modulus, KEY_SIZE); in load_security_variables()
937 write_rsa_data(dd, MISC_CFG_RSA_R2, fdet->r2, KEY_SIZE); in load_security_variables()
939 write_rsa_data(dd, MISC_CFG_RSA_MU, fdet->mu, MU_SIZE); in load_security_variables()
942 (u8 *)fdet->css_header, in load_security_variables()
956 * Wait until the firmware is up and ready to take host requests.
957 * Return 0 on success, -ETIMEDOUT on timeout.
964 if (dd->icode == ICODE_FUNCTIONAL_SIMULATOR) in wait_fm_ready()
972 return -ETIMEDOUT; in wait_fm_ready()
973 usleep_range(1950, 2050); /* sleep 2ms-ish */ in wait_fm_ready()
994 * DC reset step 1: Reset DC8051 in load_8051_firmware()
1004 * DC reset step 2 (optional): Load 8051 data memory with link in load_8051_firmware()
1009 * DC reset step 3: Load DC8051 firmware in load_8051_firmware()
1015 /* Firmware load step 1 */ in load_8051_firmware()
1019 * Firmware load step 2. Clear MISC_CFG_FW_CTRL.FW_8051_LOADED in load_8051_firmware()
1023 /* Firmware load steps 3-5 */ in load_8051_firmware()
1024 ret = write_8051(dd, 1/*code*/, 0, fdet->firmware_ptr, in load_8051_firmware()
1025 fdet->firmware_len); in load_8051_firmware()
1030 * DC reset step 4. Host starts the DC8051 firmware in load_8051_firmware()
1033 * Firmware load step 6. Set MISC_CFG_FW_CTRL.FW_8051_LOADED in load_8051_firmware()
1037 /* Firmware load steps 7-10 */ in load_8051_firmware()
1038 ret = run_rsa(dd, "8051", fdet->signature); in load_8051_firmware()
1046 * DC reset step 5. Wait for firmware to be ready to accept host in load_8051_firmware()
1053 return -ETIMEDOUT; in load_8051_firmware()
1059 dd->dc8051_ver = dc8051_ver(ver_major, ver_minor, ver_patch); in load_8051_firmware()
1065 return -EIO; in load_8051_firmware()
1074 * No need for masking - the arguments are sized exactly.
1129 * + Must be called after fabric serdes broadcast is set up.
1130 * + Must be called before the 8051 is loaded - assumes 8051 is not loaded
1151 sbus_request(dd, fabric_serdes_broadcast[dd->hfi1_id], in turn_off_spicos()
1164 * re-download and validation of the fabric serdes firmware. This, as a
1165 * by-product, will reset the serdes. NOTE: the re-download requires that
1180 "Cannot acquire SBus resource to reset fabric SerDes - perhaps you should reboot\n"); in fabric_serdes_reset()
1186 /* A0 serdes do not work with a re-download */ in fabric_serdes_reset()
1187 u8 ra = fabric_serdes_broadcast[dd->hfi1_id]; in fabric_serdes_reset()
1200 * No need for firmware retry - what to download has already in fabric_serdes_reset()
1202 * No need to pay attention to the load return - the only in fabric_serdes_reset()
1240 return -ETIMEDOUT; in sbus_request_slow()
1251 return -ETIME; in sbus_request_slow()
1262 const u8 ra = fabric_serdes_broadcast[dd->hfi1_id]; /* receiver addr */ in load_fabric_serdes_firmware()
1266 /* step 1: load security variables */ in load_fabric_serdes_firmware()
1268 /* step 2: place SerDes in reset and disable SPICO */ in load_fabric_serdes_firmware()
1272 /* step 3: remove SerDes reset */ in load_fabric_serdes_firmware()
1274 /* step 4: assert IMEM override */ in load_fabric_serdes_firmware()
1276 /* step 5: download SerDes machine code */ in load_fabric_serdes_firmware()
1277 for (i = 0; i < fdet->firmware_len; i += 4) { in load_fabric_serdes_firmware()
1279 *(u32 *)&fdet->firmware_ptr[i]); in load_fabric_serdes_firmware()
1281 /* step 6: IMEM override off */ in load_fabric_serdes_firmware()
1283 /* step 7: turn ECC on */ in load_fabric_serdes_firmware()
1286 /* steps 8-11: run the RSA engine */ in load_fabric_serdes_firmware()
1287 err = run_rsa(dd, "fabric serdes", fdet->signature); in load_fabric_serdes_firmware()
1291 /* step 12: turn SPICO enable on */ in load_fabric_serdes_firmware()
1293 /* step 13: enable core hardware interrupts */ in load_fabric_serdes_firmware()
1307 /* step 1: load security variables */ in load_sbus_firmware()
1309 /* step 2: place SPICO into reset and enable off */ in load_sbus_firmware()
1311 /* step 3: remove reset, enable off, IMEM_CNTRL_EN on */ in load_sbus_firmware()
1313 /* step 4: set starting IMEM address for burst download */ in load_sbus_firmware()
1315 /* step 5: download the SBus Master machine code */ in load_sbus_firmware()
1316 for (i = 0; i < fdet->firmware_len; i += 4) { in load_sbus_firmware()
1318 *(u32 *)&fdet->firmware_ptr[i]); in load_sbus_firmware()
1320 /* step 6: set IMEM_CNTL_EN off */ in load_sbus_firmware()
1322 /* step 7: turn ECC on */ in load_sbus_firmware()
1325 /* steps 8-11: run the RSA engine */ in load_sbus_firmware()
1326 err = run_rsa(dd, "SBus", fdet->signature); in load_sbus_firmware()
1330 /* step 12: set SPICO_ENABLE on */ in load_sbus_firmware()
1344 /* step 1: load security variables */ in load_pcie_serdes_firmware()
1346 /* step 2: assert single step (halts the SBus Master spico) */ in load_pcie_serdes_firmware()
1348 /* step 3: enable XDMEM access */ in load_pcie_serdes_firmware()
1350 /* step 4: load firmware into SBus Master XDMEM */ in load_pcie_serdes_firmware()
1352 * NOTE: the dmem address, write_en, and wdata are all pre-packed, in load_pcie_serdes_firmware()
1353 * we only need to pick up the bytes and write them in load_pcie_serdes_firmware()
1355 for (i = 0; i < fdet->firmware_len; i += 4) { in load_pcie_serdes_firmware()
1357 *(u32 *)&fdet->firmware_ptr[i]); in load_pcie_serdes_firmware()
1359 /* step 5: disable XDMEM access */ in load_pcie_serdes_firmware()
1361 /* step 6: allow SBus Spico to run */ in load_pcie_serdes_firmware()
1365 * steps 7-11: run RSA, if it succeeds, firmware is available to in load_pcie_serdes_firmware()
1368 return run_rsa(dd, "PCIe serdes", fdet->signature); in load_pcie_serdes_firmware()
1377 while (--count >= 0) { in set_serdes_broadcast()
1380 * defaults for everything else. Do not read-modify-write, in set_serdes_broadcast()
1385 * ----- --------------------------------- in set_serdes_broadcast()
1399 u8 mask = 1 << dd->hfi1_id; in acquire_hw_mutex()
1424 (u32)user, (u32)mask, (try == 0) ? "retrying" : "giving up"); in acquire_hw_mutex()
1433 return -EBUSY; in acquire_hw_mutex()
1438 u8 mask = 1 << dd->hfi1_id; in release_hw_mutex()
1459 "%s: hardware mutex stuck - suggest rebooting the machine\n", in fail_mutex_acquire_message()
1466 * Return 0 on success, -EBUSY if resource busy, -EIO if mutex acquire failed.
1475 if (dd->pcidev->device == PCI_DEVICE_ID_INTEL0 && in __acquire_chip_resource()
1484 my_bit = resource_mask(dd->hfi1_id, resource); in __acquire_chip_resource()
1486 /* non-dynamic resources are not split between HFIs */ in __acquire_chip_resource()
1492 mutex_lock(&dd->asic_data->asic_resource_mutex); in __acquire_chip_resource()
1497 ret = -EIO; in __acquire_chip_resource()
1503 ret = -EBUSY; in __acquire_chip_resource()
1513 mutex_unlock(&dd->asic_data->asic_resource_mutex); in __acquire_chip_resource()
1518 * Acquire access to a chip resource, wait up to mswait milliseconds for
1521 * Return 0 on success, -EBUSY if busy (even after wait), -EIO if mutex
1532 if (ret != -EBUSY) in acquire_chip_resource()
1536 return -EBUSY; in acquire_chip_resource()
1554 bit = resource_mask(dd->hfi1_id, resource); in release_chip_resource()
1557 mutex_lock(&dd->asic_data->asic_resource_mutex); in release_chip_resource()
1572 __func__, dd->hfi1_id, resource); in release_chip_resource()
1578 mutex_unlock(&dd->asic_data->asic_resource_mutex); in release_chip_resource()
1591 bit = resource_mask(dd->hfi1_id, resource); in check_chip_resource()
1600 func, dd->hfi1_id, resource); in check_chip_resource()
1611 mutex_lock(&dd->asic_data->asic_resource_mutex); in clear_chip_resources()
1620 scratch0 &= ~resource_mask(dd->hfi1_id, CR_DYN_MASK); in clear_chip_resources()
1628 mutex_unlock(&dd->asic_data->asic_resource_mutex); in clear_chip_resources()
1676 fabric_serdes_broadcast[dd->hfi1_id], in load_firmware()
1677 fabric_serdes_addrs[dd->hfi1_id], in load_firmware()
1705 if (dd->icode != ICODE_RTL_SILICON) { in hfi1_firmware_init()
1712 if (dd->icode == ICODE_FUNCTIONAL_SIMULATOR) in hfi1_firmware_init()
1716 if (dd->icode == ICODE_RTL_SILICON) in hfi1_firmware_init()
1734 * (because we know it is invalid as we are building up the cache).
1741 struct platform_config_cache *pcfgcache = &dd->pcfg_cache; in check_meta_version()
1744 return -EINVAL; in check_meta_version()
1747 *(pcfgcache->config_tables[PLATFORM_CONFIG_SYSTEM_TABLE].table_metadata in check_meta_version()
1750 mask = ((1 << METADATA_TABLE_FIELD_START_LEN_BITS) - 1); in check_meta_version()
1755 mask = ((1 << METADATA_TABLE_FIELD_LEN_LEN_BITS) - 1); in check_meta_version()
1759 meta_ver = *((u8 *)system_table + ver_start) & ((1 << ver_len) - 1); in check_meta_version()
1764 return -EINVAL; in check_meta_version()
1771 struct platform_config_cache *pcfgcache = &dd->pcfg_cache; in parse_platform_config()
1772 struct hfi1_pportdata *ppd = dd->pport; in parse_platform_config()
1776 int ret = -EINVAL; /* assume failure */ in parse_platform_config()
1784 if (ppd->config_from_scratch) in parse_platform_config()
1787 if (!dd->platform_config.data) { in parse_platform_config()
1791 ptr = (u32 *)dd->platform_config.data; in parse_platform_config()
1817 if (file_length > dd->platform_config.size) { in parse_platform_config()
1821 } else if (file_length < dd->platform_config.size) { in parse_platform_config()
1829 * In both cases where we proceed, using the self-reported file length in parse_platform_config()
1833 while (ptr < (u32 *)(dd->platform_config.data + file_length)) { in parse_platform_config()
1838 __func__, (ptr - (u32 *) in parse_platform_config()
1839 dd->platform_config.data)); in parse_platform_config()
1844 ((1 << PLATFORM_CONFIG_HEADER_RECORD_IDX_LEN_BITS) - 1); in parse_platform_config()
1848 ((1 << PLATFORM_CONFIG_HEADER_TABLE_LENGTH_LEN_BITS) - 1); in parse_platform_config()
1851 ((1 << PLATFORM_CONFIG_HEADER_TABLE_TYPE_LEN_BITS) - 1); in parse_platform_config()
1860 pcfgcache->config_tables[table_type].num_table = in parse_platform_config()
1867 pcfgcache->config_tables[table_type].num_table = in parse_platform_config()
1874 pcfgcache->config_tables[table_type].num_table = in parse_platform_config()
1881 (ptr - (u32 *) in parse_platform_config()
1882 dd->platform_config.data)); in parse_platform_config()
1885 pcfgcache->config_tables[table_type].table = ptr; in parse_platform_config()
1900 (ptr - in parse_platform_config()
1901 (u32 *)dd->platform_config.data)); in parse_platform_config()
1904 pcfgcache->config_tables[table_type].table_metadata = in parse_platform_config()
1917 __func__, (ptr - in parse_platform_config()
1918 (u32 *)dd->platform_config.data)); in parse_platform_config()
1919 ret = -EINVAL; in parse_platform_config()
1926 pcfgcache->cache_valid = 1; in parse_platform_config()
1938 struct hfi1_pportdata *ppd = dd->pport; in get_integrated_platform_config_field()
1939 u8 *cache = ppd->qsfp_info.cache; in get_integrated_platform_config_field()
1945 *data = ppd->max_power_class; in get_integrated_platform_config_field()
1947 *data = ppd->default_atten; in get_integrated_platform_config_field()
1951 *data = ppd->port_type; in get_integrated_platform_config_field()
1953 *data = ppd->local_atten; in get_integrated_platform_config_field()
1955 *data = ppd->remote_atten; in get_integrated_platform_config_field()
1959 *data = (ppd->rx_preset & QSFP_RX_CDR_APPLY_SMASK) >> in get_integrated_platform_config_field()
1962 *data = (ppd->rx_preset & QSFP_RX_EMP_APPLY_SMASK) >> in get_integrated_platform_config_field()
1965 *data = (ppd->rx_preset & QSFP_RX_AMP_APPLY_SMASK) >> in get_integrated_platform_config_field()
1968 *data = (ppd->rx_preset & QSFP_RX_CDR_SMASK) >> in get_integrated_platform_config_field()
1971 *data = (ppd->rx_preset & QSFP_RX_EMP_SMASK) >> in get_integrated_platform_config_field()
1974 *data = (ppd->rx_preset & QSFP_RX_AMP_SMASK) >> in get_integrated_platform_config_field()
1979 tx_preset = ppd->tx_preset_eq; in get_integrated_platform_config_field()
1981 tx_preset = ppd->tx_preset_noeq; in get_integrated_platform_config_field()
2015 struct platform_config_cache *pcfgcache = &dd->pcfg_cache; in get_platform_fw_field_metadata()
2018 if (!pcfgcache->cache_valid) in get_platform_fw_field_metadata()
2019 return -EINVAL; in get_platform_fw_field_metadata()
2030 pcfgcache->config_tables[table].table_metadata + field; in get_platform_fw_field_metadata()
2038 return -EINVAL; in get_platform_fw_field_metadata()
2042 ((1 << METADATA_TABLE_FIELD_START_LEN_BITS) - 1); in get_platform_fw_field_metadata()
2046 & ((1 << METADATA_TABLE_FIELD_LEN_LEN_BITS) - 1); in get_platform_fw_field_metadata()
2056 * The non-obvious parameters:
2057 * @table_index: Acts as a look up key into which instance of the tables the
2074 struct platform_config_cache *pcfgcache = &dd->pcfg_cache; in get_platform_config_field()
2075 struct hfi1_pportdata *ppd = dd->pport; in get_platform_config_field()
2080 return -EINVAL; in get_platform_config_field()
2082 if (ppd->config_from_scratch) { in get_platform_config_field()
2095 return -EINVAL; in get_platform_config_field()
2103 src_ptr = pcfgcache->config_tables[table_type].table; in get_platform_config_field()
2107 return -EINVAL; in get_platform_config_field()
2124 src_ptr = dd->hfi1_id ? in get_platform_config_field()
2125 pcfgcache->config_tables[table_type].table + 4 : in get_platform_config_field()
2126 pcfgcache->config_tables[table_type].table; in get_platform_config_field()
2132 src_ptr = pcfgcache->config_tables[table_type].table; in get_platform_config_field()
2135 pcfgcache->config_tables[table_type].num_table) in get_platform_config_field()
2146 return -EINVAL; in get_platform_config_field()
2150 ((1 << field_len_bits) - 1); in get_platform_config_field()
2180 pcie_serdes_broadcast[dd->hfi1_id], in load_pcie_firmware()
2181 pcie_serdes_addrs[dd->hfi1_id], in load_pcie_firmware()
2205 dd->base_guid = read_csr(dd, DC_DC8051_CFG_LOCAL_GUID); in read_guid()
2207 (unsigned long long)dd->base_guid); in read_guid()
2242 rcv_addr = pcie_serdes_addrs[dd->hfi1_id][i]; in dump_fw_version()
2267 rcv_addr = fabric_serdes_addrs[dd->hfi1_id][i]; in dump_fw_version()