1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 
  27 /*
  28  * Assembly language support for pci config space access on sun4v
  29  */
  30 
  31 #include <sys/asm_linkage.h>
  32 #include <sys/hypervisor_api.h>
  33 #include <sys/dditypes.h>
  34 #include <sys/pci_cfgacc.h>
  35 #include <io/px/px_ioapi.h>
  36 #include <io/px/px_lib4v.h>
  37 
  38         /*
  39          * arg0 - devhandle
  40          * arg1 - pci_device
  41          * arg2 - pci_config_offset
  42          * arg3 - pci_config_size (1, 2 or 4 byte)
  43          *
  44          * ret0 - status
  45          * ret1 - error_flag
  46          * ret2 - pci_cfg_data
  47          */
  48         ENTRY(hvio_config_get)
  49         mov     HVIO_CONFIG_GET, %o5
  50         ta      FAST_TRAP
  51         sllx    %o1, 32, %o1
  52         or      %o0, %o1, %o0
  53         movrnz  %o1, -1, %o2
  54         stx     %o2, [%o4]
  55         retl
  56         nop
  57         SET_SIZE(hvio_config_get)
  58 
  59         /*
  60          * arg0 - devhandle
  61          * arg1 - pci_device
  62          * arg2 - pci_config_offset
  63          * arg3 - pci_config_size (1, 2 or 4 byte)
  64          * arg4 - pci_cfg_data
  65          *
  66          * ret0 - status
  67          * ret1 - error_flag
  68          */
  69         ENTRY(hvio_config_put)
  70         mov     HVIO_CONFIG_PUT, %o5
  71         ta      FAST_TRAP
  72         sllx    %o1, 32, %o1
  73         or      %o0, %o1, %o0
  74         retl
  75         nop
  76         SET_SIZE(hvio_config_put)