2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SCI_BASE_MEMORY_DESCRIPTOR_LIST_H_
57 #define _SCI_BASE_MEMORY_DESCRIPTOR_LIST_H_
60 * This file contains the protected interface structures, constants and
61 * interface methods for the struct sci_base_memory_descriptor_list object.
67 #include "sci_types.h"
68 #include "sci_memory_descriptor_list.h"
72 * struct sci_base_memory_descriptor_list - This structure contains all of the
73 * fields necessary to implement a simple stack for managing the list of
74 * available controller indices.
78 struct sci_base_memory_descriptor_list {
80 * This field indicates the length of the memory descriptor entry array.
85 * This field is utilized to provide iterator pattern functionality.
86 * It indicates the index of the next memory descriptor in the iteration.
91 * This field will point to the list of memory descriptors.
93 struct sci_physical_memory_descriptor *mde_array;
96 * This field simply allows a user to chain memory descriptor lists
97 * together if desired. This field will be initialized to
100 struct sci_base_memory_descriptor_list *next_mdl;
105 * sci_base_mdl_construct() - This method is invoked to construct an memory
106 * descriptor list. It initializes the fields of the MDL.
107 * @mdl: This parameter specifies the memory descriptor list to be constructed.
108 * @mde_array: This parameter specifies the array of memory descriptor entries
109 * to be managed by this list.
110 * @mde_array_length: This parameter specifies the size of the array of entries.
111 * @next_mdl: This parameter specifies a subsequent MDL object to be managed by
116 void sci_base_mdl_construct(
117 struct sci_base_memory_descriptor_list *mdl,
118 struct sci_physical_memory_descriptor *mde_array,
119 u32 mde_array_length,
120 struct sci_base_memory_descriptor_list *next_mdl);
123 * sci_base_mde_construct() -
125 * This macro constructs an memory descriptor entry with the given alignment
128 #define sci_base_mde_construct(mde, alignment, size, attributes) \
130 (mde)->constant_memory_alignment = (alignment); \
131 (mde)->constant_memory_size = (size); \
132 (mde)->constant_memory_attributes = (attributes); \
136 * sci_base_mde_is_valid() - This method validates that the memory descriptor
137 * is correctly filled out by the SCI User
138 * @mde: This parameter is the mde entry to validate
139 * @alignment: This parameter specifies the expected alignment of the memory
141 * @size: This parameter specifies the memory size expected for the mde its
142 * value should not have been changed by the SCI User.
143 * @attributes: This parameter specifies the attributes for the memory
144 * descriptor provided.
146 * bool This method returns an indication as to whether the supplied MDE is
147 * valid or not. true The MDE is valid. false The MDE is not valid.
149 bool sci_base_mde_is_valid(
150 struct sci_physical_memory_descriptor *mde,
155 #endif /* _SCI_BASE_MEMORY_DESCRIPTOR_LIST_H_ */