drivers/tee/qcomtee/primordial_obj.c
Source file repositories/reference/linux-study-clean/drivers/tee/qcomtee/primordial_obj.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tee/qcomtee/primordial_obj.c- Extension
.c- Size
- 3017 bytes
- Lines
- 114
- Domain
- Driver Families
- Bucket
- drivers/tee
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hqcomtee.h
Detected Declarations
struct qcomtee_mapping_infofunction qcomtee_primordial_obj_dispatchfunction qcomtee_primordial_obj_notify
Annotated Snippet
struct qcomtee_mapping_info {
u64 paddr;
u64 len;
u32 perms;
} __packed;
static int
qcomtee_primordial_obj_dispatch(struct qcomtee_object_invoke_ctx *oic,
struct qcomtee_object *primordial_object_unused,
u32 op, struct qcomtee_arg *args)
{
struct qcomtee_mapping_info *map_info;
struct qcomtee_object *mem_object;
struct qcomtee_object *map_object;
int err = 0;
switch (op) {
case QCOMTEE_OBJECT_OP_YIELD:
cond_resched();
/* No output object. */
oic->data = NULL;
break;
case QCOMTEE_OBJECT_OP_SLEEP:
/* Check message format matched QCOMTEE_OBJECT_OP_SLEEP op. */
if (qcomtee_args_len(args) != 1 ||
args[0].type != QCOMTEE_ARG_TYPE_IB ||
args[0].b.size < sizeof(u32))
return -EINVAL;
msleep(*(u32 *)(args[0].b.addr));
/* No output object. */
oic->data = NULL;
break;
case QCOMTEE_OBJECT_OP_MAP_REGION:
if (qcomtee_args_len(args) != 3 ||
args[0].type != QCOMTEE_ARG_TYPE_OB ||
args[1].type != QCOMTEE_ARG_TYPE_IO ||
args[2].type != QCOMTEE_ARG_TYPE_OO ||
args[0].b.size < sizeof(struct qcomtee_mapping_info))
return -EINVAL;
map_info = args[0].b.addr;
mem_object = args[1].o;
qcomtee_mem_object_map(mem_object, &map_object,
&map_info->paddr, &map_info->len,
&map_info->perms);
args[2].o = map_object;
/* One output object; pass it for cleanup to notify. */
oic->data = map_object;
qcomtee_object_put(mem_object);
break;
default:
err = -EINVAL;
}
return err;
}
/* Called after submitting the callback response. */
static void qcomtee_primordial_obj_notify(struct qcomtee_object_invoke_ctx *oic,
struct qcomtee_object *unused,
int err)
{
struct qcomtee_object *object = oic->data;
/* If err, QTEE did not obtain mapping object. Drop it. */
if (object && err)
qcomtee_object_put(object);
}
static struct qcomtee_object_operations qcomtee_primordial_obj_ops = {
.dispatch = qcomtee_primordial_obj_dispatch,
.notify = qcomtee_primordial_obj_notify,
};
struct qcomtee_object qcomtee_primordial_object = {
.name = "primordial",
.object_type = QCOMTEE_OBJECT_TYPE_CB,
.ops = &qcomtee_primordial_obj_ops
};
Annotation
- Immediate include surface: `linux/delay.h`, `qcomtee.h`.
- Detected declarations: `struct qcomtee_mapping_info`, `function qcomtee_primordial_obj_dispatch`, `function qcomtee_primordial_obj_notify`.
- Atlas domain: Driver Families / drivers/tee.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.