Print this page
10246 fix apic_allocate_irq() indentation

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/io/mp_platform_common.c
          +++ new/usr/src/uts/i86pc/io/mp_platform_common.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   * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2016 Nexenta Systems, Inc.
  24   24   * Copyright (c) 2017 by Delphix. All rights reserved.
  25      - * Copyright (c) 2018, Joyent, Inc.
       25 + * Copyright (c) 2019, Joyent, Inc.
  26   26   */
  27   27  /*
  28   28   * Copyright (c) 2010, Intel Corporation.
  29   29   * All rights reserved.
  30   30   */
  31   31  
  32   32  /*
  33   33   * PSMI 1.1 extensions are supported only in 2.6 and later versions.
  34   34   * PSMI 1.2 extensions are supported only in 2.7 and later versions.
  35   35   * PSMI 1.3 and 1.4 extensions are supported in Solaris 10.
↓ open down ↓ 1561 lines elided ↑ open up ↑
1597 1597                  }
1598 1598          }
1599 1599          return (-1);
1600 1600  }
1601 1601  
1602 1602  int
1603 1603  apic_allocate_irq(int irq)
1604 1604  {
1605 1605          int     freeirq, i;
1606 1606  
1607      -        if ((freeirq = apic_find_free_irq(irq, (APIC_RESV_IRQ - 1))) == -1)
     1607 +        if ((freeirq = apic_find_free_irq(irq, (APIC_RESV_IRQ - 1))) == -1) {
1608 1608                  if ((freeirq = apic_find_free_irq(APIC_FIRST_FREE_IRQ,
1609 1609                      (irq - 1))) == -1) {
1610 1610                          /*
1611 1611                           * if BIOS really defines every single irq in the mps
1612 1612                           * table, then don't worry about conflicting with
1613 1613                           * them, just use any free slot in apic_irq_table
1614 1614                           */
1615 1615                          for (i = APIC_FIRST_FREE_IRQ; i < APIC_RESV_IRQ; i++) {
1616 1616                                  if ((apic_irq_table[i] == NULL) ||
1617 1617                                      apic_irq_table[i]->airq_mps_intr_index ==
1618 1618                                      FREE_INDEX) {
1619      -                                freeirq = i;
1620      -                                break;
     1619 +                                        freeirq = i;
     1620 +                                        break;
     1621 +                                }
1621 1622                          }
     1623 +
     1624 +                        if (freeirq == -1) {
     1625 +                                /* This shouldn't happen, but just in case */
     1626 +                                cmn_err(CE_WARN, "%s: NO available IRQ", psm_name);
     1627 +                                return (-1);
     1628 +                        }
1622 1629                  }
1623      -                if (freeirq == -1) {
1624      -                        /* This shouldn't happen, but just in case */
1625      -                        cmn_err(CE_WARN, "%s: NO available IRQ", psm_name);
1626      -                        return (-1);
1627      -                }
1628 1630          }
     1631 +
1629 1632          if (apic_irq_table[freeirq] == NULL) {
1630 1633                  apic_irq_table[freeirq] =
1631 1634                      kmem_zalloc(sizeof (apic_irq_t), KM_NOSLEEP);
1632 1635                  if (apic_irq_table[freeirq] == NULL) {
1633 1636                          cmn_err(CE_WARN, "%s: NO memory to allocate IRQ",
1634 1637                              psm_name);
1635 1638                          return (-1);
1636 1639                  }
1637 1640                  apic_irq_table[freeirq]->airq_temp_cpu = IRQ_UNINIT;
1638 1641                  apic_irq_table[freeirq]->airq_mps_intr_index = FREE_INDEX;
↓ open down ↓ 790 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX