| // 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.pci; |
| |
| using zircon.syscalls.pci; |
| using zx; |
| |
| enum PciCfg : uint16 { |
| VENDOR_ID = 0x00; |
| DEVICE_ID = 0x02; |
| REVISION_ID = 0x08; |
| CLASS_CODE = 0x09; |
| SUBSYSTEM_VENDOR_ID = 0x2C; |
| SUBSYSTEM_ID = 0x2E; |
| CAPABILITIES_PTR = 0x34; |
| }; |
| |
| enum PciCapId : uint8 { |
| NULL = 0x00; |
| PCI_PWR_MGMT = 0x01; |
| AGP = 0x02; |
| VPD = 0x03; |
| MSI = 0x05; |
| PCIX = 0x07; |
| HYPERTRANSPORT = 0x08; |
| VENDOR = 0x09; |
| DEBUG_PORT = 0x0A; |
| COMPACT_PCI_CRC = 0x0B; |
| PCI_HOT_PLUG = 0x0C; |
| PCI_BRIDGE_SUBSYSTEM_VID = 0x0D; |
| AGP8X = 0x0E; |
| SECURE_DEVICE = 0x0F; |
| PCI_EXPRESS = 0x10; |
| MSIX = 0x11; |
| SATA_DATA_NDX_CFG = 0x12; |
| ADVANCED_FEATURES = 0x13; |
| ENHANCED_ALLOCATION = 0x14; |
| FLATTENING_PORTAL_BRIDGE = 0x15; |
| }; |
| |
| /// ZX-3927: Remove the zx_pcie types and implement them here |
| [Layout = "ddk-protocol"] |
| protocol Pci { |
| GetBar(uint32 bar_id) -> (zx.status s, zircon.syscalls.pci.ZxPciBar res); |
| EnableBusMaster(bool enable) -> (zx.status s); |
| ResetDevice() -> (zx.status s); |
| MapInterrupt(int32 which_irq) -> (zx.status s, handle<interrupt> @handle); |
| QueryIrqMode(zircon.syscalls.pci.ZxPciIrqMode mode) -> (zx.status s, uint32 max_irqs); |
| SetIrqMode(zircon.syscalls.pci.ZxPciIrqMode mode, uint32 requested_irq_count) -> (zx.status s); |
| GetDeviceInfo() -> (zx.status s, zircon.syscalls.pci.ZxPcieDeviceInfo info); |
| ConfigRead8(uint16 offset) -> (zx.status s, uint8 value); |
| ConfigRead16(uint16 offset) -> (zx.status s, uint16 value); |
| ConfigRead32(uint16 offset) -> (zx.status s, uint32 value); |
| ConfigWrite8(uint16 offset, uint8 value) -> (zx.status s); |
| ConfigWrite16(uint16 offset, uint16 value) -> (zx.status s); |
| ConfigWrite32(uint16 offset, uint32 value) -> (zx.status s); |
| GetNextCapability(uint8 id, uint8 offset) -> (zx.status s, uint8 offset); |
| GetFirstCapability(uint8 id) -> (zx.status s, uint8 offset); |
| GetAuxdata(string args) -> (zx.status s, vector<voidptr> data); |
| GetBti(uint32 index) -> (zx.status s, handle<bti> bti); |
| }; |