#include <linux/acpi.h>
#include <linux/iopoll.h>
#include <linux/platform_device.h>
#include <linux/sysfs.h>
#include <acpi/pcc.h>
#include "kunpeng_hccs.h"
#define HCCS_PCC_CMD_WAIT_RETRIES_NUM …
#define HCCS_POLL_STATUS_TIME_INTERVAL_US …
static struct hccs_port_info *kobj_to_port_info(struct kobject *k)
{ … }
static struct hccs_die_info *kobj_to_die_info(struct kobject *k)
{ … }
static struct hccs_chip_info *kobj_to_chip_info(struct kobject *k)
{ … }
struct hccs_register_ctx { … };
static acpi_status hccs_get_register_cb(struct acpi_resource *ares,
void *context)
{ … }
static int hccs_get_pcc_chan_id(struct hccs_dev *hdev)
{ … }
static void hccs_chan_tx_done(struct mbox_client *cl, void *msg, int ret)
{ … }
static void hccs_pcc_rx_callback(struct mbox_client *cl, void *mssg)
{ … }
static void hccs_unregister_pcc_channel(struct hccs_dev *hdev)
{ … }
static int hccs_register_pcc_channel(struct hccs_dev *hdev)
{ … }
static int hccs_wait_cmd_complete_by_poll(struct hccs_dev *hdev)
{ … }
static int hccs_wait_cmd_complete_by_irq(struct hccs_dev *hdev)
{ … }
static inline void hccs_fill_pcc_shared_mem_region(struct hccs_dev *hdev,
u8 cmd,
struct hccs_desc *desc,
void __iomem *comm_space,
u16 space_size)
{ … }
static inline void hccs_fill_ext_pcc_shared_mem_region(struct hccs_dev *hdev,
u8 cmd,
struct hccs_desc *desc,
void __iomem *comm_space,
u16 space_size)
{ … }
static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8 cmd,
struct hccs_desc *desc)
{ … }
static void hccs_init_req_desc(struct hccs_desc *desc)
{ … }
static int hccs_get_dev_caps(struct hccs_dev *hdev)
{ … }
static int hccs_query_chip_num_on_platform(struct hccs_dev *hdev)
{ … }
static int hccs_get_chip_info(struct hccs_dev *hdev,
struct hccs_chip_info *chip)
{ … }
static int hccs_query_chip_info_on_platform(struct hccs_dev *hdev)
{ … }
static int hccs_query_die_info_on_chip(struct hccs_dev *hdev, u8 chip_id,
u8 die_idx, struct hccs_die_info *die)
{ … }
static int hccs_query_all_die_info_on_platform(struct hccs_dev *hdev)
{ … }
static int hccs_get_bd_info(struct hccs_dev *hdev, u8 opcode,
struct hccs_desc *desc,
void *buf, size_t buf_len,
struct hccs_rsp_head *rsp_head)
{ … }
static int hccs_get_all_port_attr(struct hccs_dev *hdev,
struct hccs_die_info *die,
struct hccs_port_attr *attrs, u16 size)
{ … }
static int hccs_get_all_port_info_on_die(struct hccs_dev *hdev,
struct hccs_die_info *die)
{ … }
static int hccs_query_all_port_info_on_platform(struct hccs_dev *hdev)
{ … }
static int hccs_get_hw_info(struct hccs_dev *hdev)
{ … }
static int hccs_query_port_link_status(struct hccs_dev *hdev,
const struct hccs_port_info *port,
struct hccs_link_status *link_status)
{ … }
static int hccs_query_port_crc_err_cnt(struct hccs_dev *hdev,
const struct hccs_port_info *port,
u64 *crc_err_cnt)
{ … }
static int hccs_get_die_all_link_status(struct hccs_dev *hdev,
const struct hccs_die_info *die,
u8 *all_linked)
{ … }
static int hccs_get_die_all_port_lane_status(struct hccs_dev *hdev,
const struct hccs_die_info *die,
u8 *full_lane)
{ … }
static int hccs_get_die_total_crc_err_cnt(struct hccs_dev *hdev,
const struct hccs_die_info *die,
u64 *total_crc_err_cnt)
{ … }
static ssize_t hccs_show(struct kobject *k, struct attribute *attr, char *buf)
{ … }
static const struct sysfs_ops hccs_comm_ops = …;
static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute hccs_type_attr = …;
static ssize_t lane_mode_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute lane_mode_attr = …;
static ssize_t enable_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute port_enable_attr = …;
static ssize_t cur_lane_num_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute cur_lane_num_attr = …;
static ssize_t link_fsm_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute link_fsm_attr = …;
static ssize_t lane_mask_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute lane_mask_attr = …;
static ssize_t crc_err_cnt_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute crc_err_cnt_attr = …;
static struct attribute *hccs_port_default_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type hccs_port_type = …;
static ssize_t all_linked_on_die_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute all_linked_on_die_attr = …;
static ssize_t linked_full_lane_on_die_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute linked_full_lane_on_die_attr = …;
static ssize_t crc_err_cnt_sum_on_die_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute crc_err_cnt_sum_on_die_attr = …;
static struct attribute *hccs_die_default_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type hccs_die_type = …;
static ssize_t all_linked_on_chip_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute all_linked_on_chip_attr = …;
static ssize_t linked_full_lane_on_chip_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute linked_full_lane_on_chip_attr = …;
static ssize_t crc_err_cnt_sum_on_chip_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute crc_err_cnt_sum_on_chip_attr = …;
static struct attribute *hccs_chip_default_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type hccs_chip_type = …;
static void hccs_remove_die_dir(struct hccs_die_info *die)
{ … }
static void hccs_remove_chip_dir(struct hccs_chip_info *chip)
{ … }
static void hccs_remove_topo_dirs(struct hccs_dev *hdev)
{ … }
static int hccs_create_hccs_dir(struct hccs_dev *hdev,
struct hccs_die_info *die,
struct hccs_port_info *port)
{ … }
static int hccs_create_die_dir(struct hccs_dev *hdev,
struct hccs_chip_info *chip,
struct hccs_die_info *die)
{ … }
static int hccs_create_chip_dir(struct hccs_dev *hdev,
struct hccs_chip_info *chip)
{ … }
static int hccs_create_topo_dirs(struct hccs_dev *hdev)
{ … }
static int hccs_probe(struct platform_device *pdev)
{ … }
static void hccs_remove(struct platform_device *pdev)
{ … }
static const struct hccs_verspecific_data hisi04b1_verspec_data = …;
static const struct hccs_verspecific_data hisi04b2_verspec_data = …;
static const struct acpi_device_id hccs_acpi_match[] = …;
MODULE_DEVICE_TABLE(acpi, hccs_acpi_match);
static struct platform_driver hccs_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;