blob: e838468b8b2fdb0a147259b8183a9b99e59cdfdd [file]
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/devices/tools/dmlc/dml.schema.json",
"title": "DriverManifestLanguage",
"description": "Draft-07 JSON Schema for Driver Manifest Language (DML) files (.dml). DML is a unified declarative manifest language for Fuchsia Driver Framework v2 (DFv2) compiled by dmlc into Component Manifests (.cml), Bind rules (.bind), FIDL board configurations, and C++/Rust metadata parsers.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the driver or board component. Used as default for generated CML, bind files, composite names, and driver binary paths."
},
"composite_name": {
"type": "string",
"description": "Optional override for the generated composite bind rule name. If omitted, defaults to 'name'."
},
"include": {
"type": "array",
"description": "List of shard manifests (.shard.dml) or CML shards (.shard.cml) to merge into this manifest.",
"items": {
"type": "string"
},
"default": []
},
"program": {
"$ref": "#/definitions/Program",
"description": "Execution parameters, binary paths, driver dispatcher options, and bind rules for the driver component."
},
"use": {
"type": "array",
"description": "Capabilities used by the driver, parent node specifications for composite drivers, and hardware dependencies.",
"items": {
"$ref": "#/definitions/UseEntry"
},
"default": []
},
"capabilities": {
"type": "array",
"description": "Capabilities provided by this driver (services, protocols, and metadata definitions).",
"items": {
"$ref": "#/definitions/CapabilityEntry"
},
"default": []
},
"expose": {
"type": "array",
"description": "Capabilities exposed by this driver to the framework or parent component.",
"items": {
"$ref": "#/definitions/ExposeEntry"
},
"default": []
},
"config": {
"type": "object",
"description": "Structured configuration schema for the driver component."
},
"children": {
"type": "array",
"description": "Board manifest: list of child devices and drivers to be bound or instantiated by the board driver.",
"items": {
"$ref": "#/definitions/BoardChild"
},
"default": []
},
"offer": {
"type": "array",
"description": "Board manifest: service capability routes, parameters, and pin/channel constraints offered between board nodes and children.",
"items": {
"$ref": "#/definitions/BoardOffer"
},
"default": []
},
"offers": {
"type": "array",
"description": "Board manifest: service capability routes, parameters, and pin/channel constraints offered between board nodes and children. (Deprecated: use 'offer')",
"items": {
"$ref": "#/definitions/BoardOffer"
},
"default": []
},
"metadata_mappings": {
"type": "array",
"description": "Board manifest: rules for aggregating configuration metadata across board children into structured FIDL metadata.",
"items": {
"$ref": "#/definitions/MetadataMapping"
},
"default": []
},
"iommus": {
"type": "array",
"description": "Board manifest: list of IOMMUs registered with the platform bus.",
"items": {
"$ref": "#/definitions/BoardIommu"
},
"default": []
}
},
"definitions": {
"PropertyValue": {
"description": "A node property or bind rule literal value (string, integer, or boolean).",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "boolean"
}
]
},
"AcceptOrValue": {
"description": "A single property value or an array of values generating an 'accept <property> { ... }' bind block.",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "boolean"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/PropertyValue"
}
}
]
},
"RuleValue": {
"description": "A bind rule match expression: exact value, accept array, or inequality constraint (e.g. {'neq': 1}).",
"oneOf": [
{
"type": "string"
},
{
"type": "integer"
},
{
"type": "boolean"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/PropertyValue"
}
},
{
"type": "object",
"properties": {
"neq": {
"$ref": "#/definitions/PropertyValue",
"description": "Inequality value to match (generates '<key> != <value>;')."
}
},
"required": [
"neq"
],
"additionalProperties": false
}
]
},
"PciBind": {
"type": "object",
"description": "PCI bus bind rules matching vendor, device, class, subclass, interface, revision, and topology.",
"properties": {
"vid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Vendor ID (e.g. '0x1234' or 'fuchsia.pci.BIND_PCI_VID.INTEL'). Matches fuchsia.BIND_PCI_VID."
},
"did": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Device ID (e.g. '0x0042'). Matches fuchsia.BIND_PCI_DID."
},
"class": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Base Class Code (e.g. 'fuchsia.pci.BIND_PCI_CLASS.GENERIC_SYSTEM_PERIPHERAL' or '0x01'). Matches fuchsia.BIND_PCI_CLASS."
},
"subclass": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Subclass Code (e.g. '0x05'). Matches fuchsia.BIND_PCI_SUBCLASS."
},
"interface": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Programming Interface Code (e.g. '0x01'). Matches fuchsia.BIND_PCI_INTERFACE."
},
"revision": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Device Revision ID (e.g. '0x04'). Matches fuchsia.BIND_PCI_REVISION."
},
"topo": {
"$ref": "#/definitions/AcceptOrValue",
"description": "PCI Bus Topology (e.g. '0x05'). Matches fuchsia.BIND_PCI_TOPO."
}
},
"additionalProperties": false
},
"UsbBind": {
"type": "object",
"description": "USB bus bind rules matching vendor, product, class, subclass, protocol, and interface number.",
"properties": {
"vid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Vendor ID (e.g. 'fuchsia.usb.BIND_USB_VID.GOOGLE' or '0x1234'). Matches fuchsia.BIND_USB_VID."
},
"pid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Product ID (e.g. '0x5678'). Matches fuchsia.BIND_USB_PID."
},
"class": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Device/Interface Class Code (e.g. 'fuchsia.usb.BIND_USB_CLASS.MASS_STORAGE' or '0x01'). Matches fuchsia.BIND_USB_CLASS."
},
"subclass": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Subclass Code (e.g. '0x02'). Matches fuchsia.BIND_USB_SUBCLASS."
},
"protocol": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Protocol Code (e.g. 0). Matches fuchsia.BIND_USB_PROTOCOL."
},
"interface_number": {
"$ref": "#/definitions/AcceptOrValue",
"description": "USB Interface Number (e.g. 1). Matches fuchsia.BIND_USB_INTERFACE_NUMBER."
},
"interface": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Alias for interface_number."
},
"bind_protocol": {
"type": "string",
"description": "USB Bind Protocol (e.g. 'fuchsia.usb.BIND_PROTOCOL.INTERFACE'). Matches fuchsia.BIND_PROTOCOL."
}
},
"additionalProperties": false
},
"AcpiBind": {
"type": "object",
"description": "ACPI bus bind rules matching hardware ID (HID), compatible ID (first CID), and bus type.",
"properties": {
"hid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "ACPI Hardware ID string (e.g. 'PNP0C0A'). Matches fuchsia.acpi.HID."
},
"first_cid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "ACPI First Compatible ID string (e.g. 'PNP0C0B'). Matches fuchsia.acpi.FIRST_CID."
},
"bus_type": {
"$ref": "#/definitions/AcceptOrValue",
"description": "ACPI Bus Type (e.g. 'fuchsia.acpi.BIND_ACPI_BUS_TYPE.PCI' or 'fuchsia.acpi.BIND_ACPI_BUS_TYPE.I2C'). Matches fuchsia.BIND_ACPI_BUS_TYPE."
}
},
"additionalProperties": false
},
"DmlBind": {
"type": "object",
"description": "Hardware and service bind rules for non-composite drivers or specific parent nodes of composite drivers.",
"properties": {
"protocol": {
"type": "string",
"description": "fuchsia.BIND_PROTOCOL match string (e.g. 'fuchsia.platform.BIND_PROTOCOL.DEVICE')."
},
"service": {
"type": "string",
"description": "fuchsia.Service match string (e.g. 'fuchsia.hardware.pci.Service')."
},
"banjo": {
"type": "string",
"description": "Banjo protocol match string (generates 'fuchsia.BIND_PROTOCOL == <banjo>;')."
},
"transport": {
"type": "string",
"description": "Transport mechanism (e.g. 'Zircon', 'Driver', 'Banjo')."
},
"vid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Platform device Vendor ID (fuchsia.BIND_PLATFORM_DEV_VID)."
},
"pid": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Platform device Product ID (fuchsia.BIND_PLATFORM_DEV_PID)."
},
"did": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Platform device Device ID (fuchsia.BIND_PLATFORM_DEV_DID)."
},
"compat": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Devicetree/OpenFirmware compatible string (fuchsia.COMPATIBLE). Supports string or array for 'accept'."
},
"match_name": {
"type": "boolean",
"description": "If true, automatically generates a 'fuchsia.NAME == <parent_name>' rule matching the parent node's name."
},
"node_name": {
"$ref": "#/definitions/AcceptOrValue",
"description": "Explicit node name rule (fuchsia.NAME). Supports string or array for 'accept'."
},
"pci": {
"$ref": "#/definitions/PciBind"
},
"usb": {
"$ref": "#/definitions/UsbBind"
},
"acpi": {
"$ref": "#/definitions/AcpiBind"
},
"one_of": {
"type": "array",
"description": "Conditional branching alternative bind rules (emits 'if ... else if ... else ...').",
"items": {
"$ref": "#/definitions/DmlBind"
}
},
"rules": {
"type": "object",
"description": "Arbitrary bind rules matching property names to values, accept arrays, or inequality constraints.",
"additionalProperties": {
"$ref": "#/definitions/RuleValue"
}
},
"primary": {
"$ref": "#/definitions/BindPrimary",
"description": "Explicit primary parent node definition for composite drivers."
},
"name": {
"type": "string",
"description": "Composite bind name override (alias of composite_name)."
},
"composite_name": {
"type": "string",
"description": "Composite bind name override."
}
},
"additionalProperties": false
},
"BindPrimary": {
"type": "object",
"description": "Explicit primary parent node definition inside a composite bind block.",
"properties": {
"node": {
"type": "string",
"description": "Name of the primary parent node."
},
"compat": {
"$ref": "#/definitions/AcceptOrValue"
},
"vid": {
"$ref": "#/definitions/AcceptOrValue"
},
"pid": {
"$ref": "#/definitions/AcceptOrValue"
},
"did": {
"$ref": "#/definitions/AcceptOrValue"
},
"protocol": {
"type": "string"
},
"service": {
"type": "string"
},
"banjo": {
"type": "string"
},
"transport": {
"type": "string"
},
"pci": {
"$ref": "#/definitions/PciBind"
},
"usb": {
"$ref": "#/definitions/UsbBind"
},
"acpi": {
"$ref": "#/definitions/AcpiBind"
},
"node_name": {
"$ref": "#/definitions/AcceptOrValue"
},
"match_name": {
"type": "boolean"
},
"one_of": {
"type": "array",
"items": {
"$ref": "#/definitions/DmlBind"
}
},
"rules": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/RuleValue"
}
}
},
"required": [
"node"
],
"additionalProperties": false
},
"Program": {
"type": "object",
"description": "Execution parameters, binary paths, driver dispatcher options, and bind rules for the driver component.",
"properties": {
"runner": {
"type": "string",
"description": "Component runner name (default: 'driver')."
},
"binary": {
"type": "string",
"description": "Path to driver shared library (e.g. 'driver/my_driver.so'). Defaults to 'driver/<name>.so'."
},
"compat": {
"type": "string",
"description": "Path to DFv1 compatibility driver shared library (e.g. 'driver/my_compat.so')."
},
"colocate": {
"type": [
"string",
"boolean"
],
"description": "Whether to colocate the driver in its parent's driver host ('true' or true)."
},
"default_dispatcher_opts": {
"type": "array",
"description": "Options for the driver default dispatcher (e.g. ['allow_sync_calls']).",
"items": {
"type": "string"
}
},
"bind": {
"$ref": "#/definitions/DmlBind",
"description": "Structured bind rules for non-composite drivers. Note: string bind file paths are not supported."
},
"requirements": {
"$ref": "#/definitions/DmlBind",
"description": "Alias for 'bind'."
},
"driver_name": {
"type": "string",
"description": "Driver name override, typically used in board manifests."
},
"service_connect_validation": {
"type": "boolean",
"description": "Whether to enable service connect validation (default: false).",
"default": false
}
}
},
"UseEntry": {
"type": "object",
"description": "Capability consumption and composite parent node specification.",
"properties": {
"service": {
"type": "string",
"description": "FIDL service name (e.g. 'fuchsia.hardware.gpio.Service')."
},
"protocol": {
"type": [
"string",
"array"
],
"description": "FIDL or Banjo protocol name, or array of protocol names."
},
"banjo": {
"type": "string",
"description": "Banjo protocol capability (e.g. 'fuchsia.gpio.BIND_PROTOCOL.DEVICE')."
},
"name": {
"type": "string",
"description": "Name of the parent node in a composite driver or capability instance name."
},
"instance_name": {
"type": "string",
"description": "Alias for 'name'."
},
"availability": {
"type": "string",
"enum": [
"required",
"optional",
"same_as_target",
"transitional"
],
"description": "Availability of the capability or parent node ('required' or 'optional')."
},
"primary": {
"type": "boolean",
"description": "Marks this use entry as the primary parent node of a composite driver."
},
"transport": {
"type": "string",
"description": "Transport mechanism for the service connection (e.g. 'Zircon', 'Driver', 'Banjo')."
},
"generate_bind_rule": {
"type": "boolean",
"description": "Whether to generate a parent bind rule for this entry (default: true). Set false for framework services not bound to nodes."
},
"generate_bind_rules": {
"type": "boolean",
"description": "Alias for generate_bind_rule."
},
"bind": {
"$ref": "#/definitions/DmlBind",
"description": "Inline bind rules for this composite parent node."
},
"requirements": {
"$ref": "#/definitions/DmlBind",
"description": "Alias for bind."
},
"from": {
"type": "string",
"description": "Standard CML source of capability (e.g. 'parent', 'framework', or a child node name)."
},
"path": {
"type": "string",
"description": "Standard CML namespace path to install the capability."
},
"as": {
"type": "string",
"description": "Standard CML alias name for the capability in the driver's namespace."
},
"rights": {
"type": "array",
"items": {
"type": "string"
},
"description": "Standard CML directory rights."
},
"subdir": {
"type": "string",
"description": "Standard CML directory subdirectory."
}
}
},
"CapabilityEntry": {
"type": "object",
"description": "Capability declaration exposed by this driver.",
"properties": {
"service": {
"type": [
"string",
"array"
],
"description": "FIDL service name or list of services."
},
"protocol": {
"type": [
"string",
"array"
],
"description": "FIDL protocol name or list of protocols."
},
"metadata": {
"$ref": "#/definitions/DriverMetadataSchemaDef",
"description": "Metadata schema definition for generating C++/Rust types and parsers."
}
}
},
"DriverMetadataSchemaDef": {
"type": "object",
"description": "Metadata schema definition for generating C++/Rust types and parsers.",
"properties": {
"id": {
"type": "string",
"description": "Unique metadata identifier string (e.g. 'fuchsia.hardware.gpio.Metadata')."
},
"schema": {
"type": "object",
"description": "Draft-07 JSON Schema defining the layout, structs, enums, and properties of the metadata."
}
},
"required": [
"id"
]
},
"ExposeEntry": {
"type": "object",
"description": "Capability exposition declaration.",
"properties": {
"service": {
"type": [
"string",
"array"
],
"description": "FIDL service name or array of service names."
},
"protocol": {
"type": [
"string",
"array"
],
"description": "FIDL protocol name or array of protocol names."
},
"from": {
"type": "string",
"description": "Source of capability (typically 'self')."
},
"to": {
"type": "string",
"description": "Destination of capability (e.g. 'parent' or 'framework')."
},
"as": {
"type": "string",
"description": "Alias name under which the capability is exposed."
}
}
},
"BoardChild": {
"type": "object",
"description": "Child device or driver node declared in a board manifest.",
"properties": {
"name": {
"type": "string",
"description": "Topological name of the child device/node."
},
"id": {
"type": "integer",
"minimum": 0,
"description": "Optional numerical ID for the device node."
},
"url": {
"type": "string",
"description": "Component URL for the driver to bind to this child (e.g. 'fuchsia-pkg://...')."
},
"compatible": {
"type": "string",
"description": "Devicetree/platform compatible string for this child."
},
"disabled": {
"type": "boolean",
"description": "Whether this device node is disabled by default unless enabled at runtime."
},
"driver_host": {
"type": "string",
"description": "Optional driver host colocation identifier (e.g. '#gpio', '#usb')."
},
"metadata": {
"type": "array",
"description": "Static metadata payloads attached to this child node.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Metadata type identifier."
},
"data": {
"type": "array",
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"description": "Raw byte array payload."
}
},
"required": [
"id"
]
},
"default": []
}
},
"required": [
"name"
]
},
"BoardOffer": {
"type": "object",
"description": "Capability routing and hardware constraints between board children and controllers.",
"properties": {
"from": {
"type": "string",
"description": "Source node reference (e.g. '#gpio-controller' or 'parent')."
},
"to": {
"type": "string",
"description": "Destination node reference (e.g. '#adc-buttons')."
},
"service": {
"type": "string",
"description": "FIDL service being offered."
},
"name": {
"type": "string",
"description": "Instance or capability name."
},
"constraints": {
"type": "object",
"description": "Board-specific hardware constraints (e.g. pin: 92, channel: 2, states: [...])."
}
},
"required": [
"to"
]
},
"MetadataMapping": {
"type": "object",
"description": "Rule for aggregating child device properties into board-level FIDL metadata dictionaries.",
"properties": {
"metadata_id": {
"type": "string",
"description": "FIDL metadata identifier string."
},
"aggregations": {
"type": "array",
"description": "Aggregation rules for this metadata ID.",
"items": {
"type": "object",
"properties": {
"service": {
"type": "string",
"description": "FIDL service name being aggregated."
},
"field": {
"type": "string",
"description": "Target struct field in the metadata."
},
"use_node_name": {
"type": "boolean",
"description": "Whether to key the dictionary entry by the child node name.",
"default": false
},
"auto_increment": {
"type": "string",
"description": "Field name to automatically populate with an incrementing integer ID."
}
},
"required": [
"service",
"field"
]
}
}
},
"required": [
"metadata_id",
"aggregations"
]
},
"BoardIommu": {
"type": "object",
"description": "IOMMU declaration registered with the platform bus.",
"properties": {
"name": {
"type": "string",
"description": "Unique identifier or name of the IOMMU."
},
"id": {
"type": "integer",
"minimum": 1,
"description": "Optional explicit numeric IOMMU ID (IDs starting from 1; 0 is reserved)."
},
"arm_smmu": {
"type": "object",
"description": "ARM SMMU configuration.",
"properties": {
"base_address": {
"type": "integer",
"minimum": 0,
"description": "Base register address for the ARM SMMU."
}
},
"required": [
"base_address"
]
},
"stub_iommu": {
"type": "object",
"description": "Stub IOMMU configuration."
}
},
"required": [
"name"
],
"oneOf": [
{
"required": [
"arm_smmu"
]
},
{
"required": [
"stub_iommu"
]
}
]
}
}
}