Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/osl.c
          +++ new/usr/src/uts/intel/io/acpica/osl.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25      - * Copyright 2011 Joyent, Inc.  All rights reserved.
       25 + * Copyright 2012 Joyent, Inc.  All rights reserved.
       26 + * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       27 + * Copyright 2013 PALO, Richard. All rights reserved.
  26   28   */
       29 +
  27   30  /*
  28   31   * Copyright (c) 2009-2010, Intel Corporation.
  29   32   * All rights reserved.
  30   33   */
       34 +
  31   35  /*
  32      - * ACPI CA OSL for Solaris x86
       36 + * x86 ACPI CA OSL
  33   37   */
  34   38  
  35   39  #include <sys/types.h>
  36   40  #include <sys/kmem.h>
  37   41  #include <sys/psm.h>
  38   42  #include <sys/pci_cfgspace.h>
  39   43  #include <sys/apic.h>
  40   44  #include <sys/ddi.h>
  41   45  #include <sys/sunddi.h>
  42   46  #include <sys/sunndi.h>
  43   47  #include <sys/pci.h>
  44   48  #include <sys/kobj.h>
  45   49  #include <sys/taskq.h>
  46   50  #include <sys/strlog.h>
  47   51  #include <sys/x86_archext.h>
  48   52  #include <sys/note.h>
  49   53  #include <sys/promif.h>
  50   54  
  51      -#include <sys/acpi/accommon.h>
       55 +#include <acpica/include/accommon.h>
  52   56  #include <sys/acpica.h>
  53   57  
  54   58  #define MAX_DAT_FILE_SIZE       (64*1024)
  55   59  
  56   60  /* local functions */
  57   61  static int CompressEisaID(char *np);
  58   62  
  59   63  static void scan_d2a_subtree(dev_info_t *dip, ACPI_HANDLE acpiobj, int bus);
  60   64  static int acpica_query_bbn_problem(void);
  61   65  static int acpica_find_pcibus(int busno, ACPI_HANDLE *rh);
↓ open down ↓ 246 lines elided ↑ open up ↑
 308  312                          cmn_err(CE_NOTE, "!acpica: replacing table: %s",
 309  313                              acpi_table_loc);
 310  314                  }
 311  315          }
 312  316          kobj_close_file(file);
 313  317          kmem_free(buf1, MAX_DAT_FILE_SIZE);
 314  318  
 315  319          return (AE_OK);
 316  320  }
 317  321  
      322 +ACPI_STATUS
      323 +AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER *ExistingTable,
      324 +    ACPI_PHYSICAL_ADDRESS *NewAddress, UINT32 *NewTableLength)
      325 +{
      326 +        return (AE_SUPPORT);
      327 +}
 318  328  
 319  329  /*
 320  330   * ACPI semaphore implementation
 321  331   */
 322  332  typedef struct {
 323  333          kmutex_t        mutex;
 324  334          kcondvar_t      cv;
 325  335          uint32_t        available;
 326  336          uint32_t        initial;
 327  337          uint32_t        maximum;
↓ open down ↓ 409 lines elided ↑ open up ↑
 737  747  #ifdef  DEBUG
 738  748                  cmn_err(CE_WARN, "!acpica: unable to dispatch event");
 739  749  #endif
 740  750                  return (AE_ERROR);
 741  751          }
 742  752          return (AE_OK);
 743  753  
 744  754  }
 745  755  
 746  756  void
      757 +AcpiOsWaitEventsComplete (void)
      758 +{
      759 +        if (acpica_eventq_init) {
      760 +                int     i;
      761 +                /*
      762 +                 * blocks until all events initiated by AcpiOsExecute have completed
      763 +                 */
      764 +                for (i = OSL_GLOBAL_LOCK_HANDLER; i <= OSL_EC_BURST_HANDLER; i++) {
      765 +                        if (osl_eventq[i])
      766 +                                ddi_taskq_wait(osl_eventq[i]);
      767 +                }
      768 +        }
      769 +    return;
      770 +}
      771 +
      772 +void
 747  773  AcpiOsSleep(ACPI_INTEGER Milliseconds)
 748  774  {
 749  775          /*
 750  776           * During kernel startup, before the first tick interrupt
 751  777           * has taken place, we can't call delay; very late in
 752  778           * kernel shutdown or suspend/resume, clock interrupts
 753  779           * are blocked, so delay doesn't work then either.
 754  780           * So we busy wait if lbolt == 0 (kernel startup)
 755  781           * or if acpica_use_safe_delay has been set to a
 756  782           * non-zero value.
↓ open down ↓ 119 lines elided ↑ open up ↑
 876  902  /*
 877  903   *
 878  904   */
 879  905  
 880  906  #define OSL_RW(ptr, val, type, rw) \
 881  907          { if (rw) *((type *)(ptr)) = *((type *) val); \
 882  908              else *((type *) val) = *((type *)(ptr)); }
 883  909  
 884  910  
 885  911  static void
 886      -osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value,
      912 +osl_rw_memory(ACPI_PHYSICAL_ADDRESS Address, UINT64 *Value,
 887  913      UINT32 Width, int write)
 888  914  {
 889  915          size_t  maplen = Width / 8;
 890  916          caddr_t ptr;
 891  917  
 892  918          ptr = psm_map_new((paddr_t)Address, maplen,
 893  919              PSM_PROT_WRITE | PSM_PROT_READ);
 894  920  
 895  921          switch (maplen) {
 896  922          case 1:
 897  923                  OSL_RW(ptr, Value, uint8_t, write);
 898  924                  break;
 899  925          case 2:
 900  926                  OSL_RW(ptr, Value, uint16_t, write);
 901  927                  break;
 902  928          case 4:
 903  929                  OSL_RW(ptr, Value, uint32_t, write);
 904  930                  break;
      931 +        case 8:
      932 +                OSL_RW(ptr, Value, uint64_t, write);
      933 +                break;
 905  934          default:
 906  935                  cmn_err(CE_WARN, "!osl_rw_memory: invalid size %d",
 907  936                      Width);
 908  937                  break;
 909  938          }
 910  939  
 911  940          psm_unmap(ptr, maplen);
 912  941  }
 913  942  
 914  943  ACPI_STATUS
 915  944  AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address,
 916      -                UINT32 *Value, UINT32 Width)
      945 +                UINT64 *Value, UINT32 Width)
 917  946  {
 918  947          osl_rw_memory(Address, Value, Width, 0);
 919  948          return (AE_OK);
 920  949  }
 921  950  
 922  951  ACPI_STATUS
 923  952  AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address,
 924      -                UINT32 Value, UINT32 Width)
      953 +                UINT64 Value, UINT32 Width)
 925  954  {
 926  955          osl_rw_memory(Address, &Value, Width, 1);
 927  956          return (AE_OK);
 928  957  }
 929  958  
 930  959  
 931  960  ACPI_STATUS
 932  961  AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Reg,
 933  962                  UINT64 *Value, UINT32 Width)
 934  963  {
↓ open down ↓ 1409 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX