/* *PriortoARMv5thereisnoTCM,andtryingtoreadthestatus *registerwillhangtheprocessor.
*/ if (cpu_architecture() < CPU_ARCH_ARMv5) { if (dtcm_code_sz || itcm_code_sz)
pr_info("CPU TCM: %u bytes of DTCM and %u bytes of " "ITCM code compiled in, but no TCM present " "in pre-v5 CPU\n", dtcm_code_sz, itcm_code_sz); return;
}
tcm_status = read_cpuid_tcmstatus();
/* *Thiscodeonlysupportsv6-compatibleTCMTRimplementations.
*/ if (tcm_status & TCMTR_FORMAT_MASK) return;
/* Values greater than 2 for D/ITCM banks are "reserved" */ if (dtcm_banks > 2)
dtcm_banks = 0; if (itcm_banks > 2)
itcm_banks = 0;
/* Setup DTCM if present */ if (dtcm_banks > 0) { for (i = 0; i < dtcm_banks; i++) {
ret = setup_tcm_bank(0, i, dtcm_banks, &dtcm_end); if (ret) goto unregister;
} /* This means you compiled more code than fits into DTCM */ if (dtcm_code_sz > (dtcm_end - DTCM_OFFSET)) {
pr_info("CPU DTCM: %u bytes of code compiled to " "DTCM but only %lu bytes of DTCM present\n",
dtcm_code_sz, (dtcm_end - DTCM_OFFSET)); goto no_dtcm;
} /* *ThismeansthattheDTCMsizeswere0ortheDTCMbanks *wereinaccessibleduetoTrustZoneconfiguration.
*/ if (!(dtcm_end - DTCM_OFFSET)) goto no_dtcm;
dtcm_res.end = dtcm_end - 1;
request_resource(&iomem_resource, &dtcm_res);
dtcm_iomap[0].length = dtcm_end - DTCM_OFFSET;
iotable_init(dtcm_iomap, 1); /* Copy data from RAM to DTCM */
start = &__sdtcm_data;
end = &__edtcm_data;
ram = &__dtcm_start;
memcpy(start, ram, dtcm_code_sz);
pr_debug("CPU DTCM: copied data from %p - %p\n",
start, end);
dtcm_present = true;
} elseif (dtcm_code_sz) {
pr_info("CPU DTCM: %u bytes of code compiled to DTCM but no " "DTCM banks present in CPU\n", dtcm_code_sz);
}
no_dtcm: /* Setup ITCM if present */ if (itcm_banks > 0) { for (i = 0; i < itcm_banks; i++) {
ret = setup_tcm_bank(1, i, itcm_banks, &itcm_end); if (ret) goto unregister;
} /* This means you compiled more code than fits into ITCM */ if (itcm_code_sz > (itcm_end - ITCM_OFFSET)) {
pr_info("CPU ITCM: %u bytes of code compiled to " "ITCM but only %lu bytes of ITCM present\n",
itcm_code_sz, (itcm_end - ITCM_OFFSET)); goto unregister;
} /* *ThismeansthattheITCMsizeswere0ortheITCMbanks *wereinaccessibleduetoTrustZoneconfiguration.
*/ if (!(itcm_end - ITCM_OFFSET)) goto unregister;
itcm_res.end = itcm_end - 1;
request_resource(&iomem_resource, &itcm_res);
itcm_iomap[0].length = itcm_end - ITCM_OFFSET;
iotable_init(itcm_iomap, 1); /* Copy code from RAM to ITCM */
start = &__sitcm_text;
end = &__eitcm_text;
ram = &__itcm_start;
memcpy(start, ram, itcm_code_sz);
pr_debug("CPU ITCM: copied code from %p - %p\n",
start, end);
itcm_present = true;
} elseif (itcm_code_sz) {
pr_info("CPU ITCM: %u bytes of code compiled to ITCM but no " "ITCM banks present in CPU\n", itcm_code_sz);
}
/* Add the rest of DTCM to the TCM pool */ if (dtcm_present) { if (dtcm_pool_start < dtcm_end) {
ret = gen_pool_add(tcm_pool, dtcm_pool_start,
dtcm_end - dtcm_pool_start, -1); if (ret) {
pr_err("CPU DTCM: could not add DTCM " \ "remainder to pool!\n"); return ret;
}
pr_debug("CPU DTCM: Added %08x bytes @ %08x to " \ "the TCM memory pool\n",
dtcm_end - dtcm_pool_start,
dtcm_pool_start);
}
}
/* Add the rest of ITCM to the TCM pool */ if (itcm_present) { if (itcm_pool_start < itcm_end) {
ret = gen_pool_add(tcm_pool, itcm_pool_start,
itcm_end - itcm_pool_start, -1); if (ret) {
pr_err("CPU ITCM: could not add ITCM " \ "remainder to pool!\n"); return ret;
}
pr_debug("CPU ITCM: Added %08x bytes @ %08x to " \ "the TCM memory pool\n",
itcm_end - itcm_pool_start,
itcm_pool_start);
}
} return0;
}
core_initcall(setup_tcm_pool);
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.