1142425Snectar/*- 2142425Snectar * This file is provided under a dual BSD/GPLv2 license. When using or 3142425Snectar * redistributing this file, you may do so under either license. 4142425Snectar * 5142425Snectar * GPL LICENSE SUMMARY 6142425Snectar * 7142425Snectar * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8142425Snectar * 9142425Snectar * This program is free software; you can redistribute it and/or modify 10142425Snectar * it under the terms of version 2 of the GNU General Public License as 11142425Snectar * published by the Free Software Foundation. 12142425Snectar * 13142425Snectar * This program is distributed in the hope that it will be useful, but 14142425Snectar * WITHOUT ANY WARRANTY; without even the implied warranty of 15142425Snectar * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16142425Snectar * General Public License for more details. 17142425Snectar * 18142425Snectar * You should have received a copy of the GNU General Public License 19142425Snectar * along with this program; if not, write to the Free Software 20142425Snectar * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21142425Snectar * The full GNU General Public License is included in this distribution 22160814Ssimon * in the file called LICENSE.GPL. 23238405Sjkim * 24238405Sjkim * BSD LICENSE 25238405Sjkim * 26142425Snectar * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27142425Snectar * All rights reserved. 28160814Ssimon * 29238405Sjkim * Redistribution and use in source and binary forms, with or without 30238405Sjkim * modification, are permitted provided that the following conditions 31238405Sjkim * are met: 32142425Snectar * 33142425Snectar * * Redistributions of source code must retain the above copyright 34142425Snectar * notice, this list of conditions and the following disclaimer. 35142425Snectar * * Redistributions in binary form must reproduce the above copyright 36142425Snectar * notice, this list of conditions and the following disclaimer in 37142425Snectar * the documentation and/or other materials provided with the 38142425Snectar * distribution. 39142425Snectar * 40142425Snectar * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41142425Snectar * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42142425Snectar * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43142425Snectar * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44142425Snectar * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45142425Snectar * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46238405Sjkim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47142425Snectar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48142425Snectar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49142425Snectar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50142425Snectar * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51142425Snectar * 52142425Snectar * $FreeBSD$ 53142425Snectar */ 54142425Snectar#ifndef _SCI_MEMORY_DESCRIPTOR_LIST_DECORATOR_H_ 55142425Snectar#define _SCI_MEMORY_DESCRIPTOR_LIST_DECORATOR_H_ 56142425Snectar 57142425Snectar/** 58142425Snectar * @file 59160814Ssimon * 60160814Ssimon * @brief This file contains methods utilized to provide additional 61142425Snectar * functionality above normal MDL processing. 62142425Snectar */ 63142425Snectar 64142425Snectar#ifdef __cplusplus 65142425Snectarextern "C" { 66142425Snectar#endif // __cplusplus 67142425Snectar 68142425Snectar#include <dev/isci/scil/sci_memory_descriptor_list.h> 69142425Snectar 70142425Snectar/** 71142425Snectar * @brief This method will determine the amount of memory needed for 72142425Snectar * memory descriptors with exact matching memory attributes. 73142425Snectar * If the supplied attributes value is 0, then all MDEs are 74284283Sjkim * included in the calculation. 75284283Sjkim * 76142425Snectar * @param[in] mdl This parameter specifies the MDL to search through 77160814Ssimon * for MDEs with matching memory attributes. 78142425Snectar * @param[in] attributes This parameter specifies the attributes to 79142425Snectar * match. If this parameter is set to 0, then each MDE 80142425Snectar * is included in the calculation. 81142425Snectar * 82142425Snectar * @return This method returns the number of bytes, including offsets 83142425Snectar * to achieve proper alignment, for memory descriptors that 84142425Snectar * exactly match the supplied memory attributes. 85142425Snectar */ 86142425SnectarU32 sci_mdl_decorator_get_memory_size( 87142425Snectar SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl, 88142425Snectar U32 attributes 89194206Ssimon); 90194206Ssimon 91194206Ssimon/** 92194206Ssimon * @brief This method will assign the supplied memory address values 93194206Ssimon * to all of the MDEs in the memory descriptor list with 94194206Ssimon * exact matching attributes as those supplied by parameter. 95238405Sjkim * If the supplied attributes value is 0, then all MDEs will 96238405Sjkim * have their values assigned. 97238405Sjkim * 98238405Sjkim * @warning It is suggested the user invoke the 99238405Sjkim * sci_mdl_decorator_get_memory_size() method prior to invoking 100238405Sjkim * this method. This ensures that the user supplies pointers 101238405Sjkim * that refer to memory locations with sufficient space. 102194206Ssimon * 103194206Ssimon * @param[in,out] mdl This parameter specifies the MDL to iterate through 104194206Ssimon * for MDEs with matching memory attributes. 105194206Ssimon * @param[in] attributes This parameter specifies the attributes to 106194206Ssimon * match. If this parameter is set to 0, then each 107142425Snectar * memory descriptor will be filled out. 108238405Sjkim * @param[in] virtual_address This parameter specifies the starting 109238405Sjkim * virtual address to be used when filling out the MDE 110238405Sjkim * virtual address field. 111238405Sjkim * @param[in] sci_physical_address This parameter specifies the starting 112238405Sjkim * physical address to be used when filling out the MDE 113238405Sjkim * physical address field. 114238405Sjkim * 115238405Sjkim * @return none 116160814Ssimon */ 117194206Ssimonvoid sci_mdl_decorator_assign_memory( 118238405Sjkim SCI_MEMORY_DESCRIPTOR_LIST_HANDLE_T mdl, 119194206Ssimon U32 attributes, 120194206Ssimon POINTER_UINT virtual_address, 121238405Sjkim SCI_PHYSICAL_ADDRESS sci_physical_address 122205128Ssimon); 123160814Ssimon 124160814Ssimon#ifdef __cplusplus 125160814Ssimon} 126194206Ssimon#endif // __cplusplus 127238405Sjkim 128238405Sjkim#endif // _SCI_MEMORY_DESCRIPTOR_LIST_DECORATOR_H_ 129238405Sjkim 130238405Sjkim