2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
* Copyright (C) 2015 Intel Corporation.
|
2015-12-03 21:30:38 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IOAT_INTERNAL_H__
|
|
|
|
#define __IOAT_INTERNAL_H__
|
|
|
|
|
2017-05-02 18:18:25 +00:00
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
2015-12-03 21:30:38 +00:00
|
|
|
#include "spdk/ioat.h"
|
|
|
|
#include "spdk/ioat_spec.h"
|
|
|
|
#include "spdk/queue.h"
|
2015-12-10 23:56:12 +00:00
|
|
|
#include "spdk/mmio.h"
|
2015-12-03 21:30:38 +00:00
|
|
|
|
2018-07-04 05:45:37 +00:00
|
|
|
/* Allocate 1 << 15 (32K) descriptors per channel by default. */
|
2015-12-03 21:30:38 +00:00
|
|
|
#define IOAT_DEFAULT_ORDER 15
|
|
|
|
|
|
|
|
struct ioat_descriptor {
|
2018-07-03 17:15:41 +00:00
|
|
|
uint64_t phys_addr;
|
2016-02-11 19:31:35 +00:00
|
|
|
spdk_ioat_req_cb callback_fn;
|
2015-12-03 21:30:38 +00:00
|
|
|
void *callback_arg;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* One of these per allocated PCI device. */
|
2016-02-11 19:31:35 +00:00
|
|
|
struct spdk_ioat_chan {
|
2015-12-03 21:30:38 +00:00
|
|
|
/* Opaque handle to upper layer */
|
2018-06-27 09:06:47 +00:00
|
|
|
struct spdk_pci_device *device;
|
2015-12-03 21:30:38 +00:00
|
|
|
uint64_t max_xfer_size;
|
2016-02-11 17:39:28 +00:00
|
|
|
volatile struct spdk_ioat_registers *regs;
|
2015-12-03 21:30:38 +00:00
|
|
|
|
|
|
|
volatile uint64_t *comp_update;
|
|
|
|
|
|
|
|
uint32_t head;
|
|
|
|
uint32_t tail;
|
|
|
|
|
|
|
|
uint32_t ring_size_order;
|
|
|
|
uint64_t last_seen;
|
|
|
|
|
2015-12-08 17:34:30 +00:00
|
|
|
struct ioat_descriptor *ring;
|
2016-02-11 17:39:28 +00:00
|
|
|
union spdk_ioat_hw_desc *hw_ring;
|
2016-01-29 08:01:43 +00:00
|
|
|
uint32_t dma_capabilities;
|
2016-02-03 19:57:51 +00:00
|
|
|
|
|
|
|
/* tailq entry for attached_chans */
|
2016-02-11 19:31:35 +00:00
|
|
|
TAILQ_ENTRY(spdk_ioat_chan) tailq;
|
2015-12-03 21:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
is_ioat_active(uint64_t status)
|
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
return (status & SPDK_IOAT_CHANSTS_STATUS) == SPDK_IOAT_CHANSTS_ACTIVE;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
is_ioat_idle(uint64_t status)
|
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
return (status & SPDK_IOAT_CHANSTS_STATUS) == SPDK_IOAT_CHANSTS_IDLE;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
is_ioat_halted(uint64_t status)
|
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
return (status & SPDK_IOAT_CHANSTS_STATUS) == SPDK_IOAT_CHANSTS_HALTED;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
is_ioat_suspended(uint64_t status)
|
|
|
|
{
|
2016-02-11 17:39:28 +00:00
|
|
|
return (status & SPDK_IOAT_CHANSTS_STATUS) == SPDK_IOAT_CHANSTS_SUSPENDED;
|
2015-12-03 21:30:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __IOAT_INTERNAL_H__ */
|