blob: 792d5144b09b6332cd26e270e4240ab1af81a3ac [file]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library ddk.protocol.platform.device;
using ddk.driver;
using zx;
struct PdevDeviceInfo {
uint32 vid;
uint32 pid;
uint32 did;
uint32 mmio_count;
uint32 irq_count;
uint32 gpio_count;
uint32 i2c_channel_count;
uint32 clk_count;
uint32 bti_count;
uint32 smc_count;
uint32 metadata_count;
array<uint32>:8 reserved;
string:32 name;
};
struct PdevBoardInfo {
/// Vendor ID for the board.
uint32 vid;
/// Product ID for the board.
uint32 pid;
/// Board name from the boot image platform ID record.
string:32 board_name;
/// Board specific revision number.
uint32 board_revision;
};
struct PdevMmio {
/// Offset from beginning of VMO where the mmio region begins.
zx.off offset;
/// Size of mmio region.
usize size;
handle<vmo> vmo;
};
[Layout="ddk-protocol", DefaultProtocol, HandleWrappers]
interface PDev {
1: GetMmio(uint32 index) -> (zx.status s, PdevMmio mmio);
2: MapMmio(uint32 index, uint32 cache_policy) -> (zx.status s, vector<voidptr>? vaddr,
zx.paddr paddr, handle<vmo> @handle);
3: GetInterrupt(uint32 index, uint32 flags) -> (zx.status s, handle<interrupt> irq);
4: GetBti(uint32 index) -> (zx.status s, handle<bti> bti);
5: GetSmc(uint32 index) -> (zx.status s, handle<resource> smc);
6: GetDeviceInfo() -> (zx.status s, PdevDeviceInfo info);
7: GetBoardInfo() -> (zx.status s, PdevBoardInfo info);
8: DeviceAdd (uint32 index, ddk.driver.DeviceAddArgs args) -> (zx.status s, ddk.driver.ZxDevice? device);
9: GetProtocol (uint32 proto_id, uint32 index) -> (zx.status s, vector<voidptr> out_protocol);
};