162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * Driver for AMD network controllers and boards 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2021, Xilinx, Inc. 662306a36Sopenharmony_ci * Copyright (C) 2022-2023, Advanced Micro Devices, Inc. 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef MC_CDX_PCOL_H 1062306a36Sopenharmony_ci#define MC_CDX_PCOL_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci/* The current version of the MCDI protocol. */ 1362306a36Sopenharmony_ci#define MCDI_PCOL_VERSION 2 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * Each MCDI request starts with an MCDI_HEADER, which is a 32bit 1762306a36Sopenharmony_ci * structure, filled in by the client. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * 0 7 8 16 20 22 23 24 31 2062306a36Sopenharmony_ci * | CODE | R | LEN | SEQ | Rsvd | E | R | XFLAGS | 2162306a36Sopenharmony_ci * | | | 2262306a36Sopenharmony_ci * | | \--- Response 2362306a36Sopenharmony_ci * | \------- Error 2462306a36Sopenharmony_ci * \------------------------------ Resync (always set) 2562306a36Sopenharmony_ci * 2662306a36Sopenharmony_ci * The client writes its request into MC shared memory, and rings the 2762306a36Sopenharmony_ci * doorbell. Each request is completed either by the MC writing 2862306a36Sopenharmony_ci * back into shared memory, or by writing out an event. 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * All MCDI commands support completion by shared memory response. Each 3162306a36Sopenharmony_ci * request may also contain additional data (accounted for by HEADER.LEN), 3262306a36Sopenharmony_ci * and some responses may also contain additional data (again, accounted 3362306a36Sopenharmony_ci * for by HEADER.LEN). 3462306a36Sopenharmony_ci * 3562306a36Sopenharmony_ci * Some MCDI commands support completion by event, in which any associated 3662306a36Sopenharmony_ci * response data is included in the event. 3762306a36Sopenharmony_ci * 3862306a36Sopenharmony_ci * The protocol requires one response to be delivered for every request; a 3962306a36Sopenharmony_ci * request should not be sent unless the response for the previous request 4062306a36Sopenharmony_ci * has been received (either by polling shared memory, or by receiving 4162306a36Sopenharmony_ci * an event). 4262306a36Sopenharmony_ci */ 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci/** Request/Response structure */ 4562306a36Sopenharmony_ci#define MCDI_HEADER_OFST 0 4662306a36Sopenharmony_ci#define MCDI_HEADER_CODE_LBN 0 4762306a36Sopenharmony_ci#define MCDI_HEADER_CODE_WIDTH 7 4862306a36Sopenharmony_ci#define MCDI_HEADER_RESYNC_LBN 7 4962306a36Sopenharmony_ci#define MCDI_HEADER_RESYNC_WIDTH 1 5062306a36Sopenharmony_ci#define MCDI_HEADER_DATALEN_LBN 8 5162306a36Sopenharmony_ci#define MCDI_HEADER_DATALEN_WIDTH 8 5262306a36Sopenharmony_ci#define MCDI_HEADER_SEQ_LBN 16 5362306a36Sopenharmony_ci#define MCDI_HEADER_SEQ_WIDTH 4 5462306a36Sopenharmony_ci#define MCDI_HEADER_RSVD_LBN 20 5562306a36Sopenharmony_ci#define MCDI_HEADER_RSVD_WIDTH 1 5662306a36Sopenharmony_ci#define MCDI_HEADER_NOT_EPOCH_LBN 21 5762306a36Sopenharmony_ci#define MCDI_HEADER_NOT_EPOCH_WIDTH 1 5862306a36Sopenharmony_ci#define MCDI_HEADER_ERROR_LBN 22 5962306a36Sopenharmony_ci#define MCDI_HEADER_ERROR_WIDTH 1 6062306a36Sopenharmony_ci#define MCDI_HEADER_RESPONSE_LBN 23 6162306a36Sopenharmony_ci#define MCDI_HEADER_RESPONSE_WIDTH 1 6262306a36Sopenharmony_ci#define MCDI_HEADER_XFLAGS_LBN 24 6362306a36Sopenharmony_ci#define MCDI_HEADER_XFLAGS_WIDTH 8 6462306a36Sopenharmony_ci/* Request response using event */ 6562306a36Sopenharmony_ci#define MCDI_HEADER_XFLAGS_EVREQ 0x01 6662306a36Sopenharmony_ci/* Request (and signal) early doorbell return */ 6762306a36Sopenharmony_ci#define MCDI_HEADER_XFLAGS_DBRET 0x02 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci/* Maximum number of payload bytes */ 7062306a36Sopenharmony_ci#define MCDI_CTL_SDU_LEN_MAX_V2 0x400 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define MCDI_CTL_SDU_LEN_MAX MCDI_CTL_SDU_LEN_MAX_V2 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci/* 7562306a36Sopenharmony_ci * The MC can generate events for two reasons: 7662306a36Sopenharmony_ci * - To advance a shared memory request if XFLAGS_EVREQ was set 7762306a36Sopenharmony_ci * - As a notification (link state, i2c event), controlled 7862306a36Sopenharmony_ci * via MC_CMD_LOG_CTRL 7962306a36Sopenharmony_ci * 8062306a36Sopenharmony_ci * Both events share a common structure: 8162306a36Sopenharmony_ci * 8262306a36Sopenharmony_ci * 0 32 33 36 44 52 60 8362306a36Sopenharmony_ci * | Data | Cont | Level | Src | Code | Rsvd | 8462306a36Sopenharmony_ci * | 8562306a36Sopenharmony_ci * \ There is another event pending in this notification 8662306a36Sopenharmony_ci * 8762306a36Sopenharmony_ci * If Code==CMDDONE, then the fields are further interpreted as: 8862306a36Sopenharmony_ci * 8962306a36Sopenharmony_ci * - LEVEL==INFO Command succeeded 9062306a36Sopenharmony_ci * - LEVEL==ERR Command failed 9162306a36Sopenharmony_ci * 9262306a36Sopenharmony_ci * 0 8 16 24 32 9362306a36Sopenharmony_ci * | Seq | Datalen | Errno | Rsvd | 9462306a36Sopenharmony_ci * 9562306a36Sopenharmony_ci * These fields are taken directly out of the standard MCDI header, i.e., 9662306a36Sopenharmony_ci * LEVEL==ERR, Datalen == 0 => Reboot 9762306a36Sopenharmony_ci * 9862306a36Sopenharmony_ci * Events can be squirted out of the UART (using LOG_CTRL) without a 9962306a36Sopenharmony_ci * MCDI header. An event can be distinguished from a MCDI response by 10062306a36Sopenharmony_ci * examining the first byte which is 0xc0. This corresponds to the 10162306a36Sopenharmony_ci * non-existent MCDI command MC_CMD_DEBUG_LOG. 10262306a36Sopenharmony_ci * 10362306a36Sopenharmony_ci * 0 7 8 10462306a36Sopenharmony_ci * | command | Resync | = 0xc0 10562306a36Sopenharmony_ci * 10662306a36Sopenharmony_ci * Since the event is written in big-endian byte order, this works 10762306a36Sopenharmony_ci * providing bits 56-63 of the event are 0xc0. 10862306a36Sopenharmony_ci * 10962306a36Sopenharmony_ci * 56 60 63 11062306a36Sopenharmony_ci * | Rsvd | Code | = 0xc0 11162306a36Sopenharmony_ci * 11262306a36Sopenharmony_ci * Which means for convenience the event code is 0xc for all MC 11362306a36Sopenharmony_ci * generated events. 11462306a36Sopenharmony_ci */ 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci/* 11762306a36Sopenharmony_ci * the errno value may be followed by the (0-based) number of the 11862306a36Sopenharmony_ci * first argument that could not be processed. 11962306a36Sopenharmony_ci */ 12062306a36Sopenharmony_ci#define MC_CMD_ERR_ARG_OFST 4 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci/* MC_CMD_ERR MCDI error codes. */ 12362306a36Sopenharmony_ci/* Operation not permitted. */ 12462306a36Sopenharmony_ci#define MC_CMD_ERR_EPERM 0x1 12562306a36Sopenharmony_ci/* Non-existent command target */ 12662306a36Sopenharmony_ci#define MC_CMD_ERR_ENOENT 0x2 12762306a36Sopenharmony_ci/* assert() has killed the MC */ 12862306a36Sopenharmony_ci#define MC_CMD_ERR_EINTR 0x4 12962306a36Sopenharmony_ci/* I/O failure */ 13062306a36Sopenharmony_ci#define MC_CMD_ERR_EIO 0x5 13162306a36Sopenharmony_ci/* Already exists */ 13262306a36Sopenharmony_ci#define MC_CMD_ERR_EEXIST 0x6 13362306a36Sopenharmony_ci/* Try again */ 13462306a36Sopenharmony_ci#define MC_CMD_ERR_EAGAIN 0xb 13562306a36Sopenharmony_ci/* Out of memory */ 13662306a36Sopenharmony_ci#define MC_CMD_ERR_ENOMEM 0xc 13762306a36Sopenharmony_ci/* Caller does not hold required locks */ 13862306a36Sopenharmony_ci#define MC_CMD_ERR_EACCES 0xd 13962306a36Sopenharmony_ci/* Resource is currently unavailable (e.g. lock contention) */ 14062306a36Sopenharmony_ci#define MC_CMD_ERR_EBUSY 0x10 14162306a36Sopenharmony_ci/* No such device */ 14262306a36Sopenharmony_ci#define MC_CMD_ERR_ENODEV 0x13 14362306a36Sopenharmony_ci/* Invalid argument to target */ 14462306a36Sopenharmony_ci#define MC_CMD_ERR_EINVAL 0x16 14562306a36Sopenharmony_ci/* No space */ 14662306a36Sopenharmony_ci#define MC_CMD_ERR_ENOSPC 0x1c 14762306a36Sopenharmony_ci/* Read-only */ 14862306a36Sopenharmony_ci#define MC_CMD_ERR_EROFS 0x1e 14962306a36Sopenharmony_ci/* Broken pipe */ 15062306a36Sopenharmony_ci#define MC_CMD_ERR_EPIPE 0x20 15162306a36Sopenharmony_ci/* Out of range */ 15262306a36Sopenharmony_ci#define MC_CMD_ERR_ERANGE 0x22 15362306a36Sopenharmony_ci/* Non-recursive resource is already acquired */ 15462306a36Sopenharmony_ci#define MC_CMD_ERR_EDEADLK 0x23 15562306a36Sopenharmony_ci/* Operation not implemented */ 15662306a36Sopenharmony_ci#define MC_CMD_ERR_ENOSYS 0x26 15762306a36Sopenharmony_ci/* Operation timed out */ 15862306a36Sopenharmony_ci#define MC_CMD_ERR_ETIME 0x3e 15962306a36Sopenharmony_ci/* Link has been severed */ 16062306a36Sopenharmony_ci#define MC_CMD_ERR_ENOLINK 0x43 16162306a36Sopenharmony_ci/* Protocol error */ 16262306a36Sopenharmony_ci#define MC_CMD_ERR_EPROTO 0x47 16362306a36Sopenharmony_ci/* Bad message */ 16462306a36Sopenharmony_ci#define MC_CMD_ERR_EBADMSG 0x4a 16562306a36Sopenharmony_ci/* Operation not supported */ 16662306a36Sopenharmony_ci#define MC_CMD_ERR_ENOTSUP 0x5f 16762306a36Sopenharmony_ci/* Address not available */ 16862306a36Sopenharmony_ci#define MC_CMD_ERR_EADDRNOTAVAIL 0x63 16962306a36Sopenharmony_ci/* Not connected */ 17062306a36Sopenharmony_ci#define MC_CMD_ERR_ENOTCONN 0x6b 17162306a36Sopenharmony_ci/* Operation already in progress */ 17262306a36Sopenharmony_ci#define MC_CMD_ERR_EALREADY 0x72 17362306a36Sopenharmony_ci/* Stale handle. The handle references resource that no longer exists */ 17462306a36Sopenharmony_ci#define MC_CMD_ERR_ESTALE 0x74 17562306a36Sopenharmony_ci/* Resource allocation failed. */ 17662306a36Sopenharmony_ci#define MC_CMD_ERR_ALLOC_FAIL 0x1000 17762306a36Sopenharmony_ci/* V-adaptor not found. */ 17862306a36Sopenharmony_ci#define MC_CMD_ERR_NO_VADAPTOR 0x1001 17962306a36Sopenharmony_ci/* EVB port not found. */ 18062306a36Sopenharmony_ci#define MC_CMD_ERR_NO_EVB_PORT 0x1002 18162306a36Sopenharmony_ci/* V-switch not found. */ 18262306a36Sopenharmony_ci#define MC_CMD_ERR_NO_VSWITCH 0x1003 18362306a36Sopenharmony_ci/* Too many VLAN tags. */ 18462306a36Sopenharmony_ci#define MC_CMD_ERR_VLAN_LIMIT 0x1004 18562306a36Sopenharmony_ci/* Bad PCI function number. */ 18662306a36Sopenharmony_ci#define MC_CMD_ERR_BAD_PCI_FUNC 0x1005 18762306a36Sopenharmony_ci/* Invalid VLAN mode. */ 18862306a36Sopenharmony_ci#define MC_CMD_ERR_BAD_VLAN_MODE 0x1006 18962306a36Sopenharmony_ci/* Invalid v-switch type. */ 19062306a36Sopenharmony_ci#define MC_CMD_ERR_BAD_VSWITCH_TYPE 0x1007 19162306a36Sopenharmony_ci/* Invalid v-port type. */ 19262306a36Sopenharmony_ci#define MC_CMD_ERR_BAD_VPORT_TYPE 0x1008 19362306a36Sopenharmony_ci/* MAC address exists. */ 19462306a36Sopenharmony_ci#define MC_CMD_ERR_MAC_EXIST 0x1009 19562306a36Sopenharmony_ci/* Slave core not present */ 19662306a36Sopenharmony_ci#define MC_CMD_ERR_SLAVE_NOT_PRESENT 0x100a 19762306a36Sopenharmony_ci/* The datapath is disabled. */ 19862306a36Sopenharmony_ci#define MC_CMD_ERR_DATAPATH_DISABLED 0x100b 19962306a36Sopenharmony_ci/* The requesting client is not a function */ 20062306a36Sopenharmony_ci#define MC_CMD_ERR_CLIENT_NOT_FN 0x100c 20162306a36Sopenharmony_ci/* 20262306a36Sopenharmony_ci * The requested operation might require the command to be passed between 20362306a36Sopenharmony_ci * MCs, and the transport doesn't support that. Should only ever been seen over 20462306a36Sopenharmony_ci * the UART. 20562306a36Sopenharmony_ci */ 20662306a36Sopenharmony_ci#define MC_CMD_ERR_NO_PRIVILEGE 0x1013 20762306a36Sopenharmony_ci/* 20862306a36Sopenharmony_ci * Workaround 26807 could not be turned on/off because some functions 20962306a36Sopenharmony_ci * have already installed filters. See the comment at 21062306a36Sopenharmony_ci * MC_CMD_WORKAROUND_BUG26807. May also returned for other operations such as 21162306a36Sopenharmony_ci * sub-variant switching. 21262306a36Sopenharmony_ci */ 21362306a36Sopenharmony_ci#define MC_CMD_ERR_FILTERS_PRESENT 0x1014 21462306a36Sopenharmony_ci/* The clock whose frequency you've attempted to set doesn't exist */ 21562306a36Sopenharmony_ci#define MC_CMD_ERR_NO_CLOCK 0x1015 21662306a36Sopenharmony_ci/* 21762306a36Sopenharmony_ci * Returned by MC_CMD_TESTASSERT if the action that should have caused an 21862306a36Sopenharmony_ci * assertion failed to do so. 21962306a36Sopenharmony_ci */ 22062306a36Sopenharmony_ci#define MC_CMD_ERR_UNREACHABLE 0x1016 22162306a36Sopenharmony_ci/* 22262306a36Sopenharmony_ci * This command needs to be processed in the background but there were no 22362306a36Sopenharmony_ci * resources to do so. Send it again after a command has completed. 22462306a36Sopenharmony_ci */ 22562306a36Sopenharmony_ci#define MC_CMD_ERR_QUEUE_FULL 0x1017 22662306a36Sopenharmony_ci/* 22762306a36Sopenharmony_ci * The operation could not be completed because the PCIe link has gone 22862306a36Sopenharmony_ci * away. This error code is never expected to be returned over the TLP 22962306a36Sopenharmony_ci * transport. 23062306a36Sopenharmony_ci */ 23162306a36Sopenharmony_ci#define MC_CMD_ERR_NO_PCIE 0x1018 23262306a36Sopenharmony_ci/* 23362306a36Sopenharmony_ci * The operation could not be completed because the datapath has gone 23462306a36Sopenharmony_ci * away. This is distinct from MC_CMD_ERR_DATAPATH_DISABLED in that the 23562306a36Sopenharmony_ci * datapath absence may be temporary 23662306a36Sopenharmony_ci */ 23762306a36Sopenharmony_ci#define MC_CMD_ERR_NO_DATAPATH 0x1019 23862306a36Sopenharmony_ci/* The operation could not complete because some VIs are allocated */ 23962306a36Sopenharmony_ci#define MC_CMD_ERR_VIS_PRESENT 0x101a 24062306a36Sopenharmony_ci/* 24162306a36Sopenharmony_ci * The operation could not complete because some PIO buffers are 24262306a36Sopenharmony_ci * allocated 24362306a36Sopenharmony_ci */ 24462306a36Sopenharmony_ci#define MC_CMD_ERR_PIOBUFS_PRESENT 0x101b 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci/***********************************/ 24762306a36Sopenharmony_ci/* 24862306a36Sopenharmony_ci * MC_CMD_CDX_BUS_ENUM_BUSES 24962306a36Sopenharmony_ci * CDX bus hosts devices (functions) that are implemented using the Composable 25062306a36Sopenharmony_ci * DMA subsystem and directly mapped into the memory space of the FGPA PSX 25162306a36Sopenharmony_ci * Application Processors (APUs). As such, they only apply to the PSX APU side, 25262306a36Sopenharmony_ci * not the host (PCIe). Unlike PCIe, these devices have no native configuration 25362306a36Sopenharmony_ci * space or enumeration mechanism, so this message set provides a minimal 25462306a36Sopenharmony_ci * interface for discovery and management (bus reset, FLR, BME) of such 25562306a36Sopenharmony_ci * devices. This command returns the number of CDX buses present in the system. 25662306a36Sopenharmony_ci */ 25762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES 0x1 25862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES_MSGSET 0x1 25962306a36Sopenharmony_ci#undef MC_CMD_0x1_PRIVILEGE_CTG 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci#define MC_CMD_0x1_PRIVILEGE_CTG SRIOV_CTG_ADMIN 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_ENUM_BUSES_IN msgrequest */ 26462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES_IN_LEN 0 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_ENUM_BUSES_OUT msgresponse */ 26762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_LEN 4 26862306a36Sopenharmony_ci/* 26962306a36Sopenharmony_ci * Number of CDX buses present in the system. Buses are numbered 0 to 27062306a36Sopenharmony_ci * BUS_COUNT-1 27162306a36Sopenharmony_ci */ 27262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_BUS_COUNT_OFST 0 27362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_BUSES_OUT_BUS_COUNT_LEN 4 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ci/***********************************/ 27662306a36Sopenharmony_ci/* 27762306a36Sopenharmony_ci * MC_CMD_CDX_BUS_ENUM_DEVICES 27862306a36Sopenharmony_ci * Enumerate CDX bus devices on a given bus 27962306a36Sopenharmony_ci */ 28062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES 0x2 28162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_MSGSET 0x2 28262306a36Sopenharmony_ci#undef MC_CMD_0x2_PRIVILEGE_CTG 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define MC_CMD_0x2_PRIVILEGE_CTG SRIOV_CTG_ADMIN 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_ENUM_DEVICES_IN msgrequest */ 28762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_LEN 4 28862306a36Sopenharmony_ci/* 28962306a36Sopenharmony_ci * Bus number to enumerate, in range 0 to BUS_COUNT-1, as returned by 29062306a36Sopenharmony_ci * MC_CMD_CDX_BUS_ENUM_BUSES_OUT 29162306a36Sopenharmony_ci */ 29262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_BUS_OFST 0 29362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_IN_BUS_LEN 4 29462306a36Sopenharmony_ci 29562306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_ENUM_DEVICES_OUT msgresponse */ 29662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_LEN 4 29762306a36Sopenharmony_ci/* 29862306a36Sopenharmony_ci * Number of devices present on the bus. Devices on the bus are numbered 0 to 29962306a36Sopenharmony_ci * DEVICE_COUNT-1. Returns EAGAIN if number of devices unknown or if the target 30062306a36Sopenharmony_ci * devices are not ready (e.g. undergoing a bus reset) 30162306a36Sopenharmony_ci */ 30262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_DEVICE_COUNT_OFST 0 30362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_ENUM_DEVICES_OUT_DEVICE_COUNT_LEN 4 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci/***********************************/ 30662306a36Sopenharmony_ci/* 30762306a36Sopenharmony_ci * MC_CMD_CDX_BUS_GET_DEVICE_CONFIG 30862306a36Sopenharmony_ci * Returns device identification and MMIO/MSI resource data for a CDX device. 30962306a36Sopenharmony_ci * The expected usage is for the caller to first retrieve the number of devices 31062306a36Sopenharmony_ci * on the bus using MC_CMD_BUS_ENUM_DEVICES, then loop through the range (0, 31162306a36Sopenharmony_ci * DEVICE_COUNT - 1), retrieving device resource data. May return EAGAIN if the 31262306a36Sopenharmony_ci * number of exposed devices or device resources change during enumeration (due 31362306a36Sopenharmony_ci * to e.g. a PL reload / bus reset), in which case the caller is expected to 31462306a36Sopenharmony_ci * restart the enumeration loop. MMIO addresses are specified in terms of bus 31562306a36Sopenharmony_ci * addresses (prior to any potential IOMMU translation). For versal-net, these 31662306a36Sopenharmony_ci * are equivalent to APU physical addresses. Implementation note - for this to 31762306a36Sopenharmony_ci * work, the implementation needs to keep state (generation count) per client. 31862306a36Sopenharmony_ci */ 31962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG 0x3 32062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_MSGSET 0x3 32162306a36Sopenharmony_ci#undef MC_CMD_0x3_PRIVILEGE_CTG 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci#define MC_CMD_0x3_PRIVILEGE_CTG SRIOV_CTG_ADMIN 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN msgrequest */ 32662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_LEN 8 32762306a36Sopenharmony_ci/* Device bus number, in range 0 to BUS_COUNT-1 */ 32862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_BUS_OFST 0 32962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_BUS_LEN 4 33062306a36Sopenharmony_ci/* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */ 33162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_DEVICE_OFST 4 33262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_IN_DEVICE_LEN 4 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci/* MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT msgresponse */ 33562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_LEN 88 33662306a36Sopenharmony_ci/* 16-bit Vendor identifier, compliant with PCI-SIG VendorID assignment. */ 33762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_VENDOR_ID_OFST 0 33862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_VENDOR_ID_LEN 2 33962306a36Sopenharmony_ci/* 16-bit Device ID assigned by the vendor */ 34062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_ID_OFST 2 34162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_ID_LEN 2 34262306a36Sopenharmony_ci/* 34362306a36Sopenharmony_ci * 16-bit Subsystem Vendor ID, , compliant with PCI-SIG VendorID assignment. 34462306a36Sopenharmony_ci * For further device differentiation, as required. 0 if unused. 34562306a36Sopenharmony_ci */ 34662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_VENDOR_ID_OFST 4 34762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_VENDOR_ID_LEN 2 34862306a36Sopenharmony_ci/* 34962306a36Sopenharmony_ci * 16-bit Subsystem Device ID assigned by the vendor. For further device 35062306a36Sopenharmony_ci * differentiation, as required. 0 if unused. 35162306a36Sopenharmony_ci */ 35262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_DEVICE_ID_OFST 6 35362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_SUBSYS_DEVICE_ID_LEN 2 35462306a36Sopenharmony_ci/* 24-bit Device Class code, compliant with PCI-SIG Device Class codes */ 35562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_CLASS_OFST 8 35662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_CLASS_LEN 3 35762306a36Sopenharmony_ci/* 8-bit vendor-assigned revision */ 35862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_REVISION_OFST 11 35962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_DEVICE_REVISION_LEN 1 36062306a36Sopenharmony_ci/* Reserved (alignment) */ 36162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_RESERVED_OFST 12 36262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_RESERVED_LEN 4 36362306a36Sopenharmony_ci/* MMIO region 0 base address (bus address), 0 if unused */ 36462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_OFST 16 36562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LEN 8 36662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_OFST 16 36762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_LEN 4 36862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_LBN 128 36962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_LO_WIDTH 32 37062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_OFST 20 37162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_LEN 4 37262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_LBN 160 37362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_BASE_HI_WIDTH 32 37462306a36Sopenharmony_ci/* MMIO region 0 size, 0 if unused */ 37562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_OFST 24 37662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LEN 8 37762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_OFST 24 37862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_LEN 4 37962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_LBN 192 38062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_LO_WIDTH 32 38162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_OFST 28 38262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_LEN 4 38362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_LBN 224 38462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION0_SIZE_HI_WIDTH 32 38562306a36Sopenharmony_ci/* MMIO region 1 base address (bus address), 0 if unused */ 38662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_OFST 32 38762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LEN 8 38862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_OFST 32 38962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_LEN 4 39062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_LBN 256 39162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_LO_WIDTH 32 39262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_OFST 36 39362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_LEN 4 39462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_LBN 288 39562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_BASE_HI_WIDTH 32 39662306a36Sopenharmony_ci/* MMIO region 1 size, 0 if unused */ 39762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_OFST 40 39862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LEN 8 39962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_OFST 40 40062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_LEN 4 40162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_LBN 320 40262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_LO_WIDTH 32 40362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_OFST 44 40462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_LEN 4 40562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_LBN 352 40662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION1_SIZE_HI_WIDTH 32 40762306a36Sopenharmony_ci/* MMIO region 2 base address (bus address), 0 if unused */ 40862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_OFST 48 40962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LEN 8 41062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_OFST 48 41162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_LEN 4 41262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_LBN 384 41362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_LO_WIDTH 32 41462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_OFST 52 41562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_LEN 4 41662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_LBN 416 41762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_BASE_HI_WIDTH 32 41862306a36Sopenharmony_ci/* MMIO region 2 size, 0 if unused */ 41962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_OFST 56 42062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LEN 8 42162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_OFST 56 42262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_LEN 4 42362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_LBN 448 42462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_LO_WIDTH 32 42562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_OFST 60 42662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_LEN 4 42762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_LBN 480 42862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION2_SIZE_HI_WIDTH 32 42962306a36Sopenharmony_ci/* MMIO region 3 base address (bus address), 0 if unused */ 43062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_OFST 64 43162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LEN 8 43262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_OFST 64 43362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_LEN 4 43462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_LBN 512 43562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_LO_WIDTH 32 43662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_OFST 68 43762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_LEN 4 43862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_LBN 544 43962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_BASE_HI_WIDTH 32 44062306a36Sopenharmony_ci/* MMIO region 3 size, 0 if unused */ 44162306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_OFST 72 44262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LEN 8 44362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_OFST 72 44462306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_LEN 4 44562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_LBN 576 44662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_LO_WIDTH 32 44762306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_OFST 76 44862306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_LEN 4 44962306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_LBN 608 45062306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MMIO_REGION3_SIZE_HI_WIDTH 32 45162306a36Sopenharmony_ci/* MSI vector count */ 45262306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MSI_COUNT_OFST 80 45362306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_MSI_COUNT_LEN 4 45462306a36Sopenharmony_ci/* Requester ID used by device (SMMU StreamID, GIC ITS DeviceID) */ 45562306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_REQUESTER_ID_OFST 84 45662306a36Sopenharmony_ci#define MC_CMD_CDX_BUS_GET_DEVICE_CONFIG_OUT_REQUESTER_ID_LEN 4 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci/***********************************/ 45962306a36Sopenharmony_ci/* 46062306a36Sopenharmony_ci * MC_CMD_CDX_DEVICE_RESET 46162306a36Sopenharmony_ci * After this call completes, device DMA and interrupts are quiesced, devices 46262306a36Sopenharmony_ci * logic is reset in a hardware-specific way and DMA bus mastering is disabled. 46362306a36Sopenharmony_ci */ 46462306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET 0x6 46562306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_MSGSET 0x6 46662306a36Sopenharmony_ci#undef MC_CMD_0x6_PRIVILEGE_CTG 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci#define MC_CMD_0x6_PRIVILEGE_CTG SRIOV_CTG_ADMIN 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci/* MC_CMD_CDX_DEVICE_RESET_IN msgrequest */ 47162306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_IN_LEN 8 47262306a36Sopenharmony_ci/* Device bus number, in range 0 to BUS_COUNT-1 */ 47362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_IN_BUS_OFST 0 47462306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_IN_BUS_LEN 4 47562306a36Sopenharmony_ci/* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */ 47662306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_IN_DEVICE_OFST 4 47762306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_IN_DEVICE_LEN 4 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci/* 48062306a36Sopenharmony_ci * MC_CMD_CDX_DEVICE_RESET_OUT msgresponse: The device is quiesced and all 48162306a36Sopenharmony_ci * pending device initiated DMA has completed. 48262306a36Sopenharmony_ci */ 48362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_RESET_OUT_LEN 0 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci/***********************************/ 48662306a36Sopenharmony_ci/* 48762306a36Sopenharmony_ci * MC_CMD_CDX_DEVICE_CONTROL_SET 48862306a36Sopenharmony_ci * If BUS_MASTER is set to disabled, device DMA and interrupts are quiesced. 48962306a36Sopenharmony_ci * Pending DMA requests and MSI interrupts are flushed and no further DMA or 49062306a36Sopenharmony_ci * interrupts are issued after this command returns. If BUS_MASTER is set to 49162306a36Sopenharmony_ci * enabled, device is allowed to initiate DMA. Whether interrupts are enabled 49262306a36Sopenharmony_ci * also depends on the value of MSI_ENABLE bit. Note that, in this case, the 49362306a36Sopenharmony_ci * device may start DMA before the host receives and processes the MCDI 49462306a36Sopenharmony_ci * response. MSI_ENABLE masks or unmasks device interrupts only. Note that for 49562306a36Sopenharmony_ci * interrupts to be delivered to the host, both BUS_MASTER and MSI_ENABLE needs 49662306a36Sopenharmony_ci * to be set. MMIO_REGIONS_ENABLE enables or disables host accesses to device 49762306a36Sopenharmony_ci * MMIO regions. Note that an implementation is allowed to permanently set this 49862306a36Sopenharmony_ci * bit to 1, in which case MC_CMD_CDX_DEVICE_CONTROL_GET will always return 1 49962306a36Sopenharmony_ci * for this bit, regardless of the value set here. 50062306a36Sopenharmony_ci */ 50162306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET 0x7 50262306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_MSGSET 0x7 50362306a36Sopenharmony_ci#undef MC_CMD_0x7_PRIVILEGE_CTG 50462306a36Sopenharmony_ci 50562306a36Sopenharmony_ci#define MC_CMD_0x7_PRIVILEGE_CTG SRIOV_CTG_ADMIN 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ci/* MC_CMD_CDX_DEVICE_CONTROL_SET_IN msgrequest */ 50862306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_LEN 12 50962306a36Sopenharmony_ci/* Device bus number, in range 0 to BUS_COUNT-1 */ 51062306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_OFST 0 51162306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_LEN 4 51262306a36Sopenharmony_ci/* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */ 51362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_DEVICE_OFST 4 51462306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_DEVICE_LEN 4 51562306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_FLAGS_OFST 8 51662306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_FLAGS_LEN 4 51762306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_OFST 8 51862306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_LBN 0 51962306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_BUS_MASTER_ENABLE_WIDTH 1 52062306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_OFST 8 52162306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_LBN 1 52262306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MSI_ENABLE_WIDTH 1 52362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_OFST 8 52462306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_LBN 2 52562306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_IN_MMIO_REGIONS_ENABLE_WIDTH 1 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ci/* MC_CMD_CDX_DEVICE_CONTROL_SET_OUT msgresponse */ 52862306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_SET_OUT_LEN 0 52962306a36Sopenharmony_ci 53062306a36Sopenharmony_ci/***********************************/ 53162306a36Sopenharmony_ci/* 53262306a36Sopenharmony_ci * MC_CMD_CDX_DEVICE_CONTROL_GET 53362306a36Sopenharmony_ci * Returns device DMA, interrupt and MMIO region access control bits. See 53462306a36Sopenharmony_ci * MC_CMD_CDX_DEVICE_CONTROL_SET for definition of the available control bits. 53562306a36Sopenharmony_ci */ 53662306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET 0x8 53762306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_MSGSET 0x8 53862306a36Sopenharmony_ci#undef MC_CMD_0x8_PRIVILEGE_CTG 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci#define MC_CMD_0x8_PRIVILEGE_CTG SRIOV_CTG_ADMIN 54162306a36Sopenharmony_ci 54262306a36Sopenharmony_ci/* MC_CMD_CDX_DEVICE_CONTROL_GET_IN msgrequest */ 54362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_LEN 8 54462306a36Sopenharmony_ci/* Device bus number, in range 0 to BUS_COUNT-1 */ 54562306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_BUS_OFST 0 54662306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_BUS_LEN 4 54762306a36Sopenharmony_ci/* Device number relative to the bus, in range 0 to DEVICE_COUNT-1 for that bus */ 54862306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_DEVICE_OFST 4 54962306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_IN_DEVICE_LEN 4 55062306a36Sopenharmony_ci 55162306a36Sopenharmony_ci/* MC_CMD_CDX_DEVICE_CONTROL_GET_OUT msgresponse */ 55262306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_LEN 4 55362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_FLAGS_OFST 0 55462306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_FLAGS_LEN 4 55562306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_OFST 0 55662306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_LBN 0 55762306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_BUS_MASTER_ENABLE_WIDTH 1 55862306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_OFST 0 55962306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_LBN 1 56062306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MSI_ENABLE_WIDTH 1 56162306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_OFST 0 56262306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_LBN 2 56362306a36Sopenharmony_ci#define MC_CMD_CDX_DEVICE_CONTROL_GET_OUT_MMIO_REGIONS_ENABLE_WIDTH 1 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ci/***********************************/ 56662306a36Sopenharmony_ci/* MC_CMD_V2_EXTN - Encapsulation for a v2 extended command */ 56762306a36Sopenharmony_ci#define MC_CMD_V2_EXTN 0x7f 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci/* MC_CMD_V2_EXTN_IN msgrequest */ 57062306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_LEN 4 57162306a36Sopenharmony_ci/* the extended command number */ 57262306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_EXTENDED_CMD_LBN 0 57362306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_EXTENDED_CMD_WIDTH 15 57462306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_UNUSED_LBN 15 57562306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_UNUSED_WIDTH 1 57662306a36Sopenharmony_ci/* the actual length of the encapsulated command */ 57762306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_ACTUAL_LEN_LBN 16 57862306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_ACTUAL_LEN_WIDTH 10 57962306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_UNUSED2_LBN 26 58062306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_UNUSED2_WIDTH 2 58162306a36Sopenharmony_ci/* Type of command/response */ 58262306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_MESSAGE_TYPE_LBN 28 58362306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_MESSAGE_TYPE_WIDTH 4 58462306a36Sopenharmony_ci/* 58562306a36Sopenharmony_ci * enum: MCDI command directed to versal-net. MCDI responses of this type 58662306a36Sopenharmony_ci * are not defined. 58762306a36Sopenharmony_ci */ 58862306a36Sopenharmony_ci#define MC_CMD_V2_EXTN_IN_MCDI_MESSAGE_TYPE_PLATFORM 0x2 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci#endif /* MC_CDX_PCOL_H */ 591