mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
SMCCC/PCI: Add initial PCI conduit definitions
Add constants, structures and build definition for the new standard SMCCC PCI conduit. These are documented in DEN0115A. https://developer.arm.com/documentation/den0115/latest Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> Change-Id: If667800a26b9ae88626e8d895674c9c2e8c09658
This commit is contained in:
parent
475333c8a9
commit
c7a28aa798
2 changed files with 62 additions and 0 deletions
59
include/services/pci_svc.h
Normal file
59
include/services/pci_svc.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PCI_SVC_H
|
||||||
|
#define PCI_SVC_H
|
||||||
|
|
||||||
|
#include <lib/utils_def.h>
|
||||||
|
|
||||||
|
/* SMCCC PCI platform functions */
|
||||||
|
#define SMC_PCI_VERSION U(0x84000130)
|
||||||
|
#define SMC_PCI_FEATURES U(0x84000131)
|
||||||
|
#define SMC_PCI_READ U(0x84000132)
|
||||||
|
#define SMC_PCI_WRITE U(0x84000133)
|
||||||
|
#define SMC_PCI_SEG_INFO U(0x84000134)
|
||||||
|
|
||||||
|
#define is_pci_fid(_fid) (((_fid) >= SMC_PCI_VERSION) && \
|
||||||
|
((_fid) <= SMC_PCI_SEG_INFO))
|
||||||
|
|
||||||
|
uint64_t pci_smc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2,
|
||||||
|
u_register_t x3, u_register_t x4, void *cookie,
|
||||||
|
void *handle, u_register_t flags);
|
||||||
|
|
||||||
|
#define PCI_ADDR_FUN(dev) ((dev) & U(0x7))
|
||||||
|
#define PCI_ADDR_DEV(dev) (((dev) >> U(3)) & U(0x001F))
|
||||||
|
#define PCI_ADDR_BUS(dev) (((dev) >> U(8)) & U(0x00FF))
|
||||||
|
#define PCI_ADDR_SEG(dev) (((dev) >> U(16)) & U(0xFFFF))
|
||||||
|
#define PCI_OFFSET_MASK U(0xFFF)
|
||||||
|
typedef union {
|
||||||
|
struct {
|
||||||
|
uint16_t minor;
|
||||||
|
uint16_t major;
|
||||||
|
} __packed;
|
||||||
|
uint32_t val;
|
||||||
|
} pcie_version;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* platforms are responsible for providing implementations of these
|
||||||
|
* three functions in a manner which conforms to the Arm PCI Configuration
|
||||||
|
* Space Access Firmware Interface (DEN0115) and the PCIe specification's
|
||||||
|
* sections on PCI configuration access. See the rpi4_pci_svc.c example.
|
||||||
|
*/
|
||||||
|
uint32_t pci_read_config(uint32_t addr, uint32_t off, uint32_t sz, uint32_t *val);
|
||||||
|
uint32_t pci_write_config(uint32_t addr, uint32_t off, uint32_t sz, uint32_t val);
|
||||||
|
uint32_t pci_get_bus_for_seg(uint32_t seg, uint32_t *bus_range, uint32_t *nseg);
|
||||||
|
|
||||||
|
/* Return codes for Arm PCI Config Space Access Firmware SMC calls */
|
||||||
|
#define SMC_PCI_CALL_SUCCESS U(0)
|
||||||
|
#define SMC_PCI_CALL_NOT_SUPPORTED -1
|
||||||
|
#define SMC_PCI_CALL_INVAL_PARAM -2
|
||||||
|
#define SMC_PCI_CALL_NOT_IMPL -3
|
||||||
|
|
||||||
|
#define SMC_PCI_SZ_8BIT U(1)
|
||||||
|
#define SMC_PCI_SZ_16BIT U(2)
|
||||||
|
#define SMC_PCI_SZ_32BIT U(4)
|
||||||
|
|
||||||
|
#endif /* PCI_SVC_H */
|
|
@ -212,6 +212,9 @@ SDEI_SUPPORT := 0
|
||||||
# True Random Number firmware Interface
|
# True Random Number firmware Interface
|
||||||
TRNG_SUPPORT := 0
|
TRNG_SUPPORT := 0
|
||||||
|
|
||||||
|
# SMCCC PCI support
|
||||||
|
SMC_PCI_SUPPORT := 0
|
||||||
|
|
||||||
# Whether code and read-only data should be put on separate memory pages. The
|
# Whether code and read-only data should be put on separate memory pages. The
|
||||||
# platform Makefile is free to override this value.
|
# platform Makefile is free to override this value.
|
||||||
SEPARATE_CODE_AND_RODATA := 0
|
SEPARATE_CODE_AND_RODATA := 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue