Print this page
10097 indenting fixes in usr/src/{lib,common}


   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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  22  * Use is subject to license terms.
  23  */
  24 
  25 #pragma ident   "%Z%%M% %I%     %E% SMI"


  26 
  27 #include <mcamd_api.h>
  28 #include <mcamd_err.h>
  29 #include <mcamd_rowcol_impl.h>
  30 
  31 /*
  32  * Convenience structures to stash MC and CS properties in.
  33  */
  34 struct mcprops {
  35         mcamd_prop_t num;               /* corresponding chip number */
  36         mcamd_prop_t rev;               /* revision */
  37         mcamd_prop_t width;             /* access width */
  38         mcamd_prop_t base;              /* MC base address */
  39         mcamd_prop_t lim;               /* MC limit address */
  40         mcamd_prop_t csbnkmap_reg;      /* chip-select bank map */
  41         mcamd_prop_t intlven;           /* Node-intlv mask */
  42         mcamd_prop_t intlvsel;          /* Node-intlv selection for this node */
  43         mcamd_prop_t csintlvfctr;       /* cs intlv factor on this node */
  44         mcamd_prop_t bnkswzl;           /* bank-swizzle mode */
  45         mcamd_prop_t sparecs;           /* spare cs#, if any */


 551                  */
 552                 for (cs = mcamd_cs_next(hdl, mc, NULL); cs != NULL;
 553                     cs = mcamd_cs_next(hdl, mc, cs)) {
 554                         mcamd_prop_t csnum;
 555 
 556                         if (!mcamd_get_numprop(hdl, cs, MCAMD_PROP_NUM,
 557                             &csnum)) {
 558                                 mcamd_dprintf(hdl, MCAMD_DBG_ERR,
 559                                     "mcamd_offset_to_pa: csnum lookup failed "
 560                                     "while looking for bad cs#");
 561                                 return (mcamd_set_errno(hdl,
 562                                     EMCAMD_TREEINVALID));
 563                         }
 564                         if (csnum == mcp.badcs)
 565                                 break;
 566                 }
 567 
 568                 if (cs == NULL) {
 569                         mcamd_dprintf(hdl, MCAMD_DBG_ERR, "mcamd_offset_to_pa: "
 570                             "failed to find cs for bad cs#%d\n", mcp.badcs);
 571                                 return (mcamd_set_errno(hdl,
 572                                     EMCAMD_TREEINVALID));
 573                 }
 574 
 575                 /* found bad cs - reread properties from it instead of spare */
 576                 if (getcsprops(hdl, cs, "mc_offset_to_pa", &csp) < 0)
 577                         return (-1);    /* errno already set */
 578         }
 579 
 580         csmode = MC_CS_MODE(mcp.csbnkmap_reg, csp.num);
 581 
 582         if (gettbls(hdl, csmode, &mcp, &bamp, &rcbmp,
 583             mcp.bnkswzl ? &swzlp : NULL, &csi,
 584             "mc_offset_to_pa") < 0)
 585                 return (-1);    /* errno already set */
 586 
 587         /*
 588          * If there are umaskable DRAM InputAddr bits the add those bits
 589          * to iaddr from the cs base address.
 590          */
 591         if (MC_CSMASK_UNMASKABLE(mcp.rev) != 0) {
 592                 iaddr |= iaddr_add(hdl, iaddr,




   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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  22  * Use is subject to license terms.
  23  */
  24 
  25 /*
  26  * Copyright (c) 2018, Joyent, Inc.
  27  */
  28 
  29 #include <mcamd_api.h>
  30 #include <mcamd_err.h>
  31 #include <mcamd_rowcol_impl.h>
  32 
  33 /*
  34  * Convenience structures to stash MC and CS properties in.
  35  */
  36 struct mcprops {
  37         mcamd_prop_t num;               /* corresponding chip number */
  38         mcamd_prop_t rev;               /* revision */
  39         mcamd_prop_t width;             /* access width */
  40         mcamd_prop_t base;              /* MC base address */
  41         mcamd_prop_t lim;               /* MC limit address */
  42         mcamd_prop_t csbnkmap_reg;      /* chip-select bank map */
  43         mcamd_prop_t intlven;           /* Node-intlv mask */
  44         mcamd_prop_t intlvsel;          /* Node-intlv selection for this node */
  45         mcamd_prop_t csintlvfctr;       /* cs intlv factor on this node */
  46         mcamd_prop_t bnkswzl;           /* bank-swizzle mode */
  47         mcamd_prop_t sparecs;           /* spare cs#, if any */


 553                  */
 554                 for (cs = mcamd_cs_next(hdl, mc, NULL); cs != NULL;
 555                     cs = mcamd_cs_next(hdl, mc, cs)) {
 556                         mcamd_prop_t csnum;
 557 
 558                         if (!mcamd_get_numprop(hdl, cs, MCAMD_PROP_NUM,
 559                             &csnum)) {
 560                                 mcamd_dprintf(hdl, MCAMD_DBG_ERR,
 561                                     "mcamd_offset_to_pa: csnum lookup failed "
 562                                     "while looking for bad cs#");
 563                                 return (mcamd_set_errno(hdl,
 564                                     EMCAMD_TREEINVALID));
 565                         }
 566                         if (csnum == mcp.badcs)
 567                                 break;
 568                 }
 569 
 570                 if (cs == NULL) {
 571                         mcamd_dprintf(hdl, MCAMD_DBG_ERR, "mcamd_offset_to_pa: "
 572                             "failed to find cs for bad cs#%d\n", mcp.badcs);
 573                         return (mcamd_set_errno(hdl, EMCAMD_TREEINVALID));

 574                 }
 575 
 576                 /* found bad cs - reread properties from it instead of spare */
 577                 if (getcsprops(hdl, cs, "mc_offset_to_pa", &csp) < 0)
 578                         return (-1);    /* errno already set */
 579         }
 580 
 581         csmode = MC_CS_MODE(mcp.csbnkmap_reg, csp.num);
 582 
 583         if (gettbls(hdl, csmode, &mcp, &bamp, &rcbmp,
 584             mcp.bnkswzl ? &swzlp : NULL, &csi,
 585             "mc_offset_to_pa") < 0)
 586                 return (-1);    /* errno already set */
 587 
 588         /*
 589          * If there are umaskable DRAM InputAddr bits the add those bits
 590          * to iaddr from the cs base address.
 591          */
 592         if (MC_CSMASK_UNMASKABLE(mcp.rev) != 0) {
 593                 iaddr |= iaddr_add(hdl, iaddr,