The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/cavium/octeon_cop2.S

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2011 Oleksandr Tymoshenko
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: stable/12/sys/mips/cavium/octeon_cop2.S 331254 2018-03-20 17:58:51Z emaste $
   27  */
   28 
   29 #include <machine/asm.h>
   30 #include <mips/cavium/octeon_cop2.h>
   31 
   32 #include "assym.inc"
   33 
   34 .set noreorder
   35 
   36 #define SAVE_COP2_REGISTER(reg)                         \
   37         dmfc2   t1, reg; sd     t1, reg##_OFFSET(a0)
   38 
   39 
   40 #define RESTORE_COP2_REGISTER(reg)                      \
   41         ld      t1, reg##_OFFSET(a0); dmtc2     t1, reg##_SET
   42  
   43 LEAF(octeon_cop2_save)
   44         /* Get CvmCtl register */
   45         dmfc0   t0, $9, 7
   46 
   47         /* CRC state */
   48         SAVE_COP2_REGISTER(COP2_CRC_IV)
   49         SAVE_COP2_REGISTER(COP2_CRC_LENGTH)
   50         SAVE_COP2_REGISTER(COP2_CRC_POLY)
   51 
   52         /* if CvmCtl[NODFA_CP2] -> save_nodfa */
   53         bbit1   t0, 28, save_nodfa
   54         nop
   55 
   56         /* LLM state */
   57         SAVE_COP2_REGISTER(COP2_LLM_DAT0)
   58         SAVE_COP2_REGISTER(COP2_LLM_DAT1)
   59 
   60 save_nodfa:
   61         /* crypto stuff is irrelevant if CvmCtl[NOCRYPTO]  */
   62         bbit1   t0, 26, save_done
   63         nop
   64 
   65         SAVE_COP2_REGISTER(COP2_3DES_IV)
   66         SAVE_COP2_REGISTER(COP2_3DES_KEY0)
   67         SAVE_COP2_REGISTER(COP2_3DES_KEY1)
   68         SAVE_COP2_REGISTER(COP2_3DES_KEY2)
   69         SAVE_COP2_REGISTER(COP2_3DES_RESULT)
   70 
   71         SAVE_COP2_REGISTER(COP2_AES_INP0)
   72         SAVE_COP2_REGISTER(COP2_AES_IV0)
   73         SAVE_COP2_REGISTER(COP2_AES_IV1)
   74         SAVE_COP2_REGISTER(COP2_AES_KEY0)
   75         SAVE_COP2_REGISTER(COP2_AES_KEY1)
   76         SAVE_COP2_REGISTER(COP2_AES_KEY2)
   77         SAVE_COP2_REGISTER(COP2_AES_KEY3)
   78         SAVE_COP2_REGISTER(COP2_AES_KEYLEN)
   79         SAVE_COP2_REGISTER(COP2_AES_RESULT0)
   80         SAVE_COP2_REGISTER(COP2_AES_RESULT1)
   81 
   82         dmfc0   t0, $15
   83         li      t1, 0x000d0000 /* Octeon Pass1 */
   84         beq     t0, t1, save_pass1
   85         nop
   86 
   87         SAVE_COP2_REGISTER(COP2_HSH_DATW0)
   88         SAVE_COP2_REGISTER(COP2_HSH_DATW1)
   89         SAVE_COP2_REGISTER(COP2_HSH_DATW2)
   90         SAVE_COP2_REGISTER(COP2_HSH_DATW3)
   91         SAVE_COP2_REGISTER(COP2_HSH_DATW4)
   92         SAVE_COP2_REGISTER(COP2_HSH_DATW5)
   93         SAVE_COP2_REGISTER(COP2_HSH_DATW6)
   94         SAVE_COP2_REGISTER(COP2_HSH_DATW7)
   95         SAVE_COP2_REGISTER(COP2_HSH_DATW8)
   96         SAVE_COP2_REGISTER(COP2_HSH_DATW9)
   97         SAVE_COP2_REGISTER(COP2_HSH_DATW10)
   98         SAVE_COP2_REGISTER(COP2_HSH_DATW11)
   99         SAVE_COP2_REGISTER(COP2_HSH_DATW12)
  100         SAVE_COP2_REGISTER(COP2_HSH_DATW13)
  101         SAVE_COP2_REGISTER(COP2_HSH_DATW14)
  102         SAVE_COP2_REGISTER(COP2_HSH_IVW0)
  103         SAVE_COP2_REGISTER(COP2_HSH_IVW1)
  104         SAVE_COP2_REGISTER(COP2_HSH_IVW2)
  105         SAVE_COP2_REGISTER(COP2_HSH_IVW3)
  106         SAVE_COP2_REGISTER(COP2_HSH_IVW4)
  107         SAVE_COP2_REGISTER(COP2_HSH_IVW5)
  108         SAVE_COP2_REGISTER(COP2_HSH_IVW6)
  109         SAVE_COP2_REGISTER(COP2_HSH_IVW7)
  110         SAVE_COP2_REGISTER(COP2_GFM_MULT0)
  111         SAVE_COP2_REGISTER(COP2_GFM_MULT1)
  112         SAVE_COP2_REGISTER(COP2_GFM_POLY)
  113         SAVE_COP2_REGISTER(COP2_GFM_RESULT0)
  114         SAVE_COP2_REGISTER(COP2_GFM_RESULT1)
  115         jr ra
  116         nop
  117 
  118 save_pass1:
  119         SAVE_COP2_REGISTER(COP2_HSH_DATW0_PASS1)
  120         SAVE_COP2_REGISTER(COP2_HSH_DATW1_PASS1)
  121         SAVE_COP2_REGISTER(COP2_HSH_DATW2_PASS1)
  122         SAVE_COP2_REGISTER(COP2_HSH_DATW3_PASS1)
  123         SAVE_COP2_REGISTER(COP2_HSH_DATW4_PASS1)
  124         SAVE_COP2_REGISTER(COP2_HSH_DATW5_PASS1)
  125         SAVE_COP2_REGISTER(COP2_HSH_DATW6_PASS1)
  126         SAVE_COP2_REGISTER(COP2_HSH_IVW0_PASS1)
  127         SAVE_COP2_REGISTER(COP2_HSH_IVW1_PASS1)
  128         SAVE_COP2_REGISTER(COP2_HSH_IVW2_PASS1)
  129 
  130 save_done:      
  131         jr ra
  132         nop
  133 END(octeon_cop2_save)
  134 
  135 LEAF(octeon_cop2_restore)
  136         /* Get CvmCtl register */
  137         dmfc0   t0, $9, 7
  138 
  139         /* CRC state */
  140         RESTORE_COP2_REGISTER(COP2_CRC_IV)
  141         RESTORE_COP2_REGISTER(COP2_CRC_LENGTH)
  142         RESTORE_COP2_REGISTER(COP2_CRC_POLY)
  143 
  144         /* if CvmCtl[NODFA_CP2] -> save_nodfa */
  145         bbit1   t0, 28, restore_nodfa
  146         nop
  147 
  148         /* LLM state */
  149         RESTORE_COP2_REGISTER(COP2_LLM_DAT0)
  150         RESTORE_COP2_REGISTER(COP2_LLM_DAT1)
  151 
  152 restore_nodfa:
  153         /* crypto stuff is irrelevant if CvmCtl[NOCRYPTO]  */
  154         bbit1   t0, 26, restore_done
  155         nop
  156 
  157         RESTORE_COP2_REGISTER(COP2_3DES_IV)
  158         RESTORE_COP2_REGISTER(COP2_3DES_KEY0)
  159         RESTORE_COP2_REGISTER(COP2_3DES_KEY1)
  160         RESTORE_COP2_REGISTER(COP2_3DES_KEY2)
  161         RESTORE_COP2_REGISTER(COP2_3DES_RESULT)
  162 
  163         RESTORE_COP2_REGISTER(COP2_AES_INP0)
  164         RESTORE_COP2_REGISTER(COP2_AES_IV0)
  165         RESTORE_COP2_REGISTER(COP2_AES_IV1)
  166         RESTORE_COP2_REGISTER(COP2_AES_KEY0)
  167         RESTORE_COP2_REGISTER(COP2_AES_KEY1)
  168         RESTORE_COP2_REGISTER(COP2_AES_KEY2)
  169         RESTORE_COP2_REGISTER(COP2_AES_KEY3)
  170         RESTORE_COP2_REGISTER(COP2_AES_KEYLEN)
  171         RESTORE_COP2_REGISTER(COP2_AES_RESULT0)
  172         RESTORE_COP2_REGISTER(COP2_AES_RESULT1)
  173 
  174         dmfc0   t0, $15
  175         li      t1, 0x000d0000 /* Octeon Pass1 */
  176         beq     t0, t1, restore_pass1
  177         nop
  178 
  179         RESTORE_COP2_REGISTER(COP2_HSH_DATW0)
  180         RESTORE_COP2_REGISTER(COP2_HSH_DATW1)
  181         RESTORE_COP2_REGISTER(COP2_HSH_DATW2)
  182         RESTORE_COP2_REGISTER(COP2_HSH_DATW3)
  183         RESTORE_COP2_REGISTER(COP2_HSH_DATW4)
  184         RESTORE_COP2_REGISTER(COP2_HSH_DATW5)
  185         RESTORE_COP2_REGISTER(COP2_HSH_DATW6)
  186         RESTORE_COP2_REGISTER(COP2_HSH_DATW7)
  187         RESTORE_COP2_REGISTER(COP2_HSH_DATW8)
  188         RESTORE_COP2_REGISTER(COP2_HSH_DATW9)
  189         RESTORE_COP2_REGISTER(COP2_HSH_DATW10)
  190         RESTORE_COP2_REGISTER(COP2_HSH_DATW11)
  191         RESTORE_COP2_REGISTER(COP2_HSH_DATW12)
  192         RESTORE_COP2_REGISTER(COP2_HSH_DATW13)
  193         RESTORE_COP2_REGISTER(COP2_HSH_DATW14)
  194         RESTORE_COP2_REGISTER(COP2_HSH_IVW0)
  195         RESTORE_COP2_REGISTER(COP2_HSH_IVW1)
  196         RESTORE_COP2_REGISTER(COP2_HSH_IVW2)
  197         RESTORE_COP2_REGISTER(COP2_HSH_IVW3)
  198         RESTORE_COP2_REGISTER(COP2_HSH_IVW4)
  199         RESTORE_COP2_REGISTER(COP2_HSH_IVW5)
  200         RESTORE_COP2_REGISTER(COP2_HSH_IVW6)
  201         RESTORE_COP2_REGISTER(COP2_HSH_IVW7)
  202         RESTORE_COP2_REGISTER(COP2_GFM_MULT0)
  203         RESTORE_COP2_REGISTER(COP2_GFM_MULT1)
  204         RESTORE_COP2_REGISTER(COP2_GFM_POLY)
  205         RESTORE_COP2_REGISTER(COP2_GFM_RESULT0)
  206         RESTORE_COP2_REGISTER(COP2_GFM_RESULT1)
  207         jr ra
  208         nop
  209 
  210 restore_pass1:
  211         RESTORE_COP2_REGISTER(COP2_HSH_DATW0_PASS1)
  212         RESTORE_COP2_REGISTER(COP2_HSH_DATW1_PASS1)
  213         RESTORE_COP2_REGISTER(COP2_HSH_DATW2_PASS1)
  214         RESTORE_COP2_REGISTER(COP2_HSH_DATW3_PASS1)
  215         RESTORE_COP2_REGISTER(COP2_HSH_DATW4_PASS1)
  216         RESTORE_COP2_REGISTER(COP2_HSH_DATW5_PASS1)
  217         RESTORE_COP2_REGISTER(COP2_HSH_DATW6_PASS1)
  218         RESTORE_COP2_REGISTER(COP2_HSH_IVW0_PASS1)
  219         RESTORE_COP2_REGISTER(COP2_HSH_IVW1_PASS1)
  220         RESTORE_COP2_REGISTER(COP2_HSH_IVW2_PASS1)
  221 
  222 restore_done:   
  223         jr ra
  224         nop
  225 END(octeon_cop2_restore)

Cache object: dce248e0748465ea76dc4a6e8f265438


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.