2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
16 #ifndef _CPQARY3_Q_MEM_H
17 #define _CPQARY3_Q_MEM_H
23 #define CPQARY3_GET_MEM_TAG 4
25 #define CPQARY3_FREE 0
26 #define CPQARY3_OCCUPIED 1
27 #define CPQARY3_SELF_OCCUPIED 2
28 #define CPQARY3_POLL_OCCUPIED 3
30 #define CPQARY3_PHYCTGS_DONE 0x01
31 #define CPQARY3_CMDMEM_DONE 0x02
32 #define CPQARY3_MEMLIST_DONE 0x04
34 #define CPQARY3_SUBMITTED_Q 0x0100
35 #define CPQARY3_APPEND_RETRIEVE 1
36 #define CPQARY3_REMOVE_SUBMITTED 0
38 #define CPQARY3_Q_UNMASK 0x0300
41 * No. of Commands that would be accomodated in each Command Pool
42 * Each command needs a physical contigous memory of 564 Bytes.
43 * The number of blocks to be allocated would be decided at run time
44 * depending upon the maximum outstanding commands supported by that controller.
46 #define NO_OF_CMDLIST_IN_A_BLK 3
50 * This structure is meant to store the handle of the physically contiguous
51 * memory blcoks that will be allocated during the _meminit().
52 * The no. of blocks that will be allocated will be decide at run time
53 * depending upon the maximum outstanding commands supported by the controller.
54 * each block is physically contiguous & can hold 3 commands.
56 typedef struct cpqary3_phyctg
{
58 ddi_dma_handle_t cpqary3_dmahandle
;
59 ddi_acc_handle_t cpqary3_acchandle
;
60 ddi_dma_cookie_t cpqary3_dmacookie
;
63 typedef struct cpqary3_command_private CMDLIST
;
65 /* Linked List Structure to hold Command List Details */
66 typedef struct cpqary3_command_private
{
69 uint32_t cmdlist_phyaddr
;
70 uint32_t cmdlist_erraddr
;
72 ErrorInfo_t
*errorinfop
;
73 CommandList_t
*cmdlist_memaddr
;
74 struct cpqary3_command_private
*next
; /* next Command Memory */
75 struct cpqary3_command_private
*prev
; /* previous Command Memory */
76 struct cpqary3_per_controller
*ctlr
; /* to its controller */
77 struct cpqary3_pkt
*pvt_pkt
; /* Driver Private Packet */
78 struct cpqary3_driver_private
*driverdata
; /* command private data */
79 struct cpqary3_command_private
*snext
; /* to maintain Submitted Q & */
80 struct cpqary3_command_private
*sprev
; /* Retrieved Q. */
81 void (*complete
)(CMDLIST
*);
84 /* structure to maintain a linked list of the memory blocks */
85 typedef struct physical_handle_address
{
86 cpqary3_phyctg_t
*blk_addr
;
87 struct physical_handle_address
*next
;
88 } cpqary3_phys_hdl_addr_t
;
90 /* Structure to hold Memory Pool Details */
91 typedef struct cpqary3_cmdmemlist
{
93 cpqary3_cmdpvt_t
*pool
;
94 cpqary3_cmdpvt_t
*head
;
95 cpqary3_cmdpvt_t
*tail
;
96 cpqary3_phys_hdl_addr_t
*cpqary3_phyctgp
; /* list of memory blocks */
97 } cpqary3_cmdmemlist_t
;
103 #endif /* _CPQARY3_Q_MEM_H */