/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
static __inline uint64_t
octpko_cmd_word0(int sz1, int sz0, int s1, int reg1, int s0, int reg0,
int le, int n2, int q, int r, int g, int ipoffp1, int ii, int df, int segs,
int totalbytes)
{
uint64_t cmd =
__SHIFTIN(sz1, PKO_CMD_WORD0_SZ1) |
__SHIFTIN(sz0, PKO_CMD_WORD0_SZ0) |
__SHIFTIN(s1, PKO_CMD_WORD0_S1) |
__SHIFTIN(reg1, PKO_CMD_WORD0_REG1) |
__SHIFTIN(s0, PKO_CMD_WORD0_S0) |
__SHIFTIN(reg0, PKO_CMD_WORD0_REG0) |
__SHIFTIN(le, PKO_CMD_WORD0_LE) |
__SHIFTIN(n2, PKO_CMD_WORD0_N2) |
__SHIFTIN(q, PKO_CMD_WORD0_Q) |
__SHIFTIN(r, PKO_CMD_WORD0_R) |
__SHIFTIN(g, PKO_CMD_WORD0_G) |
__SHIFTIN(ipoffp1, PKO_CMD_WORD0_IPOFFP1) |
__SHIFTIN(ii, PKO_CMD_WORD0_II) |
__SHIFTIN(df, PKO_CMD_WORD0_DF) |
__SHIFTIN(segs, PKO_CMD_WORD0_SEGS) |
__SHIFTIN(totalbytes, PKO_CMD_WORD0_TOTALBYTES);
return cmd;
}
static __inline uint64_t
octpko_cmd_word1(int i, int back, int pool, int size, paddr_t addr)
{
uint64_t cmd =
__SHIFTIN(i, PKO_CMD_WORD1_I) |
__SHIFTIN(back, PKO_CMD_WORD1_BACK) |
__SHIFTIN(pool, PKO_CMD_WORD1_POOL) |
__SHIFTIN(size, PKO_CMD_WORD1_SIZE) |
__SHIFTIN(addr, PKO_CMD_WORD1_ADDR);