18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2013-2016, Intel Corporation. All rights reserved.
48c2ecf20Sopenharmony_ci * Intel Management Engine Interface (Intel MEI) Linux driver
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef _MEI_HW_TXE_H_
88c2ecf20Sopenharmony_ci#define _MEI_HW_TXE_H_
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/irqreturn.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "hw.h"
138c2ecf20Sopenharmony_ci#include "hw-txe-regs.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define MEI_TXI_RPM_TIMEOUT    500 /* ms */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Flatten Hierarchy interrupt cause */
188c2ecf20Sopenharmony_ci#define TXE_INTR_READINESS_BIT  0 /* HISR_INT_0_STS */
198c2ecf20Sopenharmony_ci#define TXE_INTR_READINESS      HISR_INT_0_STS
208c2ecf20Sopenharmony_ci#define TXE_INTR_ALIVENESS_BIT  1 /* HISR_INT_1_STS */
218c2ecf20Sopenharmony_ci#define TXE_INTR_ALIVENESS      HISR_INT_1_STS
228c2ecf20Sopenharmony_ci#define TXE_INTR_OUT_DB_BIT     2 /* HISR_INT_2_STS */
238c2ecf20Sopenharmony_ci#define TXE_INTR_OUT_DB         HISR_INT_2_STS
248c2ecf20Sopenharmony_ci#define TXE_INTR_IN_READY_BIT   8 /* beyond HISR */
258c2ecf20Sopenharmony_ci#define TXE_INTR_IN_READY       BIT(8)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/**
288c2ecf20Sopenharmony_ci * struct mei_txe_hw - txe hardware specifics
298c2ecf20Sopenharmony_ci *
308c2ecf20Sopenharmony_ci * @mem_addr:            SeC and BRIDGE bars
318c2ecf20Sopenharmony_ci * @aliveness:           aliveness (power gating) state of the hardware
328c2ecf20Sopenharmony_ci * @readiness:           readiness state of the hardware
338c2ecf20Sopenharmony_ci * @slots:               number of empty slots
348c2ecf20Sopenharmony_ci * @wait_aliveness_resp: aliveness wait queue
358c2ecf20Sopenharmony_ci * @intr_cause:          translated interrupt cause
368c2ecf20Sopenharmony_ci */
378c2ecf20Sopenharmony_cistruct mei_txe_hw {
388c2ecf20Sopenharmony_ci	void __iomem * const *mem_addr;
398c2ecf20Sopenharmony_ci	u32 aliveness;
408c2ecf20Sopenharmony_ci	u32 readiness;
418c2ecf20Sopenharmony_ci	u32 slots;
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	wait_queue_head_t wait_aliveness_resp;
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci	unsigned long intr_cause;
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define to_txe_hw(dev) (struct mei_txe_hw *)((dev)->hw)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistatic inline struct mei_device *hw_txe_to_mei(struct mei_txe_hw *hw)
518c2ecf20Sopenharmony_ci{
528c2ecf20Sopenharmony_ci	return container_of((void *)hw, struct mei_device, hw);
538c2ecf20Sopenharmony_ci}
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct mei_device *mei_txe_dev_init(struct pci_dev *pdev);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciirqreturn_t mei_txe_irq_quick_handler(int irq, void *dev_id);
588c2ecf20Sopenharmony_ciirqreturn_t mei_txe_irq_thread_handler(int irq, void *dev_id);
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciint mei_txe_aliveness_set_sync(struct mei_device *dev, u32 req);
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciint mei_txe_setup_satt2(struct mei_device *dev, phys_addr_t addr, u32 range);
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#endif /* _MEI_HW_TXE_H_ */
66