restore lost packages from 0.2.3 + fix overwritten 0.2.4 files
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* Copyright 2005-2006 Fen Systems Ltd.
|
||||
* Copyright 2006-2013 Solarflare Communications Inc.
|
||||
* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
|
||||
*/
|
||||
|
||||
#ifndef CDX_BITFIELD_H
|
||||
#define CDX_BITFIELD_H
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
|
||||
/* Lowest bit numbers and widths */
|
||||
#define CDX_DWORD_LBN 0
|
||||
#define CDX_DWORD_WIDTH 32
|
||||
|
||||
/* Specified attribute (e.g. LBN) of the specified field */
|
||||
#define CDX_VAL(field, attribute) field ## _ ## attribute
|
||||
/* Low bit number of the specified field */
|
||||
#define CDX_LOW_BIT(field) CDX_VAL(field, LBN)
|
||||
/* Bit width of the specified field */
|
||||
#define CDX_WIDTH(field) CDX_VAL(field, WIDTH)
|
||||
/* High bit number of the specified field */
|
||||
#define CDX_HIGH_BIT(field) (CDX_LOW_BIT(field) + CDX_WIDTH(field) - 1)
|
||||
|
||||
/* A doubleword (i.e. 4 byte) datatype - little-endian in HW */
|
||||
struct cdx_dword {
|
||||
__le32 cdx_u32;
|
||||
};
|
||||
|
||||
/* Value expanders for printk */
|
||||
#define CDX_DWORD_VAL(dword) \
|
||||
((unsigned int)le32_to_cpu((dword).cdx_u32))
|
||||
|
||||
/*
|
||||
* Extract bit field portion [low,high) from the 32-bit little-endian
|
||||
* element which contains bits [min,max)
|
||||
*/
|
||||
#define CDX_DWORD_FIELD(dword, field) \
|
||||
(FIELD_GET(GENMASK(CDX_HIGH_BIT(field), CDX_LOW_BIT(field)), \
|
||||
le32_to_cpu((dword).cdx_u32)))
|
||||
|
||||
/*
|
||||
* Creates the portion of the named bit field that lies within the
|
||||
* range [min,max).
|
||||
*/
|
||||
#define CDX_INSERT_FIELD(field, value) \
|
||||
(FIELD_PREP(GENMASK(CDX_HIGH_BIT(field), \
|
||||
CDX_LOW_BIT(field)), value))
|
||||
|
||||
/*
|
||||
* Creates the portion of the named bit fields that lie within the
|
||||
* range [min,max).
|
||||
*/
|
||||
#define CDX_INSERT_FIELDS(field1, value1, \
|
||||
field2, value2, \
|
||||
field3, value3, \
|
||||
field4, value4, \
|
||||
field5, value5, \
|
||||
field6, value6, \
|
||||
field7, value7) \
|
||||
(CDX_INSERT_FIELD(field1, (value1)) | \
|
||||
CDX_INSERT_FIELD(field2, (value2)) | \
|
||||
CDX_INSERT_FIELD(field3, (value3)) | \
|
||||
CDX_INSERT_FIELD(field4, (value4)) | \
|
||||
CDX_INSERT_FIELD(field5, (value5)) | \
|
||||
CDX_INSERT_FIELD(field6, (value6)) | \
|
||||
CDX_INSERT_FIELD(field7, (value7)))
|
||||
|
||||
#define CDX_POPULATE_DWORD(dword, ...) \
|
||||
(dword).cdx_u32 = cpu_to_le32(CDX_INSERT_FIELDS(__VA_ARGS__))
|
||||
|
||||
/* Populate a dword field with various numbers of arguments */
|
||||
#define CDX_POPULATE_DWORD_7 CDX_POPULATE_DWORD
|
||||
#define CDX_POPULATE_DWORD_6(dword, ...) \
|
||||
CDX_POPULATE_DWORD_7(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_POPULATE_DWORD_5(dword, ...) \
|
||||
CDX_POPULATE_DWORD_6(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_POPULATE_DWORD_4(dword, ...) \
|
||||
CDX_POPULATE_DWORD_5(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_POPULATE_DWORD_3(dword, ...) \
|
||||
CDX_POPULATE_DWORD_4(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_POPULATE_DWORD_2(dword, ...) \
|
||||
CDX_POPULATE_DWORD_3(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_POPULATE_DWORD_1(dword, ...) \
|
||||
CDX_POPULATE_DWORD_2(dword, CDX_DWORD, 0, __VA_ARGS__)
|
||||
#define CDX_SET_DWORD(dword) \
|
||||
CDX_POPULATE_DWORD_1(dword, CDX_DWORD, 0xffffffff)
|
||||
|
||||
#endif /* CDX_BITFIELD_H */
|
||||
@@ -0,0 +1,291 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* CDX bus public interface
|
||||
*
|
||||
* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CDX_BUS_H_
|
||||
#define _CDX_BUS_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/msi.h>
|
||||
|
||||
#define MAX_CDX_DEV_RESOURCES 4
|
||||
#define CDX_CONTROLLER_ID_SHIFT 4
|
||||
#define CDX_BUS_NUM_MASK 0xF
|
||||
|
||||
/* Forward declaration for CDX controller */
|
||||
struct cdx_controller;
|
||||
|
||||
enum {
|
||||
CDX_DEV_MSI_CONF,
|
||||
CDX_DEV_BUS_MASTER_CONF,
|
||||
CDX_DEV_RESET_CONF,
|
||||
CDX_DEV_MSI_ENABLE,
|
||||
};
|
||||
|
||||
struct cdx_msi_config {
|
||||
u64 addr;
|
||||
u32 data;
|
||||
u16 msi_index;
|
||||
};
|
||||
|
||||
struct cdx_device_config {
|
||||
u8 type;
|
||||
union {
|
||||
struct cdx_msi_config msi;
|
||||
bool bus_master_enable;
|
||||
bool msi_enable;
|
||||
};
|
||||
};
|
||||
|
||||
typedef int (*cdx_bus_enable_cb)(struct cdx_controller *cdx, u8 bus_num);
|
||||
|
||||
typedef int (*cdx_bus_disable_cb)(struct cdx_controller *cdx, u8 bus_num);
|
||||
|
||||
typedef int (*cdx_scan_cb)(struct cdx_controller *cdx);
|
||||
|
||||
typedef int (*cdx_dev_configure_cb)(struct cdx_controller *cdx,
|
||||
u8 bus_num, u8 dev_num,
|
||||
struct cdx_device_config *dev_config);
|
||||
|
||||
/**
|
||||
* CDX_DEVICE - macro used to describe a specific CDX device
|
||||
* @vend: the 16 bit CDX Vendor ID
|
||||
* @dev: the 16 bit CDX Device ID
|
||||
*
|
||||
* This macro is used to create a struct cdx_device_id that matches a
|
||||
* specific device. The subvendor and subdevice fields will be set to
|
||||
* CDX_ANY_ID.
|
||||
*/
|
||||
#define CDX_DEVICE(vend, dev) \
|
||||
.vendor = (vend), .device = (dev), \
|
||||
.subvendor = CDX_ANY_ID, .subdevice = CDX_ANY_ID
|
||||
|
||||
/**
|
||||
* CDX_DEVICE_DRIVER_OVERRIDE - macro used to describe a CDX device with
|
||||
* override_only flags.
|
||||
* @vend: the 16 bit CDX Vendor ID
|
||||
* @dev: the 16 bit CDX Device ID
|
||||
* @driver_override: the 32 bit CDX Device override_only
|
||||
*
|
||||
* This macro is used to create a struct cdx_device_id that matches only a
|
||||
* driver_override device. The subvendor and subdevice fields will be set to
|
||||
* CDX_ANY_ID.
|
||||
*/
|
||||
#define CDX_DEVICE_DRIVER_OVERRIDE(vend, dev, driver_override) \
|
||||
.vendor = (vend), .device = (dev), .subvendor = CDX_ANY_ID,\
|
||||
.subdevice = CDX_ANY_ID, .override_only = (driver_override)
|
||||
|
||||
/**
|
||||
* struct cdx_ops - Callbacks supported by CDX controller.
|
||||
* @bus_enable: enable bus on the controller
|
||||
* @bus_disable: disable bus on the controller
|
||||
* @scan: scan the devices on the controller
|
||||
* @dev_configure: configuration like reset, master_enable,
|
||||
* msi_config etc for a CDX device
|
||||
*/
|
||||
struct cdx_ops {
|
||||
cdx_bus_enable_cb bus_enable;
|
||||
cdx_bus_disable_cb bus_disable;
|
||||
cdx_scan_cb scan;
|
||||
cdx_dev_configure_cb dev_configure;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cdx_controller: CDX controller object
|
||||
* @dev: Linux device associated with the CDX controller.
|
||||
* @priv: private data
|
||||
* @msi_domain: MSI domain
|
||||
* @id: Controller ID
|
||||
* @controller_registered: controller registered with bus
|
||||
* @ops: CDX controller ops
|
||||
*/
|
||||
struct cdx_controller {
|
||||
struct device *dev;
|
||||
void *priv;
|
||||
struct irq_domain *msi_domain;
|
||||
u32 id;
|
||||
bool controller_registered;
|
||||
struct cdx_ops *ops;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cdx_device - CDX device object
|
||||
* @dev: Linux driver model device object
|
||||
* @cdx: CDX controller associated with the device
|
||||
* @vendor: Vendor ID for CDX device
|
||||
* @device: Device ID for CDX device
|
||||
* @subsystem_vendor: Subsystem Vendor ID for CDX device
|
||||
* @subsystem_device: Subsystem Device ID for CDX device
|
||||
* @class: Class for the CDX device
|
||||
* @revision: Revision of the CDX device
|
||||
* @bus_num: Bus number for this CDX device
|
||||
* @dev_num: Device number for this device
|
||||
* @res: array of MMIO region entries
|
||||
* @res_attr: resource binary attribute
|
||||
* @debugfs_dir: debugfs directory for this device
|
||||
* @res_count: number of valid MMIO regions
|
||||
* @dma_mask: Default DMA mask
|
||||
* @flags: CDX device flags
|
||||
* @req_id: Requestor ID associated with CDX device
|
||||
* @is_bus: Is this bus device
|
||||
* @enabled: is this bus enabled
|
||||
* @msi_dev_id: MSI Device ID associated with CDX device
|
||||
* @num_msi: Number of MSI's supported by the device
|
||||
* @driver_override: driver name to force a match; do not set directly,
|
||||
* because core frees it; use driver_set_override() to
|
||||
* set or clear it.
|
||||
* @irqchip_lock: lock to synchronize irq/msi configuration
|
||||
* @msi_write_pending: MSI write pending for this device
|
||||
*/
|
||||
struct cdx_device {
|
||||
struct device dev;
|
||||
struct cdx_controller *cdx;
|
||||
u16 vendor;
|
||||
u16 device;
|
||||
u16 subsystem_vendor;
|
||||
u16 subsystem_device;
|
||||
u32 class;
|
||||
u8 revision;
|
||||
u8 bus_num;
|
||||
u8 dev_num;
|
||||
struct resource res[MAX_CDX_DEV_RESOURCES];
|
||||
struct bin_attribute *res_attr[MAX_CDX_DEV_RESOURCES];
|
||||
struct dentry *debugfs_dir;
|
||||
u8 res_count;
|
||||
u64 dma_mask;
|
||||
u16 flags;
|
||||
u32 req_id;
|
||||
bool is_bus;
|
||||
bool enabled;
|
||||
u32 msi_dev_id;
|
||||
u32 num_msi;
|
||||
const char *driver_override;
|
||||
struct mutex irqchip_lock;
|
||||
bool msi_write_pending;
|
||||
};
|
||||
|
||||
#define to_cdx_device(_dev) \
|
||||
container_of(_dev, struct cdx_device, dev)
|
||||
|
||||
#define cdx_resource_start(dev, num) ((dev)->res[(num)].start)
|
||||
#define cdx_resource_end(dev, num) ((dev)->res[(num)].end)
|
||||
#define cdx_resource_flags(dev, num) ((dev)->res[(num)].flags)
|
||||
#define cdx_resource_len(dev, num) \
|
||||
((cdx_resource_start((dev), (num)) == 0 && \
|
||||
cdx_resource_end((dev), (num)) == \
|
||||
cdx_resource_start((dev), (num))) ? 0 : \
|
||||
(cdx_resource_end((dev), (num)) - \
|
||||
cdx_resource_start((dev), (num)) + 1))
|
||||
/**
|
||||
* struct cdx_driver - CDX device driver
|
||||
* @driver: Generic device driver
|
||||
* @match_id_table: table of supported device matching Ids
|
||||
* @probe: Function called when a device is added
|
||||
* @remove: Function called when a device is removed
|
||||
* @shutdown: Function called at shutdown time to quiesce the device
|
||||
* @reset_prepare: Function called before is reset to notify driver
|
||||
* @reset_done: Function called after reset is complete to notify driver
|
||||
* @driver_managed_dma: Device driver doesn't use kernel DMA API for DMA.
|
||||
* For most device drivers, no need to care about this flag
|
||||
* as long as all DMAs are handled through the kernel DMA API.
|
||||
* For some special ones, for example VFIO drivers, they know
|
||||
* how to manage the DMA themselves and set this flag so that
|
||||
* the IOMMU layer will allow them to setup and manage their
|
||||
* own I/O address space.
|
||||
*/
|
||||
struct cdx_driver {
|
||||
struct device_driver driver;
|
||||
const struct cdx_device_id *match_id_table;
|
||||
int (*probe)(struct cdx_device *dev);
|
||||
int (*remove)(struct cdx_device *dev);
|
||||
void (*shutdown)(struct cdx_device *dev);
|
||||
void (*reset_prepare)(struct cdx_device *dev);
|
||||
void (*reset_done)(struct cdx_device *dev);
|
||||
bool driver_managed_dma;
|
||||
};
|
||||
|
||||
#define to_cdx_driver(_drv) \
|
||||
container_of_const(_drv, struct cdx_driver, driver)
|
||||
|
||||
/* Macro to avoid include chaining to get THIS_MODULE */
|
||||
#define cdx_driver_register(drv) \
|
||||
__cdx_driver_register(drv, THIS_MODULE)
|
||||
|
||||
/**
|
||||
* __cdx_driver_register - registers a CDX device driver
|
||||
* @cdx_driver: CDX driver to register
|
||||
* @owner: module owner
|
||||
*
|
||||
* Return: -errno on failure, 0 on success.
|
||||
*/
|
||||
int __must_check __cdx_driver_register(struct cdx_driver *cdx_driver,
|
||||
struct module *owner);
|
||||
|
||||
/**
|
||||
* cdx_driver_unregister - unregisters a device driver from the
|
||||
* CDX bus.
|
||||
* @cdx_driver: CDX driver to register
|
||||
*/
|
||||
void cdx_driver_unregister(struct cdx_driver *cdx_driver);
|
||||
|
||||
extern const struct bus_type cdx_bus_type;
|
||||
|
||||
/**
|
||||
* cdx_dev_reset - Reset CDX device
|
||||
* @dev: device pointer
|
||||
*
|
||||
* Return: 0 for success, -errno on failure
|
||||
*/
|
||||
int cdx_dev_reset(struct device *dev);
|
||||
|
||||
/**
|
||||
* cdx_set_master - enables bus-mastering for CDX device
|
||||
* @cdx_dev: the CDX device to enable
|
||||
*
|
||||
* Return: 0 for success, -errno on failure
|
||||
*/
|
||||
int cdx_set_master(struct cdx_device *cdx_dev);
|
||||
|
||||
/**
|
||||
* cdx_clear_master - disables bus-mastering for CDX device
|
||||
* @cdx_dev: the CDX device to disable
|
||||
*
|
||||
* Return: 0 for success, -errno on failure
|
||||
*/
|
||||
int cdx_clear_master(struct cdx_device *cdx_dev);
|
||||
|
||||
#ifdef CONFIG_GENERIC_MSI_IRQ
|
||||
/**
|
||||
* cdx_enable_msi - Enable MSI for the CDX device.
|
||||
* @cdx_dev: device pointer
|
||||
*
|
||||
* Return: 0 for success, -errno on failure
|
||||
*/
|
||||
int cdx_enable_msi(struct cdx_device *cdx_dev);
|
||||
|
||||
/**
|
||||
* cdx_disable_msi - Disable MSI for the CDX device.
|
||||
* @cdx_dev: device pointer
|
||||
*/
|
||||
void cdx_disable_msi(struct cdx_device *cdx_dev);
|
||||
|
||||
#else /* CONFIG_GENERIC_MSI_IRQ */
|
||||
|
||||
static inline int cdx_enable_msi(struct cdx_device *cdx_dev)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void cdx_disable_msi(struct cdx_device *cdx_dev)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_GENERIC_MSI_IRQ */
|
||||
|
||||
#endif /* _CDX_BUS_H_ */
|
||||
@@ -0,0 +1,28 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* Driver for AMD network controllers and boards
|
||||
*
|
||||
* Copyright (C) 2021, Xilinx, Inc.
|
||||
* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
|
||||
*/
|
||||
|
||||
#ifndef MC_CDX_PCOL_H
|
||||
#define MC_CDX_PCOL_H
|
||||
#include <linux/cdx/mcdi.h>
|
||||
|
||||
#define MC_CMD_EDAC_GET_DDR_CONFIG_OUT_WORD_LENGTH_LEN 4
|
||||
/* Number of registers for the DDR controller */
|
||||
#define MC_CMD_GET_DDR_CONFIG_OFST 4
|
||||
#define MC_CMD_GET_DDR_CONFIG_LEN 4
|
||||
|
||||
/***********************************/
|
||||
/* MC_CMD_EDAC_GET_DDR_CONFIG
|
||||
* Provides detailed configuration for the DDR controller of the given index.
|
||||
*/
|
||||
#define MC_CMD_EDAC_GET_DDR_CONFIG 0x3
|
||||
|
||||
/* MC_CMD_EDAC_GET_DDR_CONFIG_IN msgrequest */
|
||||
#define MC_CMD_EDAC_GET_DDR_CONFIG_IN_CONTROLLER_INDEX_OFST 0
|
||||
#define MC_CMD_EDAC_GET_DDR_CONFIG_IN_CONTROLLER_INDEX_LEN 4
|
||||
|
||||
#endif /* MC_CDX_PCOL_H */
|
||||
@@ -0,0 +1,199 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* Copyright 2008-2013 Solarflare Communications Inc.
|
||||
* Copyright (C) 2022-2023, Advanced Micro Devices, Inc.
|
||||
*/
|
||||
|
||||
#ifndef CDX_MCDI_H
|
||||
#define CDX_MCDI_H
|
||||
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/kref.h>
|
||||
#include <linux/rpmsg.h>
|
||||
|
||||
#include "linux/cdx/bitfield.h"
|
||||
|
||||
/**
|
||||
* enum cdx_mcdi_mode - MCDI transaction mode
|
||||
* @MCDI_MODE_EVENTS: wait for an mcdi response callback.
|
||||
* @MCDI_MODE_FAIL: we think MCDI is dead, so fail-fast all calls
|
||||
*/
|
||||
enum cdx_mcdi_mode {
|
||||
MCDI_MODE_EVENTS,
|
||||
MCDI_MODE_FAIL,
|
||||
};
|
||||
|
||||
#define MCDI_RPC_TIMEOUT (10 * HZ)
|
||||
#define MCDI_RPC_LONG_TIMEOU (60 * HZ)
|
||||
#define MCDI_RPC_POST_RST_TIME (10 * HZ)
|
||||
|
||||
/**
|
||||
* enum cdx_mcdi_cmd_state - State for an individual MCDI command
|
||||
* @MCDI_STATE_QUEUED: Command not started and is waiting to run.
|
||||
* @MCDI_STATE_RETRY: Command was submitted and MC rejected with no resources,
|
||||
* as MC have too many outstanding commands. Command will be retried once
|
||||
* another command returns.
|
||||
* @MCDI_STATE_RUNNING: Command was accepted and is running.
|
||||
* @MCDI_STATE_RUNNING_CANCELLED: Command is running but the issuer cancelled
|
||||
* the command.
|
||||
* @MCDI_STATE_FINISHED: Processing of this command has completed.
|
||||
*/
|
||||
|
||||
enum cdx_mcdi_cmd_state {
|
||||
MCDI_STATE_QUEUED,
|
||||
MCDI_STATE_RETRY,
|
||||
MCDI_STATE_RUNNING,
|
||||
MCDI_STATE_RUNNING_CANCELLED,
|
||||
MCDI_STATE_FINISHED,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cdx_mcdi - CDX MCDI Firmware interface, to interact
|
||||
* with CDX controller.
|
||||
* @mcdi: MCDI interface
|
||||
* @mcdi_ops: MCDI operations
|
||||
* @r5_rproc : R5 Remoteproc device handle
|
||||
* @rpdev: RPMsg device
|
||||
* @ept: RPMsg endpoint
|
||||
* @work: Post probe work
|
||||
*/
|
||||
struct cdx_mcdi {
|
||||
/* MCDI interface */
|
||||
struct cdx_mcdi_data *mcdi;
|
||||
const struct cdx_mcdi_ops *mcdi_ops;
|
||||
|
||||
struct rproc *r5_rproc;
|
||||
struct rpmsg_device *rpdev;
|
||||
struct rpmsg_endpoint *ept;
|
||||
struct work_struct work;
|
||||
};
|
||||
|
||||
struct cdx_mcdi_ops {
|
||||
void (*mcdi_request)(struct cdx_mcdi *cdx,
|
||||
const struct cdx_dword *hdr, size_t hdr_len,
|
||||
const struct cdx_dword *sdu, size_t sdu_len);
|
||||
unsigned int (*mcdi_rpc_timeout)(struct cdx_mcdi *cdx, unsigned int cmd);
|
||||
};
|
||||
|
||||
typedef void cdx_mcdi_async_completer(struct cdx_mcdi *cdx,
|
||||
unsigned long cookie, int rc,
|
||||
struct cdx_dword *outbuf,
|
||||
size_t outlen_actual);
|
||||
|
||||
/**
|
||||
* struct cdx_mcdi_cmd - An outstanding MCDI command
|
||||
* @ref: Reference count. There will be one reference if the command is
|
||||
* in the mcdi_iface cmd_list, another if it's on a cleanup list,
|
||||
* and a third if it's queued in the work queue.
|
||||
* @list: The data for this entry in mcdi->cmd_list
|
||||
* @cleanup_list: The data for this entry in a cleanup list
|
||||
* @work: The work item for this command, queued in mcdi->workqueue
|
||||
* @mcdi: The mcdi_iface for this command
|
||||
* @state: The state of this command
|
||||
* @inlen: inbuf length
|
||||
* @inbuf: Input buffer
|
||||
* @quiet: Whether to silence errors
|
||||
* @reboot_seen: Whether a reboot has been seen during this command,
|
||||
* to prevent duplicates
|
||||
* @seq: Sequence number
|
||||
* @started: Jiffies this command was started at
|
||||
* @cookie: Context for completion function
|
||||
* @completer: Completion function
|
||||
* @handle: Command handle
|
||||
* @cmd: Command number
|
||||
* @rc: Return code
|
||||
* @outlen: Length of output buffer
|
||||
* @outbuf: Output buffer
|
||||
*/
|
||||
struct cdx_mcdi_cmd {
|
||||
struct kref ref;
|
||||
struct list_head list;
|
||||
struct list_head cleanup_list;
|
||||
struct work_struct work;
|
||||
struct cdx_mcdi_iface *mcdi;
|
||||
enum cdx_mcdi_cmd_state state;
|
||||
size_t inlen;
|
||||
const struct cdx_dword *inbuf;
|
||||
bool quiet;
|
||||
bool reboot_seen;
|
||||
u8 seq;
|
||||
unsigned long started;
|
||||
unsigned long cookie;
|
||||
cdx_mcdi_async_completer *completer;
|
||||
unsigned int handle;
|
||||
unsigned int cmd;
|
||||
int rc;
|
||||
size_t outlen;
|
||||
struct cdx_dword *outbuf;
|
||||
/* followed by inbuf data if necessary */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cdx_mcdi_iface - MCDI protocol context
|
||||
* @cdx: The associated NIC
|
||||
* @iface_lock: Serialise access to this structure
|
||||
* @outstanding_cleanups: Count of cleanups
|
||||
* @cmd_list: List of outstanding and running commands
|
||||
* @workqueue: Workqueue used for delayed processing
|
||||
* @cmd_complete_wq: Waitqueue for command completion
|
||||
* @db_held_by: Command the MC doorbell is in use by
|
||||
* @seq_held_by: Command each sequence number is in use by
|
||||
* @prev_handle: The last used command handle
|
||||
* @mode: Poll for mcdi completion, or wait for an mcdi_event
|
||||
* @prev_seq: The last used sequence number
|
||||
* @new_epoch: Indicates start of day or start of MC reboot recovery
|
||||
*/
|
||||
struct cdx_mcdi_iface {
|
||||
struct cdx_mcdi *cdx;
|
||||
/* Serialise access */
|
||||
struct mutex iface_lock;
|
||||
unsigned int outstanding_cleanups;
|
||||
struct list_head cmd_list;
|
||||
struct workqueue_struct *workqueue;
|
||||
wait_queue_head_t cmd_complete_wq;
|
||||
struct cdx_mcdi_cmd *db_held_by;
|
||||
struct cdx_mcdi_cmd *seq_held_by[16];
|
||||
unsigned int prev_handle;
|
||||
enum cdx_mcdi_mode mode;
|
||||
u8 prev_seq;
|
||||
bool new_epoch;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct cdx_mcdi_data - extra state for NICs that implement MCDI
|
||||
* @iface: Interface/protocol state
|
||||
* @fn_flags: Flags for this function, as returned by %MC_CMD_DRV_ATTACH.
|
||||
*/
|
||||
struct cdx_mcdi_data {
|
||||
struct cdx_mcdi_iface iface;
|
||||
u32 fn_flags;
|
||||
};
|
||||
|
||||
void cdx_mcdi_finish(struct cdx_mcdi *cdx);
|
||||
int cdx_mcdi_init(struct cdx_mcdi *cdx);
|
||||
void cdx_mcdi_process_cmd(struct cdx_mcdi *cdx, struct cdx_dword *outbuf, int len);
|
||||
int cdx_mcdi_rpc(struct cdx_mcdi *cdx, unsigned int cmd,
|
||||
const struct cdx_dword *inbuf, size_t inlen,
|
||||
struct cdx_dword *outbuf, size_t outlen, size_t *outlen_actual);
|
||||
|
||||
/*
|
||||
* We expect that 16- and 32-bit fields in MCDI requests and responses
|
||||
* are appropriately aligned, but 64-bit fields are only
|
||||
* 32-bit-aligned.
|
||||
*/
|
||||
#define MCDI_DECLARE_BUF(_name, _len) struct cdx_dword _name[DIV_ROUND_UP(_len, 4)] = {{0}}
|
||||
#define _MCDI_PTR(_buf, _offset) \
|
||||
((u8 *)(_buf) + (_offset))
|
||||
#define MCDI_PTR(_buf, _field) \
|
||||
_MCDI_PTR(_buf, MC_CMD_ ## _field ## _OFST)
|
||||
#define _MCDI_CHECK_ALIGN(_ofst, _align) \
|
||||
((void)BUILD_BUG_ON_ZERO((_ofst) & ((_align) - 1)), \
|
||||
(_ofst))
|
||||
#define _MCDI_DWORD(_buf, _field) \
|
||||
((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2))
|
||||
|
||||
#define MCDI_SET_DWORD(_buf, _field, _value) \
|
||||
CDX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), CDX_DWORD, _value)
|
||||
#define MCDI_DWORD(_buf, _field) \
|
||||
CDX_DWORD_FIELD(*_MCDI_DWORD(_buf, _field), CDX_DWORD)
|
||||
#endif /* CDX_MCDI_H */
|
||||
Reference in New Issue
Block a user