Lines Matching refs:smem
337 static int qcom_smem_alloc_private(struct qcom_smem *smem, in qcom_smem_alloc_private() argument
352 dev_err(smem->dev, in qcom_smem_alloc_private()
367 dev_err(smem->dev, "Out of memory\n"); in qcom_smem_alloc_private()
388 static int qcom_smem_alloc_global(struct qcom_smem *smem, in qcom_smem_alloc_global() argument
395 header = smem->regions[0].virt_base; in qcom_smem_alloc_global()
460 static void *qcom_smem_get_global(struct qcom_smem *smem, in qcom_smem_get_global() argument
470 header = smem->regions[0].virt_base; in qcom_smem_get_global()
477 for (i = 0; i < smem->num_regions; i++) { in qcom_smem_get_global()
478 area = &smem->regions[i]; in qcom_smem_get_global()
490 static void *qcom_smem_get_private(struct qcom_smem *smem, in qcom_smem_get_private() argument
539 dev_err(smem->dev, "Found invalid canary in hosts %d:%d partition\n", in qcom_smem_get_private()
614 static int qcom_smem_get_sbl_version(struct qcom_smem *smem) in qcom_smem_get_sbl_version() argument
619 header = smem->regions[0].virt_base; in qcom_smem_get_sbl_version()
625 static struct smem_ptable *qcom_smem_get_ptable(struct qcom_smem *smem) in qcom_smem_get_ptable() argument
630 ptable = smem->regions[0].virt_base + smem->regions[0].size - SZ_4K; in qcom_smem_get_ptable()
636 dev_err(smem->dev, in qcom_smem_get_ptable()
643 static u32 qcom_smem_get_item_count(struct qcom_smem *smem) in qcom_smem_get_item_count() argument
648 ptable = qcom_smem_get_ptable(smem); in qcom_smem_get_item_count()
659 static int qcom_smem_set_global_partition(struct qcom_smem *smem) in qcom_smem_set_global_partition() argument
667 ptable = qcom_smem_get_ptable(smem); in qcom_smem_set_global_partition()
681 dev_err(smem->dev, "Missing entry for global partition\n"); in qcom_smem_set_global_partition()
686 dev_err(smem->dev, "Invalid entry for global partition\n"); in qcom_smem_set_global_partition()
690 if (smem->global_partition) { in qcom_smem_set_global_partition()
691 dev_err(smem->dev, "Already found the global partition\n"); in qcom_smem_set_global_partition()
695 header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); in qcom_smem_set_global_partition()
700 dev_err(smem->dev, "Global partition has invalid magic\n"); in qcom_smem_set_global_partition()
705 dev_err(smem->dev, "Global partition hosts are invalid\n"); in qcom_smem_set_global_partition()
710 dev_err(smem->dev, "Global partition has invalid size\n"); in qcom_smem_set_global_partition()
716 dev_err(smem->dev, in qcom_smem_set_global_partition()
721 smem->global_partition = header; in qcom_smem_set_global_partition()
722 smem->global_cacheline = le32_to_cpu(entry->cacheline); in qcom_smem_set_global_partition()
727 static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, in qcom_smem_enumerate_partitions() argument
737 ptable = qcom_smem_get_ptable(smem); in qcom_smem_enumerate_partitions()
761 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
767 if (smem->partitions[remote_host]) { in qcom_smem_enumerate_partitions()
768 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
774 header = smem->regions[0].virt_base + le32_to_cpu(entry->offset); in qcom_smem_enumerate_partitions()
780 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
786 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
792 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
798 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
804 dev_err(smem->dev, in qcom_smem_enumerate_partitions()
809 smem->partitions[remote_host] = header; in qcom_smem_enumerate_partitions()
810 smem->cacheline[remote_host] = le32_to_cpu(entry->cacheline); in qcom_smem_enumerate_partitions()
816 static int qcom_smem_map_memory(struct qcom_smem *smem, struct udevice *dev, in qcom_smem_map_memory() argument
833 smem->regions[i].aux_base = (u32)r.start; in qcom_smem_map_memory()
834 smem->regions[i].size = fdt_resource_size(&r); in qcom_smem_map_memory()
835 smem->regions[i].virt_base = devm_ioremap(dev, r.start, fdt_resource_size(&r)); in qcom_smem_map_memory()
836 if (!smem->regions[i].virt_base) in qcom_smem_map_memory()
845 struct qcom_smem *smem; in qcom_smem_probe() local
857 smem = devm_kzalloc(dev, sizeof(*smem) + array_size, GFP_KERNEL); in qcom_smem_probe()
858 if (!smem) in qcom_smem_probe()
861 smem->dev = dev; in qcom_smem_probe()
862 smem->num_regions = num_regions; in qcom_smem_probe()
864 ret = qcom_smem_map_memory(smem, dev, "memory-region", 0); in qcom_smem_probe()
869 ret = qcom_smem_map_memory(smem, dev, in qcom_smem_probe()
875 header = smem->regions[0].virt_base; in qcom_smem_probe()
882 version = qcom_smem_get_sbl_version(smem); in qcom_smem_probe()
885 ret = qcom_smem_set_global_partition(smem); in qcom_smem_probe()
888 smem->item_count = qcom_smem_get_item_count(smem); in qcom_smem_probe()
891 smem->item_count = SMEM_ITEM_COUNT; in qcom_smem_probe()
898 ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS); in qcom_smem_probe()
902 __smem = smem; in qcom_smem_probe()