annotate usr/src/uts/intel/io/pci/pci_boot.c @ 13019:05a4e7665357

6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
author Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
date Tue, 03 Aug 2010 18:32:30 -0700
parents 92e6427b7b70
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2 * CDDL HEADER START
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
4 * The contents of this file are subject to the terms of the
1494
2327b3ecb7ad 6385042 x86 slot-names gone missing (again)
jg
parents: 1413
diff changeset
5 * Common Development and Distribution License (the "License").
2327b3ecb7ad 6385042 x86 slot-names gone missing (again)
jg
parents: 1413
diff changeset
6 * You may not use this file except in compliance with the License.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
7 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
9 * or http://www.opensolaris.org/os/licensing.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
10 * See the License for the specific language governing permissions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
11 * and limitations under the License.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
12 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
13 * When distributing Covered Code, include this CDDL HEADER in each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
15 * If applicable, add the following below this CDDL HEADER, with the
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
16 * fields enclosed by brackets "[]" replaced with your own identifying
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
17 * information: Portions Copyright [yyyy] [name of copyright owner]
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
18 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
19 * CDDL HEADER END
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
20 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
21 /*
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
23 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
24
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
25 #include <sys/types.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
26 #include <sys/stat.h>
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
27 #include <sys/sysmacros.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
28 #include <sys/sunndi.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
29 #include <sys/pci.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
30 #include <sys/pci_impl.h>
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
31 #include <sys/pcie_impl.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
32 #include <sys/memlist.h>
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
33 #include <sys/bootconf.h>
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
34 #include <io/pci/mps_table.h>
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
35 #include <sys/pci_cfgacc.h>
748
3a1ae73086e8 6338634 pci config-space routines really need to be present early in base kernel
dmick
parents: 622
diff changeset
36 #include <sys/pci_cfgspace.h>
3a1ae73086e8 6338634 pci config-space routines really need to be present early in base kernel
dmick
parents: 622
diff changeset
37 #include <sys/pci_cfgspace_impl.h>
3a1ae73086e8 6338634 pci config-space routines really need to be present early in base kernel
dmick
parents: 622
diff changeset
38 #include <sys/psw.h>
58
f37950de9bc8 6259731 cfgadm_pci plugin 'hpc_card_info_t' tables are out of date
anish
parents: 25
diff changeset
39 #include "../../../../common/pci/pci_strings.h"
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
40 #include <sys/apic.h>
2435
1e9507847d6d 6445246 x64 pcie needs to be MCP-55 aware
anish
parents: 2121
diff changeset
41 #include <io/pciex/pcie_nvidia.h>
10923
df470fd79c3c PSARC/2008/181 Solaris Hotplug Framework
Evan Yan <Evan.Yan@Sun.COM>
parents: 10917
diff changeset
42 #include <sys/hotplug/pci/pciehpc_acpi.h>
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
43 #include <sys/acpi/acpi.h>
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
44 #include <sys/acpica.h>
8215
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
45 #include <sys/iommulib.h>
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
46 #include <sys/devcache.h>
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
47 #include <sys/pci_cfgacc_x86.h>
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
48
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
49 #define pci_getb (*pci_getb_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
50 #define pci_getw (*pci_getw_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
51 #define pci_getl (*pci_getl_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
52 #define pci_putb (*pci_putb_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
53 #define pci_putw (*pci_putw_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
54 #define pci_putl (*pci_putl_func)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
55 #define dcmn_err if (pci_boot_debug) cmn_err
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
56
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
57 #define CONFIG_INFO 0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
58 #define CONFIG_UPDATE 1
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
59 #define CONFIG_NEW 2
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
60 #define CONFIG_FIX 3
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
61 #define COMPAT_BUFSIZE 512
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
62
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
63 #define PPB_IO_ALIGNMENT 0x1000 /* 4K aligned */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
64 #define PPB_MEM_ALIGNMENT 0x100000 /* 1M aligned */
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
65 /* round down to nearest power of two */
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
66 #define P2LE(align) \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
67 { \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
68 int i = 0; \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
69 while (align >>= 1) \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
70 i ++; \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
71 align = 1 << i; \
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
72 } \
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
73
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
74 /* for is_vga and list_is_vga_only */
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
75
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
76 enum io_mem {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
77 IO,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
78 MEM
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
79 };
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
80
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
81 /* See AMD-8111 Datasheet Rev 3.03, Page 149: */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
82 #define LPC_IO_CONTROL_REG_1 0x40
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
83 #define AMD8111_ENABLENMI (uint8_t)0x80
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
84 #define DEVID_AMD8111_LPC 0x7468
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
85
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
86 struct pci_fixundo {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
87 uint8_t bus;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
88 uint8_t dev;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
89 uint8_t fn;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
90 void (*undofn)(uint8_t, uint8_t, uint8_t);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
91 struct pci_fixundo *next;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
92 };
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
93
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
94 struct pci_devfunc {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
95 struct pci_devfunc *next;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
96 dev_info_t *dip;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
97 uchar_t dev;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
98 uchar_t func;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
99 boolean_t reprogram; /* this device needs to be reprogrammed */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
100 };
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
101
12683
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
102 extern int apic_nvidia_io_max;
9149
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
103 extern int pseudo_isa;
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
104 extern int pci_bios_maxbus;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
105 static uchar_t max_dev_pci = 32; /* PCI standard */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
106 int pci_boot_debug = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
107 extern struct memlist *find_bus_res(int, int);
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
108 static struct pci_fixundo *undolist = NULL;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
109 static int num_root_bus = 0; /* count of root buses */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
110 extern volatile int acpi_resource_discovery;
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
111 extern uint64_t mcfg_mem_base;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
112 extern void pci_cfgacc_add_workaround(uint16_t, uchar_t, uchar_t);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
113 extern dev_info_t *pcie_get_rc_dip(dev_info_t *);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
114
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
115 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
116 * Module prototypes
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
117 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
118 static void enumerate_bus_devs(uchar_t bus, int config_op);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
119 static void create_root_bus_dip(uchar_t bus);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
120 static void process_devfunc(uchar_t, uchar_t, uchar_t, uchar_t,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
121 ushort_t, int);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
122 static void add_compatible(dev_info_t *, ushort_t, ushort_t,
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
123 ushort_t, ushort_t, uchar_t, uint_t, int);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
124 static int add_reg_props(dev_info_t *, uchar_t, uchar_t, uchar_t, int, int);
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
125 static void add_ppb_props(dev_info_t *, uchar_t, uchar_t, uchar_t, int,
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
126 ushort_t);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
127 static void add_model_prop(dev_info_t *, uint_t);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
128 static void add_bus_range_prop(int);
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
129 static void add_bus_slot_names_prop(int);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
130 static void add_ranges_prop(int, int);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
131 static void add_bus_available_prop(int);
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
132 static int get_pci_cap(uchar_t bus, uchar_t dev, uchar_t func, uint8_t cap_id);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
133 static void fix_ppb_res(uchar_t, boolean_t);
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
134 static void alloc_res_array();
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
135 static void create_ioapic_node(int bus, int dev, int fn, ushort_t vendorid,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
136 ushort_t deviceid);
5156
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
137 static void pciex_slot_names_prop(dev_info_t *, ushort_t);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
138 static void populate_bus_res(uchar_t bus);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
139 static void memlist_remove_list(struct memlist **list,
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
140 struct memlist *remove_list);
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
141 static boolean_t is_pcie_platform(void);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
142 static void ck804_fix_aer_ptr(dev_info_t *, pcie_req_id_t);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
143
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
144 static void pci_scan_bbn(void);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
145 static int pci_unitaddr_cache_valid(void);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
146 static int pci_bus_unitaddr(int);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
147 static void pci_unitaddr_cache_create(void);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
148
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
149 static int pci_cache_unpack_nvlist(nvf_handle_t, nvlist_t *, char *);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
150 static int pci_cache_pack_nvlist(nvf_handle_t, nvlist_t **);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
151 static void pci_cache_free_list(nvf_handle_t);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
152
1494
2327b3ecb7ad 6385042 x86 slot-names gone missing (again)
jg
parents: 1413
diff changeset
153 extern int pci_slot_names_prop(int, char *, int);
2327b3ecb7ad 6385042 x86 slot-names gone missing (again)
jg
parents: 1413
diff changeset
154
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
155 /* set non-zero to force PCI peer-bus renumbering */
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
156 int pci_bus_always_renumber = 0;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
157
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
158 /*
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
159 * used to register ISA resource usage which must not be made
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
160 * "available" from other PCI node' resource maps
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
161 */
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
162 static struct {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
163 struct memlist *io_used;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
164 struct memlist *mem_used;
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
165 } isa_res;
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
166
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
167 /*
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
168 * PCI unit-address cache management
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
169 */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
170 static nvf_ops_t pci_unitaddr_cache_ops = {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
171 "/etc/devices/pci_unitaddr_persistent", /* path to cache */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
172 pci_cache_unpack_nvlist, /* read in nvlist form */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
173 pci_cache_pack_nvlist, /* convert to nvlist form */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
174 pci_cache_free_list, /* free data list */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
175 NULL /* write complete callback */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
176 };
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
177
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
178 typedef struct {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
179 list_node_t pua_nodes;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
180 int pua_index;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
181 int pua_addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
182 } pua_node_t;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
183
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
184 nvf_handle_t puafd_handle;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
185 int pua_cache_valid = 0;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
186
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
187
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
188 /*ARGSUSED*/
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
189 static ACPI_STATUS
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
190 pci_process_acpi_device(ACPI_HANDLE hdl, UINT32 level, void *ctx, void **rv)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
191 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
192 ACPI_BUFFER rb;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
193 ACPI_OBJECT ro;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
194 ACPI_DEVICE_INFO *adi;
11075
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
195 int busnum;
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
196
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
197 /*
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
198 * Use AcpiGetObjectInfo() to find the device _HID
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
199 * If not a PCI root-bus, ignore this device and continue
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
200 * the walk
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
201 */
11225
eb6056029d84 6901273 acpica: update ACPI CA interpreter source to 20091112
Dana Myers <Dana.Myers@Sun.COM>
parents: 11169
diff changeset
202 if (ACPI_FAILURE(AcpiGetObjectInfo(hdl, &adi)))
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
203 return (AE_OK);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
204
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
205 if (!(adi->Valid & ACPI_VALID_HID)) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
206 AcpiOsFree(adi);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
207 return (AE_OK);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
208 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
209
11225
eb6056029d84 6901273 acpica: update ACPI CA interpreter source to 20091112
Dana Myers <Dana.Myers@Sun.COM>
parents: 11169
diff changeset
210 if (strncmp(adi->HardwareId.String, PCI_ROOT_HID_STRING,
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
211 sizeof (PCI_ROOT_HID_STRING)) &&
11225
eb6056029d84 6901273 acpica: update ACPI CA interpreter source to 20091112
Dana Myers <Dana.Myers@Sun.COM>
parents: 11169
diff changeset
212 strncmp(adi->HardwareId.String, PCI_EXPRESS_ROOT_HID_STRING,
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
213 sizeof (PCI_EXPRESS_ROOT_HID_STRING))) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
214 AcpiOsFree(adi);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
215 return (AE_OK);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
216 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
217
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
218 AcpiOsFree(adi);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
219
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
220 /*
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
221 * XXX: ancient Big Bear broken _BBN will result in two
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
222 * bus 0 _BBNs being found, so we need to handle duplicate
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
223 * bus 0 gracefully. However, broken _BBN does not
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
224 * hide a childless root-bridge so no need to work-around it
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
225 * here
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
226 */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
227 rb.Pointer = &ro;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
228 rb.Length = sizeof (ro);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
229 if (ACPI_SUCCESS(AcpiEvaluateObjectTyped(hdl, "_BBN",
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
230 NULL, &rb, ACPI_TYPE_INTEGER))) {
11075
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
231 busnum = ro.Integer.Value;
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
232
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
233 /*
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
234 * Ignore invalid _BBN return values here (rather
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
235 * than panic) and emit a warning; something else
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
236 * may suffer failure as a result of the broken BIOS.
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
237 */
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
238 if ((busnum < 0) || (busnum > pci_bios_maxbus)) {
11579
680cf72e7b5e 6913723 ?WARNING: pci_process_acpi_device: invalid _BBN 0xfc" printed to console
Dana Myers <Dana.Myers@Sun.COM>
parents: 11474
diff changeset
239 dcmn_err(CE_NOTE,
11075
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
240 "pci_process_acpi_device: invalid _BBN 0x%x\n",
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
241 busnum);
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
242 return (AE_CTRL_DEPTH);
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
243 }
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
244
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
245 /* PCI with valid _BBN */
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
246 if (pci_bus_res[busnum].par_bus == (uchar_t)-1 &&
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
247 pci_bus_res[busnum].dip == NULL)
e1d25eb89954 6898998 fastreboot provokes panic on Dell PowerEdge 1600SC (BIOS A09) after integration of CR 6472670
Dana Myers <Dana.Myers@Sun.COM>
parents: 10923
diff changeset
248 create_root_bus_dip((uchar_t)busnum);
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
249 return (AE_CTRL_DEPTH);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
250 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
251
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
252 /* PCI and no _BBN, continue walk */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
253 return (AE_OK);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
254 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
255
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
256 /*
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
257 * Scan the ACPI namespace for all top-level instances of _BBN
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
258 * in order to discover childless root-bridges (which enumeration
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
259 * may not find; root-bridges are inferred by the existence of
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
260 * children). This scan should find all root-bridges that have
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
261 * been enumerated, and any childless root-bridges not enumerated.
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
262 * Root-bridge for bus 0 may not have a _BBN object.
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
263 */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
264 static void
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
265 pci_scan_bbn()
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
266 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
267 void *rv;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
268
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
269 (void) AcpiGetDevices(NULL, pci_process_acpi_device, NULL, &rv);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
270 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
271
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
272 static void
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
273 pci_unitaddr_cache_init(void)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
274 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
275
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
276 puafd_handle = nvf_register_file(&pci_unitaddr_cache_ops);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
277 ASSERT(puafd_handle);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
278
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
279 list_create(nvf_list(puafd_handle), sizeof (pua_node_t),
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
280 offsetof(pua_node_t, pua_nodes));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
281
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
282 rw_enter(nvf_lock(puafd_handle), RW_WRITER);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
283 (void) nvf_read_file(puafd_handle);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
284 rw_exit(nvf_lock(puafd_handle));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
285 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
286
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
287 /*
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
288 * Format of /etc/devices/pci_unitaddr_persistent:
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
289 *
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
290 * The persistent record of unit-address assignments contains
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
291 * a list of name/value pairs, where name is a string representation
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
292 * of the "index value" of the PCI root-bus and the value is
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
293 * the assigned unit-address.
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
294 *
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
295 * The "index value" is simply the zero-based index of the PCI
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
296 * root-buses ordered by physical bus number; first PCI bus is 0,
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
297 * second is 1, and so on.
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
298 */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
299
10554
7b2fc4ef618c 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems) (fix lint)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10552
diff changeset
300 /*ARGSUSED*/
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
301 static int
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
302 pci_cache_unpack_nvlist(nvf_handle_t hdl, nvlist_t *nvl, char *name)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
303 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
304 long index;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
305 int32_t value;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
306 nvpair_t *np;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
307 pua_node_t *node;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
308
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
309 np = NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
310 while ((np = nvlist_next_nvpair(nvl, np)) != NULL) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
311 /* name of nvpair is index value */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
312 if (ddi_strtol(nvpair_name(np), NULL, 10, &index) != 0)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
313 continue;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
314
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
315 if (nvpair_value_int32(np, &value) != 0)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
316 continue;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
317
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
318 node = kmem_zalloc(sizeof (pua_node_t), KM_SLEEP);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
319 node->pua_index = index;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
320 node->pua_addr = value;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
321 list_insert_tail(nvf_list(hdl), node);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
322 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
323
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
324 pua_cache_valid = 1;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
325 return (DDI_SUCCESS);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
326 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
327
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
328 static int
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
329 pci_cache_pack_nvlist(nvf_handle_t hdl, nvlist_t **ret_nvl)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
330 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
331 int rval;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
332 nvlist_t *nvl, *sub_nvl;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
333 list_t *listp;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
334 pua_node_t *pua;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
335 char buf[13];
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
336
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
337 ASSERT(RW_WRITE_HELD(nvf_lock(hdl)));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
338
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
339 rval = nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
340 if (rval != DDI_SUCCESS) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
341 nvf_error("%s: nvlist alloc error %d\n",
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
342 nvf_cache_name(hdl), rval);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
343 return (DDI_FAILURE);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
344 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
345
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
346 sub_nvl = NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
347 rval = nvlist_alloc(&sub_nvl, NV_UNIQUE_NAME, KM_SLEEP);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
348 if (rval != DDI_SUCCESS)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
349 goto error;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
350
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
351 listp = nvf_list(hdl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
352 for (pua = list_head(listp); pua != NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
353 pua = list_next(listp, pua)) {
10554
7b2fc4ef618c 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems) (fix lint)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10552
diff changeset
354 (void) snprintf(buf, sizeof (buf), "%d", pua->pua_index);
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
355 rval = nvlist_add_int32(sub_nvl, buf, pua->pua_addr);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
356 if (rval != DDI_SUCCESS)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
357 goto error;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
358 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
359
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
360 rval = nvlist_add_nvlist(nvl, "table", sub_nvl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
361 if (rval != DDI_SUCCESS)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
362 goto error;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
363 nvlist_free(sub_nvl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
364
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
365 *ret_nvl = nvl;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
366 return (DDI_SUCCESS);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
367
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
368 error:
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
369 if (sub_nvl)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
370 nvlist_free(sub_nvl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
371 ASSERT(nvl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
372 nvlist_free(nvl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
373 *ret_nvl = NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
374 return (DDI_FAILURE);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
375 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
376
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
377 static void
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
378 pci_cache_free_list(nvf_handle_t hdl)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
379 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
380 list_t *listp;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
381 pua_node_t *pua;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
382
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
383 ASSERT(RW_WRITE_HELD(nvf_lock(hdl)));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
384
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
385 listp = nvf_list(hdl);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
386 for (pua = list_head(listp); pua != NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
387 pua = list_next(listp, pua)) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
388 list_remove(listp, pua);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
389 kmem_free(pua, sizeof (pua_node_t));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
390 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
391 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
392
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
393
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
394 static int
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
395 pci_unitaddr_cache_valid(void)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
396 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
397
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
398 /* read only, no need for rw lock */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
399 return (pua_cache_valid);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
400 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
401
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
402
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
403 static int
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
404 pci_bus_unitaddr(int index)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
405 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
406 pua_node_t *pua;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
407 list_t *listp;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
408 int addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
409
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
410 rw_enter(nvf_lock(puafd_handle), RW_READER);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
411
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
412 addr = -1; /* default return if no match */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
413 listp = nvf_list(puafd_handle);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
414 for (pua = list_head(listp); pua != NULL;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
415 pua = list_next(listp, pua)) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
416 if (pua->pua_index == index) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
417 addr = pua->pua_addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
418 break;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
419 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
420 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
421
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
422 rw_exit(nvf_lock(puafd_handle));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
423 return (addr);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
424 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
425
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
426 static void
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
427 pci_unitaddr_cache_create(void)
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
428 {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
429 int i, index;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
430 pua_node_t *node;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
431 list_t *listp;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
432
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
433 rw_enter(nvf_lock(puafd_handle), RW_WRITER);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
434
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
435 index = 0;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
436 listp = nvf_list(puafd_handle);
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
437 for (i = 0; i <= pci_bios_maxbus; i++) {
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
438 /* skip non-root (peer) PCI busses */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
439 if ((pci_bus_res[i].par_bus != (uchar_t)-1) ||
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
440 (pci_bus_res[i].dip == NULL))
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
441 continue;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
442 node = kmem_zalloc(sizeof (pua_node_t), KM_SLEEP);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
443 node->pua_index = index++;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
444 node->pua_addr = pci_bus_res[i].root_addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
445 list_insert_tail(listp, node);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
446 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
447
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
448 (void) nvf_mark_dirty(puafd_handle);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
449 rw_exit(nvf_lock(puafd_handle));
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
450 nvf_wake_daemon();
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
451 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
452
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
453
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
454 /*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
455 * Enumerate all PCI devices
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
456 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
457 void
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
458 pci_setup_tree(void)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
459 {
8668
b2550ea1cc76 6797893 PCI bus count from BIOS induces infinite loop in pci_setup_tree due to uint8_t overflow
james north - Sun Microsystems - Austin United States <James.North@Sun.COM>
parents: 8655
diff changeset
460 uint_t i, root_bus_addr = 0;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
461
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
462 /*
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
463 * enable mem-mapped pci config space accessing,
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
464 * if failed to do so during early boot
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
465 */
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
466 if ((mcfg_mem_base == NULL) && is_pcie_platform())
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
467 mcfg_mem_base = 0xE0000000;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
468
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
469 alloc_res_array();
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
470 for (i = 0; i <= pci_bios_maxbus; i++) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
471 pci_bus_res[i].par_bus = (uchar_t)-1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
472 pci_bus_res[i].root_addr = (uchar_t)-1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
473 pci_bus_res[i].sub_bus = i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
474 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
475
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
476 pci_bus_res[0].root_addr = root_bus_addr++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
477 create_root_bus_dip(0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
478 enumerate_bus_devs(0, CONFIG_INFO);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
479
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
480 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
481 * Now enumerate peer busses
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
482 *
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
483 * We loop till pci_bios_maxbus. On most systems, there is
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
484 * one more bus at the high end, which implements the ISA
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
485 * compatibility bus. We don't care about that.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
486 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
487 * Note: In the old (bootconf) enumeration, the peer bus
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
488 * address did not use the bus number, and there were
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
489 * too many peer busses created. The root_bus_addr is
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
490 * used to maintain the old peer bus address assignment.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
491 * However, we stop enumerating phantom peers with no
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
492 * device below.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
493 */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
494 for (i = 1; i <= pci_bios_maxbus; i++) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
495 if (pci_bus_res[i].dip == NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
496 pci_bus_res[i].root_addr = root_bus_addr++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
497 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
498 enumerate_bus_devs(i, CONFIG_INFO);
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
499
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
500 /* add slot-names property for named pci hot-plug slots */
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
501 add_bus_slot_names_prop(i);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
502 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
503
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
504 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
505
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
506 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
507 * >0 = present, 0 = not present, <0 = error
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
508 */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
509 static int
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
510 pci_bbn_present(int bus)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
511 {
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
512 ACPI_HANDLE hdl;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
513 int rv;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
514
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
515 /* no dip means no _BBN */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
516 if (pci_bus_res[bus].dip == NULL)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
517 return (0);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
518
7851
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
519 rv = -1; /* default return value in case of error below */
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
520 if (ACPI_SUCCESS(acpica_get_handle(pci_bus_res[bus].dip, &hdl))) {
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
521 switch (AcpiEvaluateObject(hdl, "_BBN", NULL, NULL)) {
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
522 case AE_OK:
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
523 rv = 1;
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
524 break;
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
525 case AE_NOT_FOUND:
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
526 rv = 0;
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
527 break;
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
528 default:
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
529 break;
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
530 }
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
531 }
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
532
7851
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
533 return (rv);
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
534 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
535
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
536 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
537 * Return non-zero if any PCI bus in the system has an associated
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
538 * _BBN object, 0 otherwise.
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
539 */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
540 static int
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
541 pci_roots_have_bbn(void)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
542 {
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
543 int i;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
544
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
545 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
546 * Scan the PCI busses and look for at least 1 _BBN
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
547 */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
548 for (i = 0; i <= pci_bios_maxbus; i++) {
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
549 /* skip non-root (peer) PCI busses */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
550 if (pci_bus_res[i].par_bus != (uchar_t)-1)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
551 continue;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
552
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
553 if (pci_bbn_present(i) > 0)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
554 return (1);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
555 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
556 return (0);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
557
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
558 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
559
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
560 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
561 * return non-zero if the machine is one on which we renumber
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
562 * the internal pci unit-addresses
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
563 */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
564 static int
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
565 pci_bus_renumber()
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
566 {
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
567 ACPI_TABLE_HEADER *fadt;
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
568
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
569 if (pci_bus_always_renumber)
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
570 return (1);
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
571
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
572 /* get the FADT */
7851
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
573 if (AcpiGetTable(ACPI_SIG_FADT, 1, (ACPI_TABLE_HEADER **)&fadt) !=
e828bbb1689c 6464695 acpica: update to Intel ACPI CA 20080829
Dana Myers <Dana.Myers@Sun.COM>
parents: 7589
diff changeset
574 AE_OK)
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
575 return (0);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
576
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
577 /* compare OEM Table ID to "SUNm31" */
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
578 if (strncmp("SUNm31", fadt->OemId, 6))
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
579 return (0);
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
580 else
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
581 return (1);
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
582 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
583
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
584 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
585 * Initial enumeration of the physical PCI bus hierarchy can
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
586 * leave 'gaps' in the order of peer PCI bus unit-addresses.
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
587 * Systems with more than one peer PCI bus *must* have an ACPI
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
588 * _BBN object associated with each peer bus; use the presence
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
589 * of this object to remove gaps in the numbering of the peer
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
590 * PCI bus unit-addresses - only peer busses with an associated
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
591 * _BBN are counted.
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
592 */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
593 static void
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
594 pci_renumber_root_busses(void)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
595 {
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
596 int pci_regs[] = {0, 0, 0};
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
597 int i, root_addr = 0;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
598
4018
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
599 /*
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
600 * Currently, we only enable the re-numbering on specific
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
601 * Sun machines; this is a work-around for the more complicated
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
602 * issue of upgrade changing physical device paths
72f0f2d75d29 backout 6472670: causes 6545437
dm120769
parents: 3986
diff changeset
603 */
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
604 if (!pci_bus_renumber())
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
605 return;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
606
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
607 /*
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
608 * If we find no _BBN objects at all, we either don't need
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
609 * to do anything or can't do anything anyway
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
610 */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
611 if (!pci_roots_have_bbn())
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
612 return;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
613
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
614 for (i = 0; i <= pci_bios_maxbus; i++) {
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
615 /* skip non-root (peer) PCI busses */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
616 if (pci_bus_res[i].par_bus != (uchar_t)-1)
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
617 continue;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
618
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
619 if (pci_bbn_present(i) < 1) {
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
620 pci_bus_res[i].root_addr = (uchar_t)-1;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
621 continue;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
622 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
623
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
624 ASSERT(pci_bus_res[i].dip != NULL);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
625 if (pci_bus_res[i].root_addr != root_addr) {
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
626 /* update reg property for node */
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
627 pci_bus_res[i].root_addr = root_addr;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
628 pci_regs[0] = pci_bus_res[i].root_addr;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
629 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE,
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
630 pci_bus_res[i].dip, "reg", (int *)pci_regs, 3);
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
631 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
632 root_addr++;
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
633 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
634 }
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
635
9149
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
636 void
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
637 pci_register_isa_resources(int type, uint32_t base, uint32_t size)
2950
449abdd74783 6354996 pci_boot.c incorrectly accounts for system resources in PCI configuration
myers
parents: 2466
diff changeset
638 {
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
639 (void) memlist_insert(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
640 (type == 1) ? &isa_res.io_used : &isa_res.mem_used,
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
641 base, size);
2950
449abdd74783 6354996 pci_boot.c incorrectly accounts for system resources in PCI configuration
myers
parents: 2466
diff changeset
642 }
449abdd74783 6354996 pci_boot.c incorrectly accounts for system resources in PCI configuration
myers
parents: 2466
diff changeset
643
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
644 /*
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
645 * Remove the resources which are already used by devices under a subtractive
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
646 * bridge from the bus's resources lists, because they're not available, and
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
647 * shouldn't be allocated to other buses. This is necessary because tracking
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
648 * resources for subtractive bridges is not complete. (Subtractive bridges only
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
649 * track some of their claimed resources, not "the rest of the address space" as
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
650 * they should, so that allocation to peer non-subtractive PPBs is easier. We
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
651 * need a fully-capable global resource allocator).
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
652 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
653 static void
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
654 remove_subtractive_res()
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
655 {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
656 int i, j;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
657 struct memlist *list;
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
658
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
659 for (i = 0; i <= pci_bios_maxbus; i++) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
660 if (pci_bus_res[i].subtractive) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
661 /* remove used io ports */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
662 list = pci_bus_res[i].io_used;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
663 while (list) {
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
664 for (j = 0; j <= pci_bios_maxbus; j++)
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
665 (void) memlist_remove(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
666 &pci_bus_res[j].io_avail,
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
667 list->ml_address, list->ml_size);
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
668 list = list->ml_next;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
669 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
670 /* remove used mem resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
671 list = pci_bus_res[i].mem_used;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
672 while (list) {
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
673 for (j = 0; j <= pci_bios_maxbus; j++) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
674 (void) memlist_remove(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
675 &pci_bus_res[j].mem_avail,
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
676 list->ml_address, list->ml_size);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
677 (void) memlist_remove(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
678 &pci_bus_res[j].pmem_avail,
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
679 list->ml_address, list->ml_size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
680 }
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
681 list = list->ml_next;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
682 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
683 /* remove used prefetchable mem resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
684 list = pci_bus_res[i].pmem_used;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
685 while (list) {
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
686 for (j = 0; j <= pci_bios_maxbus; j++) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
687 (void) memlist_remove(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
688 &pci_bus_res[j].pmem_avail,
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
689 list->ml_address, list->ml_size);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
690 (void) memlist_remove(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
691 &pci_bus_res[j].mem_avail,
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
692 list->ml_address, list->ml_size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
693 }
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
694 list = list->ml_next;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
695 }
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
696 }
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
697 }
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
698 }
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
699
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
700 /*
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
701 * Set up (or complete the setup of) the bus_avail resource list
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
702 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
703 static void
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
704 setup_bus_res(int bus)
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
705 {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
706 uchar_t par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
707
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
708 if (pci_bus_res[bus].dip == NULL) /* unused bus */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
709 return;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
710
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
711 /*
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
712 * Set up bus_avail if not already filled in by populate_bus_res()
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
713 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
714 if (pci_bus_res[bus].bus_avail == NULL) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
715 ASSERT(pci_bus_res[bus].sub_bus >= bus);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
716 memlist_insert(&pci_bus_res[bus].bus_avail, bus,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
717 pci_bus_res[bus].sub_bus - bus + 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
718 }
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
719
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
720 ASSERT(pci_bus_res[bus].bus_avail != NULL);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
721
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
722 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
723 * Remove resources from parent bus node if this is not a
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
724 * root bus.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
725 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
726 par_bus = pci_bus_res[bus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
727 if (par_bus != (uchar_t)-1) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
728 ASSERT(pci_bus_res[par_bus].bus_avail != NULL);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
729 memlist_remove_list(&pci_bus_res[par_bus].bus_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
730 pci_bus_res[bus].bus_avail);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
731 }
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
732
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
733 /* remove self from bus_avail */;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
734 (void) memlist_remove(&pci_bus_res[bus].bus_avail, bus, 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
735 }
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
736
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
737 static uint64_t
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
738 get_parbus_io_res(uchar_t parbus, uchar_t bus, uint64_t size, uint64_t align)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
739 {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
740 uint64_t addr = 0;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
741 uchar_t res_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
742
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
743 /*
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
744 * Skip root(peer) buses in multiple-root-bus systems when
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
745 * ACPI resource discovery was not successfully done.
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
746 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
747 if ((pci_bus_res[parbus].par_bus == (uchar_t)-1) &&
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
748 (num_root_bus > 1) && (acpi_resource_discovery <= 0))
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
749 return (0);
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
750
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
751 res_bus = parbus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
752 while (pci_bus_res[res_bus].subtractive) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
753 if (pci_bus_res[res_bus].io_avail)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
754 break;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
755 res_bus = pci_bus_res[res_bus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
756 if (res_bus == (uchar_t)-1)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
757 break; /* root bus already */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
758 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
759
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
760 if (pci_bus_res[res_bus].io_avail) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
761 addr = memlist_find(&pci_bus_res[res_bus].io_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
762 size, align);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
763 if (addr) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
764 memlist_insert(&pci_bus_res[res_bus].io_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
765 addr, size);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
766
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
767 /* free the old resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
768 memlist_free_all(&pci_bus_res[bus].io_avail);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
769 memlist_free_all(&pci_bus_res[bus].io_used);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
770
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
771 /* add the new resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
772 memlist_insert(&pci_bus_res[bus].io_avail, addr, size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
773 }
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
774 }
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
775
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
776 return (addr);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
777 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
778
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
779 static uint64_t
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
780 get_parbus_mem_res(uchar_t parbus, uchar_t bus, uint64_t size, uint64_t align)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
781 {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
782 uint64_t addr = 0;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
783 uchar_t res_bus;
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
784
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
785 /*
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
786 * Skip root(peer) buses in multiple-root-bus systems when
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
787 * ACPI resource discovery was not successfully done.
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
788 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
789 if ((pci_bus_res[parbus].par_bus == (uchar_t)-1) &&
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
790 (num_root_bus > 1) && (acpi_resource_discovery <= 0))
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
791 return (0);
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
792
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
793 res_bus = parbus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
794 while (pci_bus_res[res_bus].subtractive) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
795 if (pci_bus_res[res_bus].mem_avail)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
796 break;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
797 res_bus = pci_bus_res[res_bus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
798 if (res_bus == (uchar_t)-1)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
799 break; /* root bus already */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
800 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
801
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
802 if (pci_bus_res[res_bus].mem_avail) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
803 addr = memlist_find(&pci_bus_res[res_bus].mem_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
804 size, align);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
805 if (addr) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
806 memlist_insert(&pci_bus_res[res_bus].mem_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
807 addr, size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
808 (void) memlist_remove(&pci_bus_res[res_bus].pmem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
809 addr, size);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
810
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
811 /* free the old resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
812 memlist_free_all(&pci_bus_res[bus].mem_avail);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
813 memlist_free_all(&pci_bus_res[bus].mem_used);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
814
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
815 /* add the new resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
816 memlist_insert(&pci_bus_res[bus].mem_avail, addr, size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
817 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
818 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
819
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
820 return (addr);
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
821 }
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
822
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
823 /*
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
824 * given a cap_id, return its cap_id location in config space
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
825 */
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
826 static int
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
827 get_pci_cap(uchar_t bus, uchar_t dev, uchar_t func, uint8_t cap_id)
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
828 {
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
829 uint8_t curcap, cap_id_loc;
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
830 uint16_t status;
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
831 int location = -1;
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
832
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
833 /*
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
834 * Need to check the Status register for ECP support first.
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
835 * Also please note that for type 1 devices, the
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
836 * offset could change. Should support type 1 next.
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
837 */
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
838 status = pci_getw(bus, dev, func, PCI_CONF_STAT);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
839 if (!(status & PCI_STAT_CAP)) {
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
840 return (-1);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
841 }
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
842 cap_id_loc = pci_getb(bus, dev, func, PCI_CONF_CAP_PTR);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
843
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
844 /* Walk the list of capabilities */
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
845 while (cap_id_loc && cap_id_loc != (uint8_t)-1) {
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
846 curcap = pci_getb(bus, dev, func, cap_id_loc);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
847
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
848 if (curcap == cap_id) {
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
849 location = cap_id_loc;
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
850 break;
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
851 }
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
852 cap_id_loc = pci_getb(bus, dev, func, cap_id_loc + 1);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
853 }
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
854 return (location);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
855 }
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
856
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
857 /*
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
858 * Does this resource element live in the legacy VGA range?
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
859 */
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
860
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
861 int
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
862 is_vga(struct memlist *elem, enum io_mem io)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
863 {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
864
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
865 if (io == IO) {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
866 if ((elem->ml_address == 0x3b0 && elem->ml_size == 0xc) ||
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
867 (elem->ml_address == 0x3c0 && elem->ml_size == 0x20))
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
868 return (1);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
869 } else {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
870 if (elem->ml_address == 0xa0000 && elem->ml_size == 0x20000)
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
871 return (1);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
872 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
873 return (0);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
874 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
875
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
876 /*
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
877 * Does this entire resource list consist only of legacy VGA resources?
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
878 */
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
879
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
880 int
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
881 list_is_vga_only(struct memlist *l, enum io_mem io)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
882 {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
883 do {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
884 if (!is_vga(l, io))
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
885 return (0);
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
886 } while ((l = l->ml_next) != NULL);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
887 return (1);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
888 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
889
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
890 /*
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
891 * Assign valid resources to unconfigured pci(e) bridges. We are trying
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
892 * to reprogram the bridge when its
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
893 * i) SECBUS == SUBBUS ||
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
894 * ii) IOBASE > IOLIM ||
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
895 * iii) MEMBASE > MEMLIM
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
896 * This must be done after one full pass through the PCI tree to collect
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
897 * all BIOS-configured resources, so that we know what resources are
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
898 * free and available to assign to the unconfigured PPBs.
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
899 */
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
900 static void
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
901 fix_ppb_res(uchar_t secbus, boolean_t prog_sub)
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
902 {
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
903 uchar_t bus, dev, func;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
904 uchar_t parbus, subbus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
905 uint_t io_base, io_limit, mem_base, mem_limit;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
906 uint_t io_size, mem_size, io_align, mem_align;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
907 uint64_t addr = 0;
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
908 int *regp = NULL;
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
909 uint_t reglen;
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
910 int rv, cap_ptr, physhi;
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
911 dev_info_t *dip;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
912 uint16_t cmd_reg;
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
913 struct memlist *list, *scratch_list;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
914
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
915 /* skip root (peer) PCI busses */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
916 if (pci_bus_res[secbus].par_bus == (uchar_t)-1)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
917 return;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
918
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
919 /* skip subtractive PPB when prog_sub is not TRUE */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
920 if (pci_bus_res[secbus].subtractive && !prog_sub)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
921 return;
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
922
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
923 /* some entries may be empty due to discontiguous bus numbering */
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
924 dip = pci_bus_res[secbus].dip;
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
925 if (dip == NULL)
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
926 return;
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
927
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
928 rv = ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dip, DDI_PROP_DONTPASS,
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
929 "reg", &regp, &reglen);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
930 if (rv != DDI_PROP_SUCCESS || reglen == 0)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
931 return;
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
932 physhi = regp[0];
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
933 ddi_prop_free(regp);
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
934
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
935 func = (uchar_t)PCI_REG_FUNC_G(physhi);
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
936 dev = (uchar_t)PCI_REG_DEV_G(physhi);
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
937 bus = (uchar_t)PCI_REG_BUS_G(physhi);
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
938
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
939 /*
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
940 * If pcie bridge, check to see if link is enabled
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
941 */
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
942 cap_ptr = get_pci_cap(bus, dev, func, PCI_CAP_ID_PCI_E);
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
943 if (cap_ptr != -1) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
944 cmd_reg = pci_getw(bus, dev, func,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
945 (uint16_t)cap_ptr + PCIE_LINKCTL);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
946 if (cmd_reg & PCIE_LINKCTL_LINK_DISABLE) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
947 dcmn_err(CE_NOTE,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
948 "!fix_ppb_res: ppb[%x/%x/%x] link is disabled.\n",
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
949 bus, dev, func);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
950 return;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
951 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
952 }
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
953
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
954 subbus = pci_getb(bus, dev, func, PCI_BCNF_SUBBUS);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
955 parbus = pci_bus_res[secbus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
956 ASSERT(parbus == bus);
6331
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
957 cmd_reg = pci_getw(bus, dev, func, PCI_CONF_COMM);
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
958
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
959 /*
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
960 * If we have a Cardbus bridge, but no bus space
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
961 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
962 if (pci_bus_res[secbus].num_cbb != 0 &&
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
963 pci_bus_res[secbus].bus_avail == NULL) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
964 uchar_t range;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
965
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
966 /* normally there are 2 buses under a cardbus bridge */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
967 range = pci_bus_res[secbus].num_cbb * 2;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
968
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
969 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
970 * Try to find and allocate a bus-range starting at subbus+1
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
971 * from the parent of the PPB.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
972 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
973 for (; range != 0; range--) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
974 if (memlist_find_with_startaddr(
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
975 &pci_bus_res[parbus].bus_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
976 subbus + 1, range, 1) != NULL)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
977 break; /* find bus range resource at parent */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
978 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
979 if (range != 0) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
980 memlist_insert(&pci_bus_res[secbus].bus_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
981 subbus + 1, range);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
982 subbus = subbus + range;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
983 pci_bus_res[secbus].sub_bus = subbus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
984 pci_putb(bus, dev, func, PCI_BCNF_SUBBUS, subbus);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
985 add_bus_range_prop(secbus);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
986
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
987 cmn_err(CE_NOTE, "!reprogram bus-range on ppb"
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
988 "[%x/%x/%x]: %x ~ %x\n", bus, dev, func,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
989 secbus, subbus);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
990 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
991 }
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
992
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
993 /*
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
994 * Calculate required IO size and alignment
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
995 * If bus io_size is zero, we are going to assign 512 bytes per bus,
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
996 * otherwise, we'll choose the maximum value of such calculation and
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
997 * bus io_size. The size needs to be 4K aligned.
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
998 *
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
999 * We calculate alignment as the largest power of two less than the
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1000 * the sum of all children's IO size requirements, because this will
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1001 * align to the size of the largest child request within that size
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1002 * (which is always a power of two).
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
1003 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1004 io_size = (subbus - secbus + 1) * 0x200;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1005 if (io_size < pci_bus_res[secbus].io_size)
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1006 io_size = pci_bus_res[secbus].io_size;
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1007 io_size = P2ROUNDUP(io_size, PPB_IO_ALIGNMENT);
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1008 io_align = io_size;
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1009 P2LE(io_align);
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1010
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1011 /*
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1012 * Calculate required MEM size and alignment
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1013 * If bus mem_size is zero, we are going to assign 1M bytes per bus,
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1014 * otherwise, we'll choose the maximum value of such calculation and
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1015 * bus mem_size. The size needs to be 1M aligned.
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1016 *
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1017 * For the alignment, refer to the I/O comment above.
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1018 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1019 mem_size = (subbus - secbus + 1) * PPB_MEM_ALIGNMENT;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1020 if (mem_size < pci_bus_res[secbus].mem_size) {
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1021 mem_size = pci_bus_res[secbus].mem_size;
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1022 mem_size = P2ROUNDUP(mem_size, PPB_MEM_ALIGNMENT);
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1023 }
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1024 mem_align = mem_size;
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1025 P2LE(mem_align);
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
1026
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1027 /* Subtractive bridge */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1028 if (pci_bus_res[secbus].subtractive && prog_sub) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1029 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1030 * We program an arbitrary amount of I/O and memory resource
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1031 * for the subtractive bridge so that child dynamic-resource-
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1032 * allocating devices (such as Cardbus bridges) have a chance
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1033 * of success. Until we have full-tree resource rebalancing,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1034 * dynamic resource allocation (thru busra) only looks at the
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1035 * parent bridge, so all PPBs must have some allocatable
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1036 * resource. For non-subtractive bridges, the resources come
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1037 * from the base/limit register "windows", but subtractive
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1038 * bridges often don't program those (since they don't need to).
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1039 * If we put all the remaining resources on the subtractive
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1040 * bridge, then peer non-subtractive bridges can't allocate
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1041 * more space (even though this is probably most correct).
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1042 * If we put the resources only on the parent, then allocations
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1043 * from children of subtractive bridges will fail without
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1044 * special-case code for bypassing the subtractive bridge.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1045 * This solution is the middle-ground temporary solution until
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1046 * we have fully-capable resource allocation.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1047 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1048
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1049 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1050 * Add an arbitrary I/O resource to the subtractive PPB
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1051 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1052 if (pci_bus_res[secbus].io_avail == NULL) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1053 addr = get_parbus_io_res(parbus, secbus, io_size,
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1054 io_align);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1055 if (addr) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1056 add_ranges_prop(secbus, 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1057 pci_bus_res[secbus].io_reprogram =
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1058 pci_bus_res[parbus].io_reprogram;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1059
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1060 cmn_err(CE_NOTE, "!add io-range on subtractive"
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1061 " ppb[%x/%x/%x]: 0x%x ~ 0x%x\n",
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1062 bus, dev, func, (uint32_t)addr,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1063 (uint32_t)addr + io_size - 1);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1064 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1065 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1066 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1067 * Add an arbitrary memory resource to the subtractive PPB
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1068 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1069 if (pci_bus_res[secbus].mem_avail == NULL) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1070 addr = get_parbus_mem_res(parbus, secbus, mem_size,
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1071 mem_align);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1072 if (addr) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1073 add_ranges_prop(secbus, 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1074 pci_bus_res[secbus].mem_reprogram =
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1075 pci_bus_res[parbus].mem_reprogram;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1076
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1077 cmn_err(CE_NOTE, "!add mem-range on "
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1078 "subtractive ppb[%x/%x/%x]: 0x%x ~ 0x%x\n",
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1079 bus, dev, func, (uint32_t)addr,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1080 (uint32_t)addr + mem_size - 1);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1081 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1082 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1083
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1084 goto cmd_enable;
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1085 }
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1086
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
1087 /*
6331
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1088 * Check to see if we need to reprogram I/O space, either because the
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1089 * parent bus needed reprogramming and so do we, or because I/O space is
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1090 * disabled in base/limit or command register.
5149
f292192855b3 6573171 unnecessary I/O resource warnings on some machines
jveta
parents: 4876
diff changeset
1091 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1092 io_base = pci_getb(bus, dev, func, PCI_BCNF_IO_BASE_LOW);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1093 io_limit = pci_getb(bus, dev, func, PCI_BCNF_IO_LIMIT_LOW);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1094 io_base = (io_base & 0xf0) << 8;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1095 io_limit = ((io_limit & 0xf0) << 8) | 0xfff;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1096
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1097 /* Form list of all resources passed (avail + used) */
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1098 scratch_list = memlist_dup(pci_bus_res[secbus].io_avail);
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1099 memlist_merge(&pci_bus_res[secbus].io_used, &scratch_list);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1100
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1101 if ((pci_bus_res[parbus].io_reprogram ||
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1102 (io_base > io_limit) ||
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1103 (!(cmd_reg & PCI_COMM_IO))) &&
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1104 !list_is_vga_only(scratch_list, IO)) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1105 if (pci_bus_res[secbus].io_used) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1106 memlist_subsume(&pci_bus_res[secbus].io_used,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1107 &pci_bus_res[secbus].io_avail);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1108 }
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1109 if (pci_bus_res[secbus].io_avail &&
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1110 (!pci_bus_res[parbus].io_reprogram) &&
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1111 (!pci_bus_res[parbus].subtractive)) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1112 /* rechoose old io ports info */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1113 list = pci_bus_res[secbus].io_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1114 io_base = 0;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1115 do {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1116 if (is_vga(list, IO))
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1117 continue;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1118 if (!io_base) {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1119 io_base = (uint_t)list->ml_address;
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1120 io_limit = (uint_t)list->ml_address +
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1121 list->ml_size - 1;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1122 io_base =
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1123 P2ALIGN(io_base, PPB_IO_ALIGNMENT);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1124 } else {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1125 if (list->ml_address + list->ml_size >
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1126 io_limit) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1127 io_limit = (uint_t)
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1128 (list->ml_address +
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1129 list->ml_size - 1);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1130 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1131 }
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1132 } while ((list = list->ml_next) != NULL);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1133 /* 4K aligned */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1134 io_limit = P2ROUNDUP(io_limit, PPB_IO_ALIGNMENT) - 1;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1135 io_size = io_limit - io_base + 1;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1136 ASSERT(io_base <= io_limit);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1137 memlist_free_all(&pci_bus_res[secbus].io_avail);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1138 memlist_insert(&pci_bus_res[secbus].io_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1139 io_base, io_size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1140 memlist_insert(&pci_bus_res[parbus].io_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1141 io_base, io_size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1142 (void) memlist_remove(&pci_bus_res[parbus].io_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1143 io_base, io_size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1144 pci_bus_res[secbus].io_reprogram = B_TRUE;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1145 } else {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1146 /* get new io ports from parent bus */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1147 addr = get_parbus_io_res(parbus, secbus, io_size,
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1148 io_align);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1149 if (addr) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1150 io_base = addr;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1151 io_limit = addr + io_size - 1;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1152 pci_bus_res[secbus].io_reprogram = B_TRUE;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1153 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1154 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1155 if (pci_bus_res[secbus].io_reprogram) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1156 /* reprogram PPB regs */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1157 pci_putb(bus, dev, func, PCI_BCNF_IO_BASE_LOW,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1158 (uchar_t)((io_base>>8) & 0xf0));
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1159 pci_putb(bus, dev, func, PCI_BCNF_IO_LIMIT_LOW,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1160 (uchar_t)((io_limit>>8) & 0xf0));
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1161 pci_putb(bus, dev, func, PCI_BCNF_IO_BASE_HI, 0);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1162 pci_putb(bus, dev, func, PCI_BCNF_IO_LIMIT_HI, 0);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1163 add_ranges_prop(secbus, 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1164
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1165 cmn_err(CE_NOTE, "!reprogram io-range on"
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1166 " ppb[%x/%x/%x]: 0x%x ~ 0x%x\n",
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1167 bus, dev, func, io_base, io_limit);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1168 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1169 }
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1170 memlist_free_all(&scratch_list);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1171
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1172 /*
6331
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1173 * Check memory space as we did I/O space.
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1174 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1175 mem_base = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_MEM_BASE);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1176 mem_base = (mem_base & 0xfff0) << 16;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1177 mem_limit = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_MEM_LIMIT);
6331
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1178 mem_limit = ((mem_limit & 0xfff0) << 16) | 0xfffff;
c8abf9eb141c 6677689 fix_ppb_res() needs to consider the Command register setting
gs150176
parents: 6211
diff changeset
1179
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1180 scratch_list = memlist_dup(pci_bus_res[secbus].mem_avail);
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1181 memlist_merge(&pci_bus_res[secbus].mem_used, &scratch_list);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1182
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1183 if ((pci_bus_res[parbus].mem_reprogram ||
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1184 (mem_base > mem_limit) ||
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1185 (!(cmd_reg & PCI_COMM_MAE))) &&
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1186 !list_is_vga_only(scratch_list, MEM)) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1187 if (pci_bus_res[secbus].mem_used) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1188 memlist_subsume(&pci_bus_res[secbus].mem_used,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1189 &pci_bus_res[secbus].mem_avail);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1190 }
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1191 if (pci_bus_res[secbus].mem_avail &&
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1192 (!pci_bus_res[parbus].mem_reprogram) &&
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1193 (!pci_bus_res[parbus].subtractive)) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1194 /* rechoose old mem resource */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1195 list = pci_bus_res[secbus].mem_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1196 mem_base = 0;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1197 do {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1198 if (is_vga(list, MEM))
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1199 continue;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1200 if (mem_base == 0) {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1201 mem_base = (uint_t)list->ml_address;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1202 mem_base = P2ALIGN(mem_base,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1203 PPB_MEM_ALIGNMENT);
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1204 mem_limit = (uint_t)(list->ml_address +
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1205 list->ml_size - 1);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1206 } else {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1207 if ((list->ml_address + list->ml_size) >
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1208 mem_limit) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1209 mem_limit = (uint_t)
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1210 (list->ml_address +
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1211 list->ml_size - 1);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1212 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1213 }
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1214 } while ((list = list->ml_next) != NULL);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1215 mem_limit = P2ROUNDUP(mem_limit, PPB_MEM_ALIGNMENT) - 1;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1216 mem_size = mem_limit + 1 - mem_base;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1217 ASSERT(mem_base <= mem_limit);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1218 memlist_free_all(&pci_bus_res[secbus].mem_avail);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1219 memlist_insert(&pci_bus_res[secbus].mem_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1220 mem_base, mem_size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1221 memlist_insert(&pci_bus_res[parbus].mem_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1222 mem_base, mem_size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1223 (void) memlist_remove(&pci_bus_res[parbus].mem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1224 mem_base, mem_size);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1225 pci_bus_res[secbus].mem_reprogram = B_TRUE;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1226 } else {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1227 /* get new mem resource from parent bus */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1228 addr = get_parbus_mem_res(parbus, secbus, mem_size,
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1229 mem_align);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1230 if (addr) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1231 mem_base = addr;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1232 mem_limit = addr + mem_size - 1;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1233 pci_bus_res[secbus].mem_reprogram = B_TRUE;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1234 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1235 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1236
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1237 if (pci_bus_res[secbus].mem_reprogram) {
9221
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1238 /* reprogram PPB MEM regs */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1239 pci_putw(bus, dev, func, PCI_BCNF_MEM_BASE,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1240 (uint16_t)((mem_base>>16) & 0xfff0));
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1241 pci_putw(bus, dev, func, PCI_BCNF_MEM_LIMIT,
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1242 (uint16_t)((mem_limit>>16) & 0xfff0));
9221
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1243 /*
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1244 * Disable PMEM window by setting base > limit.
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1245 * We currently don't reprogram the PMEM like we've
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1246 * done for I/O and MEM. (Devices that support prefetch
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1247 * can use non-prefetch MEM.) Anyway, if the MEM access
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1248 * bit is initially disabled by BIOS, we disable the
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1249 * PMEM window manually by setting PMEM base > PMEM
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1250 * limit here, in case there are incorrect values in
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1251 * them from BIOS, so that we won't get in trouble once
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1252 * the MEM access bit is enabled at the end of this
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1253 * function.
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1254 */
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1255 if (!(cmd_reg & PCI_COMM_MAE)) {
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1256 pci_putw(bus, dev, func, PCI_BCNF_PF_BASE_LOW,
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1257 0xfff0);
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1258 pci_putw(bus, dev, func, PCI_BCNF_PF_LIMIT_LOW,
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1259 0x0);
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1260 pci_putl(bus, dev, func, PCI_BCNF_PF_BASE_HIGH,
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1261 0xffffffff);
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1262 pci_putl(bus, dev, func, PCI_BCNF_PF_LIMIT_HIGH,
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1263 0x0);
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1264 }
f57a4c49f2b1 6816405 cannot install osol 109 or snv_110 on Fujitsu Lifebook S7110 laptop due to hang.
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9149
diff changeset
1265
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1266 add_ranges_prop(secbus, 1);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1267
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1268 cmn_err(CE_NOTE, "!reprogram mem-range on"
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1269 " ppb[%x/%x/%x]: 0x%x ~ 0x%x\n",
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1270 bus, dev, func, mem_base, mem_limit);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1271 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1272 }
10293
ac02598ffdd8 6869654 pci_autoconfig: memory leak in memlist_alloc() in snv_121 on x86 on systems with zfs root
Dan Mick <Dan.Mick@Sun.COM>
parents: 10251
diff changeset
1273 memlist_free_all(&scratch_list);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1274
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1275 cmd_enable:
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1276 if (pci_bus_res[secbus].io_avail)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1277 cmd_reg |= PCI_COMM_IO | PCI_COMM_ME;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1278 if (pci_bus_res[secbus].mem_avail)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1279 cmd_reg |= PCI_COMM_MAE | PCI_COMM_ME;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1280 pci_putw(bus, dev, func, PCI_CONF_COMM, cmd_reg);
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1281 }
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1282
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1283 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1284 pci_reprogram(void)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1285 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1286 int i, pci_reconfig = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1287 char *onoff;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1288 int bus;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1289
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
1290 /*
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1291 * Scan ACPI namespace for _BBN objects, make sure that
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1292 * childless root-bridges appear in devinfo tree
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1293 */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1294 pci_scan_bbn();
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1295 pci_unitaddr_cache_init();
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1296
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1297 /*
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1298 * Fix-up unit-address assignments if cache is available
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
1299 */
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1300 if (pci_unitaddr_cache_valid()) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1301 int pci_regs[] = {0, 0, 0};
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1302 int new_addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1303 int index = 0;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1304
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1305 for (bus = 0; bus <= pci_bios_maxbus; bus++) {
10552
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1306 /* skip non-root (peer) PCI busses */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1307 if ((pci_bus_res[bus].par_bus != (uchar_t)-1) ||
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1308 (pci_bus_res[bus].dip == NULL))
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1309 continue;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1310
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1311 new_addr = pci_bus_unitaddr(index);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1312 if (pci_bus_res[bus].root_addr != new_addr) {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1313 /* update reg property for node */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1314 pci_regs[0] = pci_bus_res[bus].root_addr =
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1315 new_addr;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1316 (void) ndi_prop_update_int_array(
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1317 DDI_DEV_T_NONE, pci_bus_res[bus].dip,
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1318 "reg", (int *)pci_regs, 3);
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1319 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1320 index++;
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1321 }
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1322 } else {
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1323 /* perform legacy processing */
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1324 pci_renumber_root_busses();
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1325 pci_unitaddr_cache_create();
bf9134a043f1 6472670 Internal pci root-bus addresses should be independent of bios enumeration order (non-x8400 systems)
Dana Myers <Dana.Myers@Sun.COM>
parents: 10384
diff changeset
1326 }
1413
5c66154eab3c 6324138 Internal pci bus numbering should be independent of bios enumeration order
myers
parents: 1007
diff changeset
1327
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1328 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1329 * Do root-bus resource discovery
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1330 */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1331 for (bus = 0; bus <= pci_bios_maxbus; bus++) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1332 /* skip non-root (peer) PCI busses */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1333 if (pci_bus_res[bus].par_bus != (uchar_t)-1)
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1334 continue;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1335
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1336 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1337 * 1. find resources associated with this root bus
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1338 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1339 populate_bus_res(bus);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1340
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1341
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1342 /*
9226
efb0bee5599d 6821665 WARNING: kb8042: inconsistent getinfo(9E) implementation
Judy Chen <Judy.Chen@Sun.COM>
parents: 9221
diff changeset
1343 * 2. Remove used PCI and ISA resources from bus resource map
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1344 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1345
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1346 memlist_remove_list(&pci_bus_res[bus].io_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1347 pci_bus_res[bus].io_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1348 memlist_remove_list(&pci_bus_res[bus].mem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1349 pci_bus_res[bus].mem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1350 memlist_remove_list(&pci_bus_res[bus].pmem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1351 pci_bus_res[bus].pmem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1352 memlist_remove_list(&pci_bus_res[bus].mem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1353 pci_bus_res[bus].pmem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1354 memlist_remove_list(&pci_bus_res[bus].pmem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1355 pci_bus_res[bus].mem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1356
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1357 memlist_remove_list(&pci_bus_res[bus].io_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1358 isa_res.io_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1359 memlist_remove_list(&pci_bus_res[bus].mem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1360 isa_res.mem_used);
10895
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1361
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1362 /*
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1363 * 3. Exclude <1M address range here in case below reserved
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1364 * ranges for BIOS data area, ROM area etc are wrongly reported
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1365 * in ACPI resource producer entries for PCI root bus.
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1366 * 00000000 - 000003FF RAM
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1367 * 00000400 - 000004FF BIOS data area
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1368 * 00000500 - 0009FFFF RAM
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1369 * 000A0000 - 000BFFFF VGA RAM
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1370 * 000C0000 - 000FFFFF ROM area
275ef2b47915 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10804
diff changeset
1371 */
10917
2c1f18099a3e 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot (fix lint)
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10895
diff changeset
1372 (void) memlist_remove(&pci_bus_res[bus].mem_avail, 0, 0x100000);
2c1f18099a3e 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot (fix lint)
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10895
diff changeset
1373 (void) memlist_remove(&pci_bus_res[bus].pmem_avail,
2c1f18099a3e 6881268 Fujitsu-Siemens Amilo D8820 hangs during boot when wifi card present in cardbus slot (fix lint)
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 10895
diff changeset
1374 0, 0x100000);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1375 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1376
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1377 memlist_free_all(&isa_res.io_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1378 memlist_free_all(&isa_res.mem_used);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1379
1895
21a9e9965d62 6404301 pci_boot.c incorrectly assigns bus-range property for root/peer bus
rw148561
parents: 1865
diff changeset
1380 /* add bus-range property for root/peer bus nodes */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1381 for (i = 0; i <= pci_bios_maxbus; i++) {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1382 /* create bus-range property on root/peer buses */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1383 if (pci_bus_res[i].par_bus == (uchar_t)-1)
1895
21a9e9965d62 6404301 pci_boot.c incorrectly assigns bus-range property for root/peer bus
rw148561
parents: 1865
diff changeset
1384 add_bus_range_prop(i);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1385
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1386 /* setup bus range resource on each bus */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1387 setup_bus_res(i);
1895
21a9e9965d62 6404301 pci_boot.c incorrectly assigns bus-range property for root/peer bus
rw148561
parents: 1865
diff changeset
1388 }
21a9e9965d62 6404301 pci_boot.c incorrectly assigns bus-range property for root/peer bus
rw148561
parents: 1865
diff changeset
1389
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1390 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1391 DDI_PROP_DONTPASS, "pci-reprog", &onoff) == DDI_SUCCESS) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1392 if (strcmp(onoff, "off") == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1393 pci_reconfig = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1394 cmn_err(CE_NOTE, "pci device reprogramming disabled");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1395 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1396 ddi_prop_free(onoff);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1397 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1398
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1399 remove_subtractive_res();
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1400
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1401 /* reprogram the non-subtractive PPB */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1402 if (pci_reconfig)
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1403 for (i = 0; i <= pci_bios_maxbus; i++)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1404 fix_ppb_res(i, B_FALSE);
2950
449abdd74783 6354996 pci_boot.c incorrectly accounts for system resources in PCI configuration
myers
parents: 2466
diff changeset
1405
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1406 for (i = 0; i <= pci_bios_maxbus; i++) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1407 /* configure devices not configured by BIOS */
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1408 if (pci_reconfig) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1409 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1410 * Reprogram the subtractive PPB. At this time, all its
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1411 * siblings should have got their resources already.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1412 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1413 if (pci_bus_res[i].subtractive)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1414 fix_ppb_res(i, B_TRUE);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1415 enumerate_bus_devs(i, CONFIG_NEW);
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
1416 }
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1417 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1418
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1419 /* All dev programmed, so we can create available prop */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1420 for (i = 0; i <= pci_bios_maxbus; i++)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1421 add_bus_available_prop(i);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1422 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1423
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1424 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1425 * populate bus resources
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1426 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1427 static void
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1428 populate_bus_res(uchar_t bus)
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1429 {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1430
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1431 /* scan BIOS structures */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1432 pci_bus_res[bus].pmem_avail = find_bus_res(bus, PREFETCH_TYPE);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1433 pci_bus_res[bus].mem_avail = find_bus_res(bus, MEM_TYPE);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1434 pci_bus_res[bus].io_avail = find_bus_res(bus, IO_TYPE);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1435 pci_bus_res[bus].bus_avail = find_bus_res(bus, BUSRANGE_TYPE);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1436
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1437 /*
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1438 * attempt to initialize sub_bus from the largest range-end
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1439 * in the bus_avail list
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1440 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1441 if (pci_bus_res[bus].bus_avail != NULL) {
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1442 struct memlist *entry;
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1443 int current;
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1444
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1445 entry = pci_bus_res[bus].bus_avail;
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1446 while (entry != NULL) {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1447 current = entry->ml_address + entry->ml_size - 1;
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1448 if (current > pci_bus_res[bus].sub_bus)
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1449 pci_bus_res[bus].sub_bus = current;
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
1450 entry = entry->ml_next;
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1451 }
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1452 }
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1453
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1454 if (bus == 0) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1455 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1456 * Special treatment of bus 0:
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1457 * If no IO/MEM resource from ACPI/MPSPEC/HRT, copy
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1458 * pcimem from boot and make I/O space the entire range
8780
624d2269e889 6798926 pci_autoconfig: PCI root-bus 'bus-range' property should be initialized using _CRS when possible
Dana Myers <Dana.Myers@Sun.COM>
parents: 8738
diff changeset
1459 * starting at 0x100.
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1460 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1461 if (pci_bus_res[0].mem_avail == NULL)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1462 pci_bus_res[0].mem_avail =
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1463 memlist_dup(bootops->boot_mem->pcimem);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1464 /* Exclude 0x00 to 0xff of the I/O space, used by all PCs */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1465 if (pci_bus_res[0].io_avail == NULL)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1466 memlist_insert(&pci_bus_res[0].io_avail, 0x100, 0xffff);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1467 }
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1468
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1469 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1470 * Create 'ranges' property here before any resources are
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1471 * removed from the resource lists
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1472 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1473 add_ranges_prop(bus, 0);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1474 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1475
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1476
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1477 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1478 * Create top-level bus dips, i.e. /pci@0,0, /pci@1,0...
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1479 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1480 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1481 create_root_bus_dip(uchar_t bus)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1482 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1483 int pci_regs[] = {0, 0, 0};
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1484 dev_info_t *dip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1485
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1486 ASSERT(pci_bus_res[bus].par_bus == (uchar_t)-1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1487
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1488 num_root_bus++;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1489 ndi_devi_alloc_sleep(ddi_root_node(), "pci",
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents: 748
diff changeset
1490 (pnode_t)DEVI_SID_NODEID, &dip);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1491 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1492 "#address-cells", 3);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1493 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1494 "#size-cells", 2);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1495 pci_regs[0] = pci_bus_res[bus].root_addr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1496 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1497 "reg", (int *)pci_regs, 3);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1498
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1499 /*
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1500 * If system has PCIe bus, then create different properties
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1501 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1502 if (create_pcie_root_bus(bus, dip) == B_FALSE)
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1503 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1504 "device_type", "pci");
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1505
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1506 (void) ndi_devi_bind_driver(dip, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1507 pci_bus_res[bus].dip = dip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1508 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1509
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1510 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1511 * For any fixed configuration (often compatability) pci devices
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1512 * and those with their own expansion rom, create device nodes
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1513 * to hold the already configured device details.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1514 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1515 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1516 enumerate_bus_devs(uchar_t bus, int config_op)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1517 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1518 uchar_t dev, func, nfunc, header;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1519 ushort_t venid;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1520 struct pci_devfunc *devlist = NULL, *entry;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1521
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1522 if (config_op == CONFIG_NEW) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1523 dcmn_err(CE_NOTE, "configuring pci bus 0x%x", bus);
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1524 } else if (config_op == CONFIG_FIX) {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1525 dcmn_err(CE_NOTE, "fixing devices on pci bus 0x%x", bus);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1526 } else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1527 dcmn_err(CE_NOTE, "enumerating pci bus 0x%x", bus);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1528
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1529 if (config_op == CONFIG_NEW) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1530 devlist = (struct pci_devfunc *)pci_bus_res[bus].privdata;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1531 while (devlist) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1532 entry = devlist;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1533 devlist = entry->next;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1534 if (entry->reprogram ||
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1535 pci_bus_res[bus].io_reprogram ||
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1536 pci_bus_res[bus].mem_reprogram) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1537 /* reprogram device(s) */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1538 (void) add_reg_props(entry->dip, bus,
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1539 entry->dev, entry->func, CONFIG_NEW, 0);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1540 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1541 kmem_free(entry, sizeof (*entry));
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1542 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1543 pci_bus_res[bus].privdata = NULL;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1544 return;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1545 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1546
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1547 for (dev = 0; dev < max_dev_pci; dev++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1548 nfunc = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1549 for (func = 0; func < nfunc; func++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1550
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1551 dcmn_err(CE_NOTE, "probing dev 0x%x, func 0x%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1552 dev, func);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1553
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1554 venid = pci_getw(bus, dev, func, PCI_CONF_VENID);
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1555
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1556 if ((venid == 0xffff) || (venid == 0)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1557 /* no function at this address */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1558 continue;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1559 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1560
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1561 header = pci_getb(bus, dev, func, PCI_CONF_HEADER);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1562 if (header == 0xff) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1563 continue; /* illegal value */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1564 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1565
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1566 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1567 * according to some mail from Microsoft posted
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1568 * to the pci-drivers alias, their only requirement
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1569 * for a multifunction device is for the 1st
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1570 * function to have to PCI_HEADER_MULTI bit set.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1571 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1572 if ((func == 0) && (header & PCI_HEADER_MULTI)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1573 nfunc = 8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1574 }
610
62137109013a 6294681 pci_autoconfig: PCI enumeration misses functions after "non-configured" function
myers
parents: 603
diff changeset
1575
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1576 if (config_op == CONFIG_FIX ||
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1577 config_op == CONFIG_INFO) {
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1578 /*
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1579 * Create the node, unconditionally, on the
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1580 * first pass only. It may still need
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1581 * resource assignment, which will be
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1582 * done on the second, CONFIG_NEW, pass.
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1583 */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1584 process_devfunc(bus, dev, func, header,
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1585 venid, config_op);
825
4e9cc40be9a9 6344290 enumerate_bus_devs produces small memory leak in snv_27 on all x86/amd64 platforms
dmick
parents: 793
diff changeset
1586
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1587 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1588 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1589 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1590
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1591 /* percolate bus used resources up through parents to root */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1592 if (config_op == CONFIG_INFO) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1593 int par_bus;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1594
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1595 par_bus = pci_bus_res[bus].par_bus;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1596 while (par_bus != (uchar_t)-1) {
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1597 pci_bus_res[par_bus].io_size +=
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1598 pci_bus_res[bus].io_size;
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1599 pci_bus_res[par_bus].mem_size +=
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
1600 pci_bus_res[bus].mem_size;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1601
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1602 if (pci_bus_res[bus].io_used)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1603 memlist_merge(&pci_bus_res[bus].io_used,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1604 &pci_bus_res[par_bus].io_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1605
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1606 if (pci_bus_res[bus].mem_used)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1607 memlist_merge(&pci_bus_res[bus].mem_used,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1608 &pci_bus_res[par_bus].mem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1609
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1610 if (pci_bus_res[bus].pmem_used)
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1611 memlist_merge(&pci_bus_res[bus].pmem_used,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1612 &pci_bus_res[par_bus].pmem_used);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1613
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
1614 bus = par_bus;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1615 par_bus = pci_bus_res[par_bus].par_bus;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1616 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1617 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1618 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1619
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1620 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1621 check_pciide_prop(uchar_t revid, ushort_t venid, ushort_t devid,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1622 ushort_t subvenid, ushort_t subdevid)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1623 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1624 static int prop_exist = -1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1625 static char *pciide_str;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1626 char compat[32];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1627
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1628 if (prop_exist == -1) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1629 prop_exist = (ddi_prop_lookup_string(DDI_DEV_T_ANY,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1630 ddi_root_node(), DDI_PROP_DONTPASS, "pci-ide",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1631 &pciide_str) == DDI_SUCCESS);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1632 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1633
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1634 if (!prop_exist)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1635 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1636
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1637 /* compare property value against various forms of compatible */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1638 if (subvenid) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1639 (void) snprintf(compat, sizeof (compat), "pci%x,%x.%x.%x.%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1640 venid, devid, subvenid, subdevid, revid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1641 if (strcmp(pciide_str, compat) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1642 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1643
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1644 (void) snprintf(compat, sizeof (compat), "pci%x,%x.%x.%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1645 venid, devid, subvenid, subdevid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1646 if (strcmp(pciide_str, compat) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1647 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1648
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1649 (void) snprintf(compat, sizeof (compat), "pci%x,%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1650 subvenid, subdevid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1651 if (strcmp(pciide_str, compat) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1652 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1653 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1654 (void) snprintf(compat, sizeof (compat), "pci%x,%x.%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1655 venid, devid, revid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1656 if (strcmp(pciide_str, compat) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1657 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1658
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1659 (void) snprintf(compat, sizeof (compat), "pci%x,%x", venid, devid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1660 if (strcmp(pciide_str, compat) == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1661 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1662
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1663 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1664 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1665
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1666 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1667 is_pciide(uchar_t basecl, uchar_t subcl, uchar_t revid,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1668 ushort_t venid, ushort_t devid, ushort_t subvenid, ushort_t subdevid)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1669 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1670 struct ide_table { /* table for PCI_MASS_OTHER */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1671 ushort_t venid;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1672 ushort_t devid;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1673 } *entry;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1674
6211
5ef7bda7ecea 6662348 ata: Cannot DVD install Intel DG33TL motherboard
ml40262
parents: 6095
diff changeset
1675 /* XXX SATA and other devices: need a way to add dynamically */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1676 static struct ide_table ide_other[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1677 {0x1095, 0x3112},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1678 {0x1095, 0x3114},
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1679 {0x1095, 0x3512},
6984
620f4148fdb0 5031620 Some cards based upon the SiL 680(A) ATA controller won't bind due to a hardware lie.
tt30446
parents: 6927
diff changeset
1680 {0x1095, 0x680}, /* Sil0680 */
6211
5ef7bda7ecea 6662348 ata: Cannot DVD install Intel DG33TL motherboard
ml40262
parents: 6095
diff changeset
1681 {0x1283, 0x8211}, /* ITE 8211F is subcl PCI_MASS_OTHER */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1682 {0, 0}
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1683 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1684
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1685 if (basecl != PCI_CLASS_MASS)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1686 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1687
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1688 if (subcl == PCI_MASS_IDE) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1689 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1690 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1691
6984
620f4148fdb0 5031620 Some cards based upon the SiL 680(A) ATA controller won't bind due to a hardware lie.
tt30446
parents: 6927
diff changeset
1692 if (check_pciide_prop(revid, venid, devid, subvenid, subdevid))
620f4148fdb0 5031620 Some cards based upon the SiL 680(A) ATA controller won't bind due to a hardware lie.
tt30446
parents: 6927
diff changeset
1693 return (1);
620f4148fdb0 5031620 Some cards based upon the SiL 680(A) ATA controller won't bind due to a hardware lie.
tt30446
parents: 6927
diff changeset
1694
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1695 if (subcl != PCI_MASS_OTHER && subcl != PCI_MASS_SATA) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1696 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1697 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1698
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1699 entry = &ide_other[0];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1700 while (entry->venid) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1701 if (entry->venid == venid && entry->devid == devid)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1702 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1703 entry++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1704 }
6984
620f4148fdb0 5031620 Some cards based upon the SiL 680(A) ATA controller won't bind due to a hardware lie.
tt30446
parents: 6927
diff changeset
1705 return (0);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1706 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1707
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1708 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1709 is_display(uint_t classcode)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1710 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1711 static uint_t disp_classes[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1712 0x000100,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1713 0x030000,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1714 0x030001
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1715 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1716 int i, nclasses = sizeof (disp_classes) / sizeof (uint_t);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1717
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1718 for (i = 0; i < nclasses; i++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1719 if (classcode == disp_classes[i])
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1720 return (1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1721 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1722 return (0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1723 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1724
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1725 static void
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1726 add_undofix_entry(uint8_t bus, uint8_t dev, uint8_t fn,
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1727 void (*undofn)(uint8_t, uint8_t, uint8_t))
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1728 {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1729 struct pci_fixundo *newundo;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1730
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1731 newundo = kmem_alloc(sizeof (struct pci_fixundo), KM_SLEEP);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1732
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1733 /*
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1734 * Adding an item to this list means that we must turn its NMIENABLE
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1735 * bit back on at a later time.
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1736 */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1737 newundo->bus = bus;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1738 newundo->dev = dev;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1739 newundo->fn = fn;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1740 newundo->undofn = undofn;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1741 newundo->next = undolist;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1742
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1743 /* add to the undo list in LIFO order */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1744 undolist = newundo;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1745 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1746
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1747 void
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1748 add_pci_fixes(void)
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1749 {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1750 int i;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1751
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
1752 for (i = 0; i <= pci_bios_maxbus; i++) {
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1753 /*
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1754 * For each bus, apply needed fixes to the appropriate devices.
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1755 * This must be done before the main enumeration loop because
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1756 * some fixes must be applied to devices normally encountered
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1757 * later in the pci scan (e.g. if a fix to device 7 must be
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1758 * applied before scanning device 6, applying fixes in the
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1759 * normal enumeration loop would obviously be too late).
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1760 */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1761 enumerate_bus_devs(i, CONFIG_FIX);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1762 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1763 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1764
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1765 void
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1766 undo_pci_fixes(void)
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1767 {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1768 struct pci_fixundo *nextundo;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1769 uint8_t bus, dev, fn;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1770
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1771 /*
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1772 * All fixes in the undo list are performed unconditionally. Future
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1773 * fixes may require selective undo.
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1774 */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1775 while (undolist != NULL) {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1776
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1777 bus = undolist->bus;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1778 dev = undolist->dev;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1779 fn = undolist->fn;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1780
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1781 (*(undolist->undofn))(bus, dev, fn);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1782
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1783 nextundo = undolist->next;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1784 kmem_free(undolist, sizeof (struct pci_fixundo));
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1785 undolist = nextundo;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1786 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1787 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1788
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1789 static void
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1790 undo_amd8111_pci_fix(uint8_t bus, uint8_t dev, uint8_t fn)
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1791 {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1792 uint8_t val8;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1793
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1794 val8 = pci_getb(bus, dev, fn, LPC_IO_CONTROL_REG_1);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1795 /*
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1796 * The NMIONERR bit is turned back on to allow the SMM BIOS
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1797 * to handle more critical PCI errors (e.g. PERR#).
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1798 */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1799 val8 |= AMD8111_ENABLENMI;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1800 pci_putb(bus, dev, fn, LPC_IO_CONTROL_REG_1, val8);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1801 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1802
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1803 static void
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1804 pci_fix_amd8111(uint8_t bus, uint8_t dev, uint8_t fn)
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1805 {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1806 uint8_t val8;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1807
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1808 val8 = pci_getb(bus, dev, fn, LPC_IO_CONTROL_REG_1);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1809
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1810 if ((val8 & AMD8111_ENABLENMI) == 0)
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1811 return;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1812
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1813 /*
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1814 * We reset NMIONERR in the LPC because master-abort on the PCI
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1815 * bridge side of the 8111 will cause NMI, which might cause SMI,
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1816 * which sometimes prevents all devices from being enumerated.
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1817 */
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1818 val8 &= ~AMD8111_ENABLENMI;
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1819
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1820 pci_putb(bus, dev, fn, LPC_IO_CONTROL_REG_1, val8);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1821
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1822 add_undofix_entry(bus, dev, fn, undo_amd8111_pci_fix);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1823 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1824
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1825 static void
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1826 set_devpm_d0(uchar_t bus, uchar_t dev, uchar_t func)
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1827 {
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1828 uint16_t status;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1829 uint8_t header;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1830 uint8_t cap_ptr;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1831 uint8_t cap_id;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1832 uint16_t pmcsr;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1833
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1834 status = pci_getw(bus, dev, func, PCI_CONF_STAT);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1835 if (!(status & PCI_STAT_CAP))
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1836 return; /* No capabilities list */
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1837
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1838 header = pci_getb(bus, dev, func, PCI_CONF_HEADER) & PCI_HEADER_TYPE_M;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1839 if (header == PCI_HEADER_CARDBUS)
9284
f60784e63c92 6482159 kernel hangs in pcic_attach at boot time on Fujitsu FMV6800MG laptop
Casper H.S. Dik <Casper.Dik@Sun.COM>
parents: 9226
diff changeset
1840 cap_ptr = pci_getb(bus, dev, func, PCI_CBUS_CAP_PTR);
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1841 else
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1842 cap_ptr = pci_getb(bus, dev, func, PCI_CONF_CAP_PTR);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1843 /*
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1844 * Walk the capabilities list searching for a PM entry.
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1845 */
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1846 while (cap_ptr != PCI_CAP_NEXT_PTR_NULL && cap_ptr >= PCI_CAP_PTR_OFF) {
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1847 cap_ptr &= PCI_CAP_PTR_MASK;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1848 cap_id = pci_getb(bus, dev, func, cap_ptr + PCI_CAP_ID);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1849 if (cap_id == PCI_CAP_ID_PM) {
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1850 pmcsr = pci_getw(bus, dev, func, cap_ptr + PCI_PMCSR);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1851 pmcsr &= ~(PCI_PMCSR_STATE_MASK);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1852 pmcsr |= PCI_PMCSR_D0; /* D0 state */
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1853 pci_putw(bus, dev, func, cap_ptr + PCI_PMCSR, pmcsr);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1854 break;
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1855 }
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1856 cap_ptr = pci_getb(bus, dev, func, cap_ptr + PCI_CAP_NEXT_PTR);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1857 }
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1858
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1859 }
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1860
9149
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
1861 #define is_isa(bc, sc) \
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
1862 (((bc) == PCI_CLASS_BRIDGE) && ((sc) == PCI_BRIDGE_ISA))
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
1863
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
1864 static void
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1865 process_devfunc(uchar_t bus, uchar_t dev, uchar_t func, uchar_t header,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1866 ushort_t vendorid, int config_op)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1867 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1868 char nodename[32], unitaddr[5];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1869 dev_info_t *dip;
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
1870 uchar_t basecl, subcl, progcl, intr, revid;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1871 ushort_t subvenid, subdevid, status;
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1872 ushort_t slot_num;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1873 uint_t classcode, revclass;
4876
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
1874 int reprogram = 0, pciide = 0;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1875 int power[2] = {1, 1};
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1876 int pciex = 0;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
1877 ushort_t is_pci_bridge = 0;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1878 struct pci_devfunc *devlist = NULL, *entry = NULL;
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
1879 boolean_t slot_valid;
8215
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
1880 gfx_entry_t *gfxp;
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1881 pcie_req_id_t bdf;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1882
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1883 ushort_t deviceid = pci_getw(bus, dev, func, PCI_CONF_DEVID);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1884
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1885 switch (header & PCI_HEADER_TYPE_M) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1886 case PCI_HEADER_ZERO:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1887 subvenid = pci_getw(bus, dev, func, PCI_CONF_SUBVENID);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1888 subdevid = pci_getw(bus, dev, func, PCI_CONF_SUBSYSID);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1889 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1890 case PCI_HEADER_CARDBUS:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1891 subvenid = pci_getw(bus, dev, func, PCI_CBUS_SUBVENID);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1892 subdevid = pci_getw(bus, dev, func, PCI_CBUS_SUBSYSID);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1893 /* Record the # of cardbus bridges found on the bus */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1894 if (config_op == CONFIG_INFO)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1895 pci_bus_res[bus].num_cbb++;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1896 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1897 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1898 subvenid = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1899 subdevid = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1900 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1901 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1902
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1903 if (config_op == CONFIG_FIX) {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1904 if (vendorid == VENID_AMD && deviceid == DEVID_AMD8111_LPC) {
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1905 pci_fix_amd8111(bus, dev, func);
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1906 }
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
1907 return;
2121
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1908 }
31a173288bb3 6423164 USB keyboard & mouse don't work on w2100z running b39
sethg
parents: 1895
diff changeset
1909
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1910 /* XXX should be use generic names? derive from class? */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1911 revclass = pci_getl(bus, dev, func, PCI_CONF_REVID);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1912 classcode = revclass >> 8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1913 revid = revclass & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1914
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1915 /* figure out if this is pci-ide */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1916 basecl = classcode >> 16;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1917 subcl = (classcode >> 8) & 0xff;
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
1918 progcl = classcode & 0xff;
4876
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
1919
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1920
4876
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
1921 if (is_display(classcode))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1922 (void) snprintf(nodename, sizeof (nodename), "display");
9149
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
1923 else if (!pseudo_isa && is_isa(basecl, subcl))
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
1924 (void) snprintf(nodename, sizeof (nodename), "isa");
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1925 else if (subvenid != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1926 (void) snprintf(nodename, sizeof (nodename),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1927 "pci%x,%x", subvenid, subdevid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1928 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1929 (void) snprintf(nodename, sizeof (nodename),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1930 "pci%x,%x", vendorid, deviceid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1931
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1932 /* make sure parent bus dip has been created */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
1933 if (pci_bus_res[bus].dip == NULL)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1934 create_root_bus_dip(bus);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1935
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1936 ndi_devi_alloc_sleep(pci_bus_res[bus].dip, nodename,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1937 DEVI_SID_NODEID, &dip);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1938
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
1939 if (check_if_device_is_pciex(dip, bus, dev, func, &slot_valid,
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
1940 &slot_num, &is_pci_bridge) == B_TRUE)
1865
c8b524cdb631 PSARC/2006/217 Access and Dma Handle Error Clear Functions
dilpreet
parents: 1494
diff changeset
1941 pciex = 1;
c8b524cdb631 PSARC/2006/217 Access and Dma Handle Error Clear Functions
dilpreet
parents: 1494
diff changeset
1942
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1943 bdf = PCI_GETBDF(bus, dev, func);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1944 /*
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1945 * Record BAD AMD bridges which don't support MMIO config access.
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1946 */
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1947 if (IS_BAD_AMD_NTBRIDGE(vendorid, deviceid) ||
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1948 IS_AMD_8132_CHIP(vendorid, deviceid)) {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1949 uchar_t secbus = 0;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1950 uchar_t subbus = 0;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1951
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1952 if ((basecl == PCI_CLASS_BRIDGE) &&
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1953 (subcl == PCI_BRIDGE_PCI)) {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1954 secbus = pci_getb(bus, dev, func, PCI_BCNF_SECBUS);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1955 subbus = pci_getb(bus, dev, func, PCI_BCNF_SUBBUS);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1956 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1957 pci_cfgacc_add_workaround(bdf, secbus, subbus);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1958 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1959
11327
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1960 /*
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1961 * Only populate bus_t if this is a PCIE platform, and
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1962 * the device is sitting under a PCIE root complex(RC) .
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1963 * Some particular machines have both PCIE RC and PCI
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1964 * hostbridge, in which case only devices under PCIE RC
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1965 * get their bus_t populated.
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1966 */
2a76e51f60ab 6909993 bootup panic at assertion failed: rcdip != NULL, file: ../../intel/io/pci/pci_boot.c, line: 3362
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11245
diff changeset
1967 if ((mcfg_mem_base != NULL) && (pcie_get_rc_dip(dip) != NULL)) {
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1968 ck804_fix_aer_ptr(dip, bdf);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1969 (void) pcie_init_bus(dip, bdf, PCIE_BUS_INITIAL);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1970 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
1971
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1972 /* add properties */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1973 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip, "device-id", deviceid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1974 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip, "vendor-id", vendorid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1975 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip, "revision-id", revid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1976 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1977 "class-code", classcode);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1978 if (func == 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1979 (void) snprintf(unitaddr, sizeof (unitaddr), "%x", dev);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1980 else
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1981 (void) snprintf(unitaddr, sizeof (unitaddr),
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1982 "%x,%x", dev, func);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1983 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1984 "unit-address", unitaddr);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1985
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1986 /* add device_type for display nodes */
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1987 if (is_display(classcode)) {
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1988 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1989 "device_type", "display");
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
1990 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1991 /* add special stuff for header type */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1992 if ((header & PCI_HEADER_TYPE_M) == PCI_HEADER_ZERO) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1993 uchar_t mingrant = pci_getb(bus, dev, func, PCI_CONF_MIN_G);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1994 uchar_t maxlatency = pci_getb(bus, dev, func, PCI_CONF_MAX_L);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1995
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1996 if (subvenid != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1997 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1998 "subsystem-id", subdevid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
1999 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2000 "subsystem-vendor-id", subvenid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2001 }
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2002 if (!pciex)
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2003 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2004 "min-grant", mingrant);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2005 if (!pciex)
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2006 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2007 "max-latency", maxlatency);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2008 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2009
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2010 /* interrupt, record if not 0 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2011 intr = pci_getb(bus, dev, func, PCI_CONF_IPIN);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2012 if (intr != 0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2013 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2014 "interrupts", intr);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2015
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2016 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2017 * Add support for 133 mhz pci eventually
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2018 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2019 status = pci_getw(bus, dev, func, PCI_CONF_STAT);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2020
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2021 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2022 "devsel-speed", (status & PCI_STAT_DEVSELT) >> 9);
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2023 if (!pciex && (status & PCI_STAT_FBBC))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2024 (void) ndi_prop_create_boolean(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2025 "fast-back-to-back");
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2026 if (!pciex && (status & PCI_STAT_66MHZ))
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2027 (void) ndi_prop_create_boolean(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2028 "66mhz-capable");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2029 if (status & PCI_STAT_UDF)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2030 (void) ndi_prop_create_boolean(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2031 "udf-supported");
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
2032 if (pciex && slot_valid) {
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2033 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2034 "physical-slot#", slot_num);
5156
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
2035 if (!is_pci_bridge)
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
2036 pciex_slot_names_prop(dip, slot_num);
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
2037 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2038
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2039 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2040 "power-consumption", power, 2);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2041
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2042 /* Set the device PM state to D0 */
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2043 set_devpm_d0(bus, dev, func);
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2044
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2045 if ((basecl == PCI_CLASS_BRIDGE) && (subcl == PCI_BRIDGE_PCI))
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
2046 add_ppb_props(dip, bus, dev, func, pciex, is_pci_bridge);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2047 else {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2048 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2049 * Record the non-PPB devices on the bus for possible
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2050 * reprogramming at 2nd bus enumeration.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2051 * Note: PPB reprogramming is done in fix_ppb_res()
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2052 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2053 devlist = (struct pci_devfunc *)pci_bus_res[bus].privdata;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2054 entry = kmem_zalloc(sizeof (*entry), KM_SLEEP);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2055 entry->dip = dip;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2056 entry->dev = dev;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2057 entry->func = func;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2058 entry->next = devlist;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2059 pci_bus_res[bus].privdata = entry;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2060 }
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2061
12683
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2062 if (IS_CLASS_IOAPIC(basecl, subcl, progcl)) {
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
2063 create_ioapic_node(bus, dev, func, vendorid, deviceid);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
2064 }
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
2065
12683
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2066 /* check for NVIDIA CK8-04/MCP55 based LPC bridge */
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2067 if (NVIDIA_IS_LPC_BRIDGE(vendorid, deviceid) && (dev == 1) &&
12683
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2068 (func == 0)) {
2435
1e9507847d6d 6445246 x64 pcie needs to be MCP-55 aware
anish
parents: 2121
diff changeset
2069 add_nvidia_isa_bridge_props(dip, bus, dev, func);
12683
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2070 /* each LPC bridge has an integrated IOAPIC */
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2071 apic_nvidia_io_max++;
92e6427b7b70 PSARC/2009/505 IRM Framework Extension(s)
Jimmy Vetayases <Jimmy.Vetayases@oracle.com>
parents: 12054
diff changeset
2072 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2073
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2074 if (pciex && is_pci_bridge)
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2075 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip, "model",
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2076 (char *)"PCIe-PCI bridge");
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2077 else
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2078 add_model_prop(dip, classcode);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2079
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2080 add_compatible(dip, subvenid, subdevid, vendorid, deviceid,
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2081 revid, classcode, pciex);
4876
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2082
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2083 /*
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2084 * See if this device is a controller that advertises
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2085 * itself to be a standard ATA task file controller, or one that
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2086 * has been hard coded.
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2087 *
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2088 * If it is, check if any other higher precedence driver listed in
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2089 * driver_aliases will claim the node by calling
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2090 * ddi_compatibile_driver_major. If so, clear pciide and do not
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2091 * create a pci-ide node or any other special handling.
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2092 *
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2093 * If another driver does not bind, set the node name to pci-ide
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2094 * and then let the special pci-ide handling for registers and
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2095 * child pci-ide nodes proceed below.
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2096 */
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2097 if (is_pciide(basecl, subcl, revid, vendorid, deviceid,
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2098 subvenid, subdevid) == 1) {
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2099 if (ddi_compatible_driver_major(dip, NULL) == (major_t)-1) {
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2100 (void) ndi_devi_set_nodename(dip, "pci-ide", 0);
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2101 pciide = 1;
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2102 }
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2103 }
ecd69ba0713a PSARC/2006/501 Nvidia ck804/mcp55 SATA HBA driver
mlf
parents: 4667
diff changeset
2104
11600
651a9a4f7b5f 6875273 Intel IOMMU needs a rewrite
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 11579
diff changeset
2105 DEVI_SET_PCI(dip);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2106 reprogram = add_reg_props(dip, bus, dev, func, config_op, pciide);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2107 (void) ndi_devi_bind_driver(dip, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2108
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2109 /* special handling for pci-ide */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2110 if (pciide) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2111 dev_info_t *cdip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2112
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2113 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2114 * Create properties specified by P1275 Working Group
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2115 * Proposal #414 Version 1
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2116 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2117 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2118 "device_type", "pci-ide");
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2119 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2120 "#address-cells", 1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2121 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2122 "#size-cells", 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2123
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2124 /* allocate two child nodes */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2125 ndi_devi_alloc_sleep(dip, "ide",
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents: 748
diff changeset
2126 (pnode_t)DEVI_SID_NODEID, &cdip);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2127 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cdip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2128 "reg", 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2129 (void) ndi_devi_bind_driver(cdip, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2130 ndi_devi_alloc_sleep(dip, "ide",
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents: 748
diff changeset
2131 (pnode_t)DEVI_SID_NODEID, &cdip);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2132 (void) ndi_prop_update_int(DDI_DEV_T_NONE, cdip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2133 "reg", 1);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2134 (void) ndi_devi_bind_driver(cdip, 0);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2135
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2136 reprogram = 0; /* don't reprogram pci-ide bridge */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2137 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2138
10384
73bb2903cf6f 6870146 Intel IOMMU has device tree bug that can cause panics
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 10293
diff changeset
2139 if (is_display(classcode)) {
8215
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2140 gfxp = kmem_zalloc(sizeof (*gfxp), KM_SLEEP);
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2141 gfxp->g_dip = dip;
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2142 gfxp->g_prev = NULL;
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2143 gfxp->g_next = gfx_devinfo_list;
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2144 gfx_devinfo_list = gfxp;
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2145 if (gfxp->g_next)
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2146 gfxp->g_next->g_prev = gfxp;
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2147 }
dc6a5d93e70c 6774448 Toonie needs non-unity map
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 8068
diff changeset
2148
9149
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2149 /* special handling for isa */
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2150 if (!pseudo_isa && is_isa(basecl, subcl)) {
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2151 /* add device_type */
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2152 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2153 "device_type", "isa");
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2154 }
3b20bb584283 PSARC 2009/056 Removal of ISA Pseudo Node
Judy Chen <Judy.Chen@Sun.COM>
parents: 8780
diff changeset
2155
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2156 if (reprogram && (entry != NULL))
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2157 entry->reprogram = B_TRUE;
10384
73bb2903cf6f 6870146 Intel IOMMU has device tree bug that can cause panics
Vikram Hegde <Vikram.Hegde@Sun.COM>
parents: 10293
diff changeset
2158
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2159 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2160
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2161 /*
9527
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2162 * Some vendors do not use unique subsystem IDs in their products, which
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2163 * makes the use of form 2 compatible names (pciSSSS,ssss) inappropriate.
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2164 * Allow for these compatible forms to be excluded on a per-device basis.
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2165 */
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2166 /*ARGSUSED*/
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2167 static boolean_t
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2168 subsys_compat_exclude(ushort_t venid, ushort_t devid, ushort_t subvenid,
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2169 ushort_t subdevid, uchar_t revid, uint_t classcode)
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2170 {
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2171 /* Nvidia display adapters */
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2172 if ((venid == 0x10de) && (is_display(classcode)))
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2173 return (B_TRUE);
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2174
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2175 return (B_FALSE);
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2176 }
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2177
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2178 /*
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2179 * Set the compatible property to a value compliant with
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2180 * rev 2.1 of the IEEE1275 PCI binding.
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2181 * (Also used for PCI-Express devices).
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2182 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2183 * pciVVVV,DDDD.SSSS.ssss.RR (0)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2184 * pciVVVV,DDDD.SSSS.ssss (1)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2185 * pciSSSS,ssss (2)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2186 * pciVVVV,DDDD.RR (3)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2187 * pciVVVV,DDDD (4)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2188 * pciclass,CCSSPP (5)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2189 * pciclass,CCSS (6)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2190 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2191 * The Subsystem (SSSS) forms are not inserted if
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2192 * subsystem-vendor-id is 0.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2193 *
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2194 * NOTE: For PCI-Express devices "pci" is replaced with "pciex" in 0-6 above
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2195 * property 2 is not created as per "1275 bindings for PCI Express Interconnect"
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2196 *
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2197 * Set with setprop and \x00 between each
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2198 * to generate the encoded string array form.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2199 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2200 void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2201 add_compatible(dev_info_t *dip, ushort_t subvenid, ushort_t subdevid,
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2202 ushort_t vendorid, ushort_t deviceid, uchar_t revid, uint_t classcode,
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2203 int pciex)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2204 {
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2205 int i = 0;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2206 int size = COMPAT_BUFSIZE;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2207 char *compat[13];
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2208 char *buf, *curr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2209
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2210 curr = buf = kmem_alloc(size, KM_SLEEP);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2211
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2212 if (pciex) {
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2213 if (subvenid) {
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2214 compat[i++] = curr; /* form 0 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2215 (void) snprintf(curr, size, "pciex%x,%x.%x.%x.%x",
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2216 vendorid, deviceid, subvenid, subdevid, revid);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2217 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2218 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2219
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2220 compat[i++] = curr; /* form 1 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2221 (void) snprintf(curr, size, "pciex%x,%x.%x.%x",
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2222 vendorid, deviceid, subvenid, subdevid);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2223 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2224 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2225
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2226 }
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2227 compat[i++] = curr; /* form 3 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2228 (void) snprintf(curr, size, "pciex%x,%x.%x",
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2229 vendorid, deviceid, revid);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2230 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2231 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2232
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2233 compat[i++] = curr; /* form 4 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2234 (void) snprintf(curr, size, "pciex%x,%x", vendorid, deviceid);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2235 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2236 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2237
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2238 compat[i++] = curr; /* form 5 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2239 (void) snprintf(curr, size, "pciexclass,%06x", classcode);
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2240 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2241 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2242
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2243 compat[i++] = curr; /* form 6 */
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2244 (void) snprintf(curr, size, "pciexclass,%04x",
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2245 (classcode >> 8));
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2246 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2247 curr += strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2248 }
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2249
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2250 if (subvenid) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2251 compat[i++] = curr; /* form 0 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2252 (void) snprintf(curr, size, "pci%x,%x.%x.%x.%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2253 vendorid, deviceid, subvenid, subdevid, revid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2254 size -= strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2255 curr += strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2256
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2257 compat[i++] = curr; /* form 1 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2258 (void) snprintf(curr, size, "pci%x,%x.%x.%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2259 vendorid, deviceid, subvenid, subdevid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2260 size -= strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2261 curr += strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2262
9527
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2263 if (subsys_compat_exclude(vendorid, deviceid, subvenid,
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2264 subdevid, revid, classcode) == B_FALSE) {
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2265 compat[i++] = curr; /* form 2 */
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2266 (void) snprintf(curr, size, "pci%x,%x", subvenid,
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2267 subdevid);
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2268 size -= strlen(curr) + 1;
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2269 curr += strlen(curr) + 1;
b2c49ac468a9 6771671 allow exclusion of subsystem ids from the compatible property
Scott Carter, SD IOSW <Scott.Carter@Sun.COM>
parents: 9427
diff changeset
2270 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2271 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2272 compat[i++] = curr; /* form 3 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2273 (void) snprintf(curr, size, "pci%x,%x.%x", vendorid, deviceid, revid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2274 size -= strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2275 curr += strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2276
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2277 compat[i++] = curr; /* form 4 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2278 (void) snprintf(curr, size, "pci%x,%x", vendorid, deviceid);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2279 size -= strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2280 curr += strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2281
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2282 compat[i++] = curr; /* form 5 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2283 (void) snprintf(curr, size, "pciclass,%06x", classcode);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2284 size -= strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2285 curr += strlen(curr) + 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2286
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2287 compat[i++] = curr; /* form 6 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2288 (void) snprintf(curr, size, "pciclass,%04x", (classcode >> 8));
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2289 size -= strlen(curr) + 1;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2290 curr += strlen(curr) + 1;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2291
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2292 (void) ndi_prop_update_string_array(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2293 "compatible", compat, i);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2294 kmem_free(buf, COMPAT_BUFSIZE);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2295 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2296
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2297 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2298 * Adjust the reg properties for a dual channel PCI-IDE device.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2299 *
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2300 * NOTE: don't do anything that changes the order of the hard-decodes
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2301 * and programmed BARs. The kernel driver depends on these values
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2302 * being in this order regardless of whether they're for a 'native'
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2303 * mode BAR or not.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2304 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2305 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2306 * config info for pci-ide devices
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2307 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2308 static struct {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2309 uchar_t native_mask; /* 0 == 'compatibility' mode, 1 == native */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2310 uchar_t bar_offset; /* offset for alt status register */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2311 ushort_t addr; /* compatibility mode base address */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2312 ushort_t length; /* number of ports for this BAR */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2313 } pciide_bar[] = {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2314 { 0x01, 0, 0x1f0, 8 }, /* primary lower BAR */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2315 { 0x01, 2, 0x3f6, 1 }, /* primary upper BAR */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2316 { 0x04, 0, 0x170, 8 }, /* secondary lower BAR */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2317 { 0x04, 2, 0x376, 1 } /* secondary upper BAR */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2318 };
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2319
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2320 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2321 pciIdeAdjustBAR(uchar_t progcl, int index, uint_t *basep, uint_t *lenp)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2322 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2323 int hard_decode = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2324
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2325 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2326 * Adjust the base and len for the BARs of the PCI-IDE
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2327 * device's primary and secondary controllers. The first
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2328 * two BARs are for the primary controller and the next
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2329 * two BARs are for the secondary controller. The fifth
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2330 * and sixth bars are never adjusted.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2331 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2332 if (index >= 0 && index <= 3) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2333 *lenp = pciide_bar[index].length;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2334
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2335 if (progcl & pciide_bar[index].native_mask) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2336 *basep += pciide_bar[index].bar_offset;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2337 } else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2338 *basep = pciide_bar[index].addr;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2339 hard_decode = 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2340 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2341 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2342
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2343 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2344 * if either base or len is zero make certain both are zero
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2345 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2346 if (*basep == 0 || *lenp == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2347 *basep = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2348 *lenp = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2349 hard_decode = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2350 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2351
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2352 return (hard_decode);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2353 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2354
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2355
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2356 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2357 * Add the "reg" and "assigned-addresses" property
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2358 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2359 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2360 add_reg_props(dev_info_t *dip, uchar_t bus, uchar_t dev, uchar_t func,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2361 int config_op, int pciide)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2362 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2363 uchar_t baseclass, subclass, progclass, header;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2364 ushort_t bar_sz;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2365 uint_t value = 0, len, devloc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2366 uint_t base, base_hi, type;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2367 ushort_t offset, end;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2368 int max_basereg, j, reprogram = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2369 uint_t phys_hi;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2370 struct memlist **io_avail, **io_used;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2371 struct memlist **mem_avail, **mem_used;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2372 struct memlist **pmem_avail, **pmem_used;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2373 uchar_t res_bus;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2374
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2375 pci_regspec_t regs[16] = {{0}};
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2376 pci_regspec_t assigned[15] = {{0}};
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2377 int nreg, nasgn;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2378
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2379 io_avail = &pci_bus_res[bus].io_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2380 io_used = &pci_bus_res[bus].io_used;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2381 mem_avail = &pci_bus_res[bus].mem_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2382 mem_used = &pci_bus_res[bus].mem_used;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2383 pmem_avail = &pci_bus_res[bus].pmem_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2384 pmem_used = &pci_bus_res[bus].pmem_used;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2385
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2386 devloc = (uint_t)bus << 16 | (uint_t)dev << 11 | (uint_t)func << 8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2387 regs[0].pci_phys_hi = devloc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2388 nreg = 1; /* rest of regs[0] is all zero */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2389 nasgn = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2390
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2391 baseclass = pci_getb(bus, dev, func, PCI_CONF_BASCLASS);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2392 subclass = pci_getb(bus, dev, func, PCI_CONF_SUBCLASS);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2393 progclass = pci_getb(bus, dev, func, PCI_CONF_PROGCLASS);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2394 header = pci_getb(bus, dev, func, PCI_CONF_HEADER) & PCI_HEADER_TYPE_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2395
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2396 switch (header) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2397 case PCI_HEADER_ZERO:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2398 max_basereg = PCI_BASE_NUM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2399 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2400 case PCI_HEADER_PPB:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2401 max_basereg = PCI_BCNF_BASE_NUM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2402 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2403 case PCI_HEADER_CARDBUS:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2404 max_basereg = PCI_CBUS_BASE_NUM;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2405 reprogram = 1;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2406 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2407 default:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2408 max_basereg = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2409 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2410 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2411
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2412 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2413 * Create the register property by saving the current
2448
b861d072cd92 6451513 pci_autoconfig: PCI enumeration on HP DL585/DL380 hangs at boot
myers
parents: 2435
diff changeset
2414 * value of the base register. Write 0xffffffff to the
b861d072cd92 6451513 pci_autoconfig: PCI enumeration on HP DL585/DL380 hangs at boot
myers
parents: 2435
diff changeset
2415 * base register. Read the value back to determine the
b861d072cd92 6451513 pci_autoconfig: PCI enumeration on HP DL585/DL380 hangs at boot
myers
parents: 2435
diff changeset
2416 * required size of the address space. Restore the base
b861d072cd92 6451513 pci_autoconfig: PCI enumeration on HP DL585/DL380 hangs at boot
myers
parents: 2435
diff changeset
2417 * register contents.
b861d072cd92 6451513 pci_autoconfig: PCI enumeration on HP DL585/DL380 hangs at boot
myers
parents: 2435
diff changeset
2418 *
11169
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2419 * Do not disable I/O and memory access for bridges; this
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2420 * has the side-effect of making the bridge transparent to
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2421 * secondary-bus activity (see sections 4.1-4.3 of the
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2422 * PCI-PCI Bridge Spec V1.2). For non-bridges, disable
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2423 * I/O and memory access to avoid difficulty with USB
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2424 * emulation (see OHCI spec1.0a appendix B
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2425 * "Host Controller Mapping")
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2426 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2427 end = PCI_CONF_BASE0 + max_basereg * sizeof (uint_t);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2428 for (j = 0, offset = PCI_CONF_BASE0; offset < end;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2429 j++, offset += bar_sz) {
11169
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2430 uint_t command;
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2431
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2432 /* determine the size of the address space */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2433 base = pci_getl(bus, dev, func, offset);
11169
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2434 if (baseclass != PCI_CLASS_BRIDGE) {
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2435 command = (uint_t)pci_getw(bus, dev, func,
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2436 PCI_CONF_COMM);
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2437 pci_putw(bus, dev, func, PCI_CONF_COMM,
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2438 command & ~(PCI_COMM_MAE | PCI_COMM_IO));
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2439 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2440 pci_putl(bus, dev, func, offset, 0xffffffff);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2441 value = pci_getl(bus, dev, func, offset);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2442 pci_putl(bus, dev, func, offset, base);
11169
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2443 if (baseclass != PCI_CLASS_BRIDGE)
d46461938be8 6853338 pci_autoconfig: should disable IO/MEM decode while changing the BAR of OHCI host controller
Dana Myers <Dana.Myers@Sun.COM>
parents: 11075
diff changeset
2444 pci_putw(bus, dev, func, PCI_CONF_COMM, command);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2445
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2446 /* construct phys hi,med.lo, size hi, lo */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2447 if ((pciide && j < 4) || (base & PCI_BASE_SPACE_IO)) {
9427
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2448 int hard_decode = 0;
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2449
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2450 /* i/o space */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2451 bar_sz = PCI_BAR_SZ_32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2452 value &= PCI_BASE_IO_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2453 len = ((value ^ (value-1)) + 1) >> 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2454
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2455 /* XXX Adjust first 4 IDE registers */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2456 if (pciide) {
301
78b2c1965ca8 6288075 SATA hard disks can't be seen on W2100z machines
yt160523
parents: 277
diff changeset
2457 if (subclass != PCI_MASS_IDE)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2458 progclass = (PCI_IDE_IF_NATIVE_PRI |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2459 PCI_IDE_IF_NATIVE_SEC);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2460 hard_decode = pciIdeAdjustBAR(progclass, j,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2461 &base, &len);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2462 } else if (value == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2463 /* skip base regs with size of 0 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2464 continue;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2465 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2466
9427
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2467 regs[nreg].pci_phys_hi = PCI_ADDR_IO | devloc |
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2468 (hard_decode ? PCI_RELOCAT_B : offset);
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2469 regs[nreg].pci_phys_low = hard_decode ?
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2470 base & PCI_BASE_IO_ADDR_M : 0;
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2471 assigned[nasgn].pci_phys_hi =
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2472 PCI_RELOCAT_B | regs[nreg].pci_phys_hi;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2473 regs[nreg].pci_size_low =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2474 assigned[nasgn].pci_size_low = len;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2475 type = base & (~PCI_BASE_IO_ADDR_M);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2476 base &= PCI_BASE_IO_ADDR_M;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2477 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2478 * A device under a subtractive PPB can allocate
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2479 * resources from its parent bus if there is no resource
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2480 * available on its own bus.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2481 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2482 if ((config_op == CONFIG_NEW) && (*io_avail == NULL)) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2483 res_bus = bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2484 while (pci_bus_res[res_bus].subtractive) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2485 res_bus = pci_bus_res[res_bus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2486 if (res_bus == (uchar_t)-1)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2487 break; /* root bus already */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2488 if (pci_bus_res[res_bus].io_avail) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2489 io_avail = &pci_bus_res
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2490 [res_bus].io_avail;
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2491 break;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2492 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2493 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2494 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2495
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2496 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2497 * first pass - gather what's there
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2498 * update/second pass - adjust/allocate regions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2499 * config - allocate regions
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2500 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2501 if (config_op == CONFIG_INFO) { /* first pass */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2502 /* take out of the resource map of the bus */
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2503 if (base != 0) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2504 (void) memlist_remove(io_avail, base,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2505 len);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2506 memlist_insert(io_used, base, len);
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2507 } else {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2508 reprogram = 1;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2509 }
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2510 pci_bus_res[bus].io_size += len;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2511 } else if ((*io_avail && base == 0) ||
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2512 pci_bus_res[bus].io_reprogram) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2513 base = (uint_t)memlist_find(io_avail, len, len);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2514 if (base != 0) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2515 memlist_insert(io_used, base, len);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2516 /* XXX need to worry about 64-bit? */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2517 pci_putl(bus, dev, func, offset,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2518 base | type);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2519 base = pci_getl(bus, dev, func, offset);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2520 base &= PCI_BASE_IO_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2521 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2522 if (base == 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2523 cmn_err(CE_WARN, "failed to program"
825
4e9cc40be9a9 6344290 enumerate_bus_devs produces small memory leak in snv_27 on all x86/amd64 platforms
dmick
parents: 793
diff changeset
2524 " IO space [%d/%d/%d] BAR@0x%x"
4e9cc40be9a9 6344290 enumerate_bus_devs produces small memory leak in snv_27 on all x86/amd64 platforms
dmick
parents: 793
diff changeset
2525 " length 0x%x",
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
2526 bus, dev, func, offset, len);
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2527 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2528 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2529 assigned[nasgn].pci_phys_low = base;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2530 nreg++, nasgn++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2531
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2532 } else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2533 /* memory space */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2534 if ((base & PCI_BASE_TYPE_M) == PCI_BASE_TYPE_ALL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2535 bar_sz = PCI_BAR_SZ_64;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2536 base_hi = pci_getl(bus, dev, func, offset + 4);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2537 phys_hi = PCI_ADDR_MEM64;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2538 } else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2539 bar_sz = PCI_BAR_SZ_32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2540 base_hi = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2541 phys_hi = PCI_ADDR_MEM32;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2542 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2543
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2544 /* skip base regs with size of 0 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2545 value &= PCI_BASE_M_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2546
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2547 if (value == 0)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2548 continue;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2549
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2550 len = ((value ^ (value-1)) + 1) >> 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2551 regs[nreg].pci_size_low =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2552 assigned[nasgn].pci_size_low = len;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2553
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2554 phys_hi |= (devloc | offset);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2555 if (base & PCI_BASE_PREF_M)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2556 phys_hi |= PCI_PREFETCH_B;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2557
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2558 /*
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2559 * A device under a subtractive PPB can allocate
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2560 * resources from its parent bus if there is no resource
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2561 * available on its own bus.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2562 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2563 if ((config_op == CONFIG_NEW) && (*mem_avail == NULL)) {
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2564 res_bus = bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2565 while (pci_bus_res[res_bus].subtractive) {
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2566 res_bus = pci_bus_res[res_bus].par_bus;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2567 if (res_bus == (uchar_t)-1)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2568 break; /* root bus already */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2569 mem_avail =
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2570 &pci_bus_res[res_bus].mem_avail;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2571 pmem_avail =
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2572 &pci_bus_res [res_bus].pmem_avail;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2573 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2574 * Break out as long as at least
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2575 * mem_avail is available
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2576 */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2577 if ((*pmem_avail &&
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2578 (phys_hi & PCI_PREFETCH_B)) ||
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2579 *mem_avail)
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2580 break;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2581 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2582 }
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2583
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2584 regs[nreg].pci_phys_hi =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2585 assigned[nasgn].pci_phys_hi = phys_hi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2586 assigned[nasgn].pci_phys_hi |= PCI_RELOCAT_B;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2587 assigned[nasgn].pci_phys_mid = base_hi;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2588 type = base & ~PCI_BASE_M_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2589 base &= PCI_BASE_M_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2590
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2591 if (config_op == CONFIG_INFO) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2592 /* take out of the resource map of the bus */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2593 if (base != NULL) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2594 /* remove from PMEM and MEM space */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2595 (void) memlist_remove(mem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2596 base, len);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2597 (void) memlist_remove(pmem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2598 base, len);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2599 /* only note as used in correct map */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2600 if (phys_hi & PCI_PREFETCH_B)
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2601 memlist_insert(pmem_used,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2602 base, len);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2603 else
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2604 memlist_insert(mem_used,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2605 base, len);
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2606 } else {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2607 reprogram = 1;
9588
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2608 }
a4912846ca7d 6833233 pci_autoconfig: needs to consider child requirement for ppb reprogram MEM/IO size decision
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 9527
diff changeset
2609 pci_bus_res[bus].mem_size += len;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2610 } else if ((*mem_avail && base == NULL) ||
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2611 pci_bus_res[bus].mem_reprogram) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2612 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2613 * When desired, attempt a prefetchable
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2614 * allocation first
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2615 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2616 if (phys_hi & PCI_PREFETCH_B) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2617 base = (uint_t)memlist_find(pmem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2618 len, len);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2619 if (base != NULL) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2620 memlist_insert(pmem_used,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2621 base, len);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2622 (void) memlist_remove(mem_avail,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2623 base, len);
8068
922479cd111c 6764872 resource conflict in pci MEM and Prefetch MEM
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 7987
diff changeset
2624 }
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2625 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2626 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2627 * If prefetchable allocation was not
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2628 * desired, or failed, attempt ordinary
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2629 * memory allocation
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2630 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2631 if (base == NULL) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2632 base = (uint_t)memlist_find(mem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2633 len, len);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2634 if (base != NULL) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2635 memlist_insert(mem_used,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2636 base, len);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2637 (void) memlist_remove(
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2638 pmem_avail, base, len);
8068
922479cd111c 6764872 resource conflict in pci MEM and Prefetch MEM
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 7987
diff changeset
2639 }
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2640 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2641 if (base != NULL) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2642 pci_putl(bus, dev, func, offset,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2643 base | type);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2644 base = pci_getl(bus, dev, func, offset);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2645 base &= PCI_BASE_M_ADDR_M;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2646 } else
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2647 cmn_err(CE_WARN, "failed to program "
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
2648 "mem space [%d/%d/%d] BAR@0x%x"
825
4e9cc40be9a9 6344290 enumerate_bus_devs produces small memory leak in snv_27 on all x86/amd64 platforms
dmick
parents: 793
diff changeset
2649 " length 0x%x",
793
d4faf770bcc4 6333242 pci I/O address allocation requires 1K alignment; fails
dmick
parents: 789
diff changeset
2650 bus, dev, func, offset, len);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2651 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2652 assigned[nasgn].pci_phys_low = base;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2653 nreg++, nasgn++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2654 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2655 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2656 switch (header) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2657 case PCI_HEADER_ZERO:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2658 offset = PCI_CONF_ROM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2659 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2660 case PCI_HEADER_PPB:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2661 offset = PCI_BCNF_ROM;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2662 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2663 default: /* including PCI_HEADER_CARDBUS */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2664 goto done;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2665 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2666
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2667 /*
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2668 * Add the expansion rom memory space
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2669 * Determine the size of the ROM base reg; don't write reserved bits
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2670 * ROM isn't in the PCI memory space.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2671 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2672 base = pci_getl(bus, dev, func, offset);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2673 pci_putl(bus, dev, func, offset, PCI_BASE_ROM_ADDR_M);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2674 value = pci_getl(bus, dev, func, offset);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2675 pci_putl(bus, dev, func, offset, base);
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2676 if (value & PCI_BASE_ROM_ENABLE)
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2677 value &= PCI_BASE_ROM_ADDR_M;
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2678 else
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2679 value = 0;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2680
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2681 if (value != 0) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2682 regs[nreg].pci_phys_hi = (PCI_ADDR_MEM32 | devloc) + offset;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2683 assigned[nasgn].pci_phys_hi = (PCI_RELOCAT_B |
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2684 PCI_ADDR_MEM32 | devloc) + offset;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2685 base &= PCI_BASE_ROM_ADDR_M;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2686 assigned[nasgn].pci_phys_low = base;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2687 len = ((value ^ (value-1)) + 1) >> 1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2688 regs[nreg].pci_size_low = assigned[nasgn].pci_size_low = len;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2689 nreg++, nasgn++;
277
1e4ddc05e491 6275104 Can't use pxegrub to boot off e1000g on v65x
szhou
parents: 58
diff changeset
2690 /* take it out of the memory resource */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2691 if (base != NULL) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2692 (void) memlist_remove(mem_avail, base, len);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2693 memlist_insert(mem_used, base, len);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2694 pci_bus_res[bus].mem_size += len;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2695 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2696 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2697
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2698 /*
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2699 * Account for "legacy" (alias) video adapter resources
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2700 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2701
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2702 /* add the three hard-decode, aliased address spaces for VGA */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2703 if ((baseclass == PCI_CLASS_DISPLAY && subclass == PCI_DISPLAY_VGA) ||
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2704 (baseclass == PCI_CLASS_NONE && subclass == PCI_NONE_VGA)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2705
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2706 /* VGA hard decode 0x3b0-0x3bb */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2707 regs[nreg].pci_phys_hi = assigned[nasgn].pci_phys_hi =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2708 (PCI_RELOCAT_B | PCI_ALIAS_B | PCI_ADDR_IO | devloc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2709 regs[nreg].pci_phys_low = assigned[nasgn].pci_phys_low = 0x3b0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2710 regs[nreg].pci_size_low = assigned[nasgn].pci_size_low = 0xc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2711 nreg++, nasgn++;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2712 (void) memlist_remove(io_avail, 0x3b0, 0xc);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2713 memlist_insert(io_used, 0x3b0, 0xc);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2714 pci_bus_res[bus].io_size += 0xc;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2715
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2716 /* VGA hard decode 0x3c0-0x3df */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2717 regs[nreg].pci_phys_hi = assigned[nasgn].pci_phys_hi =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2718 (PCI_RELOCAT_B | PCI_ALIAS_B | PCI_ADDR_IO | devloc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2719 regs[nreg].pci_phys_low = assigned[nasgn].pci_phys_low = 0x3c0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2720 regs[nreg].pci_size_low = assigned[nasgn].pci_size_low = 0x20;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2721 nreg++, nasgn++;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2722 (void) memlist_remove(io_avail, 0x3c0, 0x20);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2723 memlist_insert(io_used, 0x3c0, 0x20);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2724 pci_bus_res[bus].io_size += 0x20;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2725
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2726 /* Video memory */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2727 regs[nreg].pci_phys_hi = assigned[nasgn].pci_phys_hi =
9427
5ae364e5dba1 6303630 "reg" property of pci-ide and display devices are not IEEE-1275 compliant
Max zhen <Max.Zhen@Sun.COM>
parents: 9284
diff changeset
2728 (PCI_RELOCAT_B | PCI_ALIAS_B | PCI_ADDR_MEM32 | devloc);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2729 regs[nreg].pci_phys_low =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2730 assigned[nasgn].pci_phys_low = 0xa0000;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2731 regs[nreg].pci_size_low =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2732 assigned[nasgn].pci_size_low = 0x20000;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2733 nreg++, nasgn++;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2734 /* remove from MEM and PMEM space */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2735 (void) memlist_remove(mem_avail, 0xa0000, 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2736 (void) memlist_remove(pmem_avail, 0xa0000, 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2737 memlist_insert(mem_used, 0xa0000, 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2738 pci_bus_res[bus].mem_size += 0x20000;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2739 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2740
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2741 /* add the hard-decode, aliased address spaces for 8514 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2742 if ((baseclass == PCI_CLASS_DISPLAY) &&
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2743 (subclass == PCI_DISPLAY_VGA) &&
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2744 (progclass & PCI_DISPLAY_IF_8514)) {
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2745
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2746 /* hard decode 0x2e8 */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2747 regs[nreg].pci_phys_hi = assigned[nasgn].pci_phys_hi =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2748 (PCI_RELOCAT_B | PCI_ALIAS_B | PCI_ADDR_IO | devloc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2749 regs[nreg].pci_phys_low = assigned[nasgn].pci_phys_low = 0x2e8;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2750 regs[nreg].pci_size_low = assigned[nasgn].pci_size_low = 0x1;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2751 nreg++, nasgn++;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2752 (void) memlist_remove(io_avail, 0x2e8, 0x1);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2753 memlist_insert(io_used, 0x2e8, 0x1);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2754 pci_bus_res[bus].io_size += 0x1;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2755
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2756 /* hard decode 0x2ea-0x2ef */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2757 regs[nreg].pci_phys_hi = assigned[nasgn].pci_phys_hi =
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2758 (PCI_RELOCAT_B | PCI_ALIAS_B | PCI_ADDR_IO | devloc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2759 regs[nreg].pci_phys_low = assigned[nasgn].pci_phys_low = 0x2ea;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2760 regs[nreg].pci_size_low = assigned[nasgn].pci_size_low = 0x6;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2761 nreg++, nasgn++;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2762 (void) memlist_remove(io_avail, 0x2ea, 0x6);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2763 memlist_insert(io_used, 0x2ea, 0x6);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2764 pci_bus_res[bus].io_size += 0x6;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2765 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2766
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2767 done:
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2768 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip, "reg",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2769 (int *)regs, nreg * sizeof (pci_regspec_t) / sizeof (int));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2770 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2771 "assigned-addresses",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2772 (int *)assigned, nasgn * sizeof (pci_regspec_t) / sizeof (int));
6927
bcfd34eb2a9c 6606300 Installation Hangs on Toshiba Satellite 5200(Dynabook G9) laptop
gs150176
parents: 6331
diff changeset
2773
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2774 return (reprogram);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2775 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2776
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2777 static void
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2778 add_ppb_props(dev_info_t *dip, uchar_t bus, uchar_t dev, uchar_t func,
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
2779 int pciex, ushort_t is_pci_bridge)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2780 {
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2781 char *dev_type;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2782 int i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2783 uint_t val, io_range[2], mem_range[2], pmem_range[2];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2784 uchar_t secbus = pci_getb(bus, dev, func, PCI_BCNF_SECBUS);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2785 uchar_t subbus = pci_getb(bus, dev, func, PCI_BCNF_SUBBUS);
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2786 uchar_t progclass;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2787
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2788 ASSERT(secbus <= subbus);
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2789
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2790 /*
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2791 * Check if it's a subtractive PPB.
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2792 */
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2793 progclass = pci_getb(bus, dev, func, PCI_CONF_PROGCLASS);
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2794 if (progclass == PCI_BRIDGE_PCI_IF_SUBDECODE)
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2795 pci_bus_res[secbus].subtractive = B_TRUE;
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2796
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2797 /*
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2798 * Some BIOSes lie about max pci busses, we allow for
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2799 * such mistakes here
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2800 */
10804
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
2801 if (subbus > pci_bios_maxbus) {
f38860d83eb4 6890417 pci_autoconfig: acpi_pci_probe() uses pci_bios_nbus falsely
Dana Myers <Dana.Myers@Sun.COM>
parents: 10554
diff changeset
2802 pci_bios_maxbus = subbus;
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2803 alloc_res_array();
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2804 }
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
2805
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2806 ASSERT(pci_bus_res[secbus].dip == NULL);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2807 pci_bus_res[secbus].dip = dip;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2808 pci_bus_res[secbus].par_bus = bus;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2809
7987
df16f85b3404 6745976 pcie error handling for adjust for no aer on URs is incorrect.
Erwin T Tsaur <Erwin.Tsaur@Sun.COM>
parents: 7851
diff changeset
2810 dev_type = (pciex && !is_pci_bridge) ? "pciex" : "pci";
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2811
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2812 /* setup bus number hierarchy */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2813 pci_bus_res[secbus].sub_bus = subbus;
2466
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2814 /*
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2815 * Keep track of the largest subordinate bus number (this is essential
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2816 * for peer busses because there is no other way of determining its
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2817 * subordinate bus number).
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2818 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2819 if (subbus > pci_bus_res[bus].sub_bus)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2820 pci_bus_res[bus].sub_bus = subbus;
2466
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2821 /*
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2822 * Loop through subordinate busses, initializing their parent bus
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2823 * field to this bridge's parent. The subordinate busses' parent
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2824 * fields may very well be further refined later, as child bridges
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2825 * are enumerated. (The value is to note that the subordinate busses
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2826 * are not peer busses by changing their par_bus fields to anything
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2827 * other than -1.)
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
2828 */
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2829 for (i = secbus + 1; i <= subbus; i++)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2830 pci_bus_res[i].par_bus = bus;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2831
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2832 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip,
881
e6bc7f4b8a33 PSARC 2005/375 PCI Hotplug Extensions for PCIe
johnny
parents: 825
diff changeset
2833 "device_type", dev_type);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2834 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2835 "#address-cells", 3);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2836 (void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2837 "#size-cells", 2);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2838
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2839 /*
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2840 * Collect bridge window specifications, and use them to populate
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2841 * the "avail" resources for the bus. Not all of those resources will
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2842 * end up being available; this is done top-down, and so the initial
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2843 * collection of windows populates the 'ranges' property for the
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2844 * bus node. Later, as children are found, resources are removed from
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2845 * the 'avail' list, so that it becomes the freelist for
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2846 * this point in the tree. ranges may be set again after bridge
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2847 * reprogramming in fix_ppb_res(), in which case it's set from
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2848 * used + avail.
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2849 *
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2850 * According to PPB spec, the base register should be programmed
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2851 * with a value bigger than the limit register when there are
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2852 * no resources available. This applies to io, memory, and
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2853 * prefetchable memory.
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2854 */
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2855
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2856 /*
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2857 * io range
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2858 * We determine i/o windows that are left unconfigured by BIOS
4517
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2859 * through its i/o enable bit as Microsoft recommends OEMs to do.
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2860 * If it is unset, we disable i/o and mark it for reconfiguration in
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2861 * later passes by setting the base > limit
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2862 */
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2863 val = (uint_t)pci_getw(bus, dev, func, PCI_CONF_COMM);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2864 if (val & PCI_COMM_IO) {
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2865 val = (uint_t)pci_getb(bus, dev, func, PCI_BCNF_IO_BASE_LOW);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2866 io_range[0] = ((val & 0xf0) << 8);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2867 val = (uint_t)pci_getb(bus, dev, func, PCI_BCNF_IO_LIMIT_LOW);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2868 io_range[1] = ((val & 0xf0) << 8) | 0xFFF;
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2869 } else {
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2870 io_range[0] = 0x9fff;
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2871 io_range[1] = 0x1000;
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2872 pci_putb(bus, dev, func, PCI_BCNF_IO_BASE_LOW,
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2873 (uint8_t)((io_range[0] >> 8) & 0xf0));
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2874 pci_putb(bus, dev, func, PCI_BCNF_IO_LIMIT_LOW,
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2875 (uint8_t)((io_range[1] >> 8) & 0xf0));
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2876 pci_putw(bus, dev, func, PCI_BCNF_IO_BASE_HI, 0);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2877 pci_putw(bus, dev, func, PCI_BCNF_IO_LIMIT_HI, 0);
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2878 }
87ecbb2619f0 6414722 rtls "Warning: chip reset fail"
jveta
parents: 4018
diff changeset
2879
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2880 if (io_range[0] != 0 && io_range[0] < io_range[1]) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2881 memlist_insert(&pci_bus_res[secbus].io_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2882 (uint64_t)io_range[0],
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2883 (uint64_t)(io_range[1] - io_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2884 memlist_insert(&pci_bus_res[bus].io_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2885 (uint64_t)io_range[0],
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2886 (uint64_t)(io_range[1] - io_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2887 if (pci_bus_res[bus].io_avail != NULL) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2888 (void) memlist_remove(&pci_bus_res[bus].io_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2889 (uint64_t)io_range[0],
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2890 (uint64_t)(io_range[1] - io_range[0] + 1));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2891 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2892 dcmn_err(CE_NOTE, "bus %d io-range: 0x%x-%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2893 secbus, io_range[0], io_range[1]);
25
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2894 /* if 32-bit supported, make sure upper bits are not set */
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2895 if ((val & 0xf) == 1 &&
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2896 pci_getw(bus, dev, func, PCI_BCNF_IO_BASE_HI)) {
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2897 cmn_err(CE_NOTE, "unsupported 32-bit IO address on"
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2898 " pci-pci bridge [%d/%d/%d]", bus, dev, func);
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2899 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2900 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2901
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2902 /* mem range */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2903 val = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_MEM_BASE);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2904 mem_range[0] = ((val & 0xFFF0) << 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2905 val = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_MEM_LIMIT);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2906 mem_range[1] = ((val & 0xFFF0) << 16) | 0xFFFFF;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2907 if (mem_range[0] != 0 && mem_range[0] < mem_range[1]) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2908 memlist_insert(&pci_bus_res[secbus].mem_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2909 (uint64_t)mem_range[0],
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2910 (uint64_t)(mem_range[1] - mem_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2911 memlist_insert(&pci_bus_res[bus].mem_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2912 (uint64_t)mem_range[0],
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2913 (uint64_t)(mem_range[1] - mem_range[0] + 1));
8068
922479cd111c 6764872 resource conflict in pci MEM and Prefetch MEM
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 7987
diff changeset
2914 /* remove from parent resource list */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2915 (void) memlist_remove(&pci_bus_res[bus].mem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2916 (uint64_t)mem_range[0],
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2917 (uint64_t)(mem_range[1] - mem_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2918 (void) memlist_remove(&pci_bus_res[bus].pmem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2919 (uint64_t)mem_range[0],
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2920 (uint64_t)(mem_range[1] - mem_range[0] + 1));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2921 dcmn_err(CE_NOTE, "bus %d mem-range: 0x%x-%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2922 secbus, mem_range[0], mem_range[1]);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2923 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2924
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2925 /* prefetchable memory range */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2926 val = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_PF_BASE_LOW);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2927 pmem_range[0] = ((val & 0xFFF0) << 16);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2928 val = (uint_t)pci_getw(bus, dev, func, PCI_BCNF_PF_LIMIT_LOW);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2929 pmem_range[1] = ((val & 0xFFF0) << 16) | 0xFFFFF;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2930 if (pmem_range[0] != 0 && pmem_range[0] < pmem_range[1]) {
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2931 memlist_insert(&pci_bus_res[secbus].pmem_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2932 (uint64_t)pmem_range[0],
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2933 (uint64_t)(pmem_range[1] - pmem_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2934 memlist_insert(&pci_bus_res[bus].pmem_used,
6095
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2935 (uint64_t)pmem_range[0],
ffd81788f184 6324898 pci resource allocator needs to be aware of subtractive bridges
gs150176
parents: 5156
diff changeset
2936 (uint64_t)(pmem_range[1] - pmem_range[0] + 1));
8068
922479cd111c 6764872 resource conflict in pci MEM and Prefetch MEM
Guoli Shu<Kerry.Shu@Sun.COM>
parents: 7987
diff changeset
2937 /* remove from parent resource list */
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2938 (void) memlist_remove(&pci_bus_res[bus].pmem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2939 (uint64_t)pmem_range[0],
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2940 (uint64_t)(pmem_range[1] - pmem_range[0] + 1));
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2941 (void) memlist_remove(&pci_bus_res[bus].mem_avail,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2942 (uint64_t)pmem_range[0],
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2943 (uint64_t)(pmem_range[1] - pmem_range[0] + 1));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2944 dcmn_err(CE_NOTE, "bus %d pmem-range: 0x%x-%x",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2945 secbus, pmem_range[0], pmem_range[1]);
25
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2946 /* if 64-bit supported, make sure upper bits are not set */
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2947 if ((val & 0xf) == 1 &&
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2948 pci_getl(bus, dev, func, PCI_BCNF_PF_BASE_HIGH)) {
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2949 cmn_err(CE_NOTE, "unsupported 64-bit prefetch memory on"
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2950 " pci-pci bridge [%d/%d/%d]", bus, dev, func);
83a8af2dd475 PSARC 2005/373 Contract for the Miniroot Repository
szhou
parents: 0
diff changeset
2951 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2952 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2953
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2954 /*
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2955 * Add VGA legacy resources to the bridge's pci_bus_res if it
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2956 * has VGA_ENABLE set. Note that we put them in 'avail',
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2957 * because that's used to populate the ranges prop; they'll be
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2958 * removed from there by the VGA device once it's found. Also,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2959 * remove them from the parent's available list and note them as
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2960 * used in the parent.
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2961 */
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2962
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2963 if (pci_getw(bus, dev, func, PCI_BCNF_BCNTRL) &
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2964 PCI_BCNF_BCNTRL_VGA_ENABLE) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2965
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2966 memlist_insert(&pci_bus_res[secbus].io_avail, 0x3b0, 0xc);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2967
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2968 memlist_insert(&pci_bus_res[bus].io_used, 0x3b0, 0xc);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2969 if (pci_bus_res[bus].io_avail != NULL) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2970 (void) memlist_remove(&pci_bus_res[bus].io_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2971 0x3b0, 0xc);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2972 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2973
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2974 memlist_insert(&pci_bus_res[secbus].io_avail, 0x3c0, 0x20);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2975
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2976 memlist_insert(&pci_bus_res[bus].io_used, 0x3c0, 0x20);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2977 if (pci_bus_res[bus].io_avail != NULL) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2978 (void) memlist_remove(&pci_bus_res[bus].io_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2979 0x3c0, 0x20);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2980 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2981
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2982 memlist_insert(&pci_bus_res[secbus].mem_avail, 0xa0000,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2983 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2984
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2985 memlist_insert(&pci_bus_res[bus].mem_used, 0xa0000, 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2986 if (pci_bus_res[bus].mem_avail != NULL) {
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2987 (void) memlist_remove(&pci_bus_res[bus].mem_avail,
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2988 0xa0000, 0x20000);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2989 }
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
2990 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2991 add_bus_range_prop(secbus);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
2992 add_ranges_prop(secbus, 1);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2993 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2994
58
f37950de9bc8 6259731 cfgadm_pci plugin 'hpc_card_info_t' tables are out of date
anish
parents: 25
diff changeset
2995 extern const struct pci_class_strings_s class_pci[];
f37950de9bc8 6259731 cfgadm_pci plugin 'hpc_card_info_t' tables are out of date
anish
parents: 25
diff changeset
2996 extern int class_pci_items;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2997
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2998 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
2999 add_model_prop(dev_info_t *dip, uint_t classcode)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3000 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3001 const char *desc;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3002 int i;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3003 uchar_t baseclass = classcode >> 16;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3004 uchar_t subclass = (classcode >> 8) & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3005 uchar_t progclass = classcode & 0xff;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3006
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3007 if ((baseclass == PCI_CLASS_MASS) && (subclass == PCI_MASS_IDE)) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3008 desc = "IDE controller";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3009 } else {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3010 for (desc = 0, i = 0; i < class_pci_items; i++) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3011 if ((baseclass == class_pci[i].base_class) &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3012 (subclass == class_pci[i].sub_class) &&
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3013 (progclass == class_pci[i].prog_class)) {
58
f37950de9bc8 6259731 cfgadm_pci plugin 'hpc_card_info_t' tables are out of date
anish
parents: 25
diff changeset
3014 desc = class_pci[i].actual_desc;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3015 break;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3016 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3017 }
58
f37950de9bc8 6259731 cfgadm_pci plugin 'hpc_card_info_t' tables are out of date
anish
parents: 25
diff changeset
3018 if (i == class_pci_items)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3019 desc = "Unknown class of pci/pnpbios device";
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3020 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3021
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3022 (void) ndi_prop_update_string(DDI_DEV_T_NONE, dip, "model",
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3023 (char *)desc);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3024 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3025
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3026 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3027 add_bus_range_prop(int bus)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3028 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3029 int bus_range[2];
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3030
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3031 if (pci_bus_res[bus].dip == NULL)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3032 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3033 bus_range[0] = bus;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3034 bus_range[1] = pci_bus_res[bus].sub_bus;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3035 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, pci_bus_res[bus].dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3036 "bus-range", (int *)bus_range, 2);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3037 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3038
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3039 /*
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3040 * Add slot-names property for any named pci hot-plug slots
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3041 */
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3042 static void
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3043 add_bus_slot_names_prop(int bus)
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3044 {
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3045 char slotprop[256];
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3046 int len;
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3047 extern int pci_irq_nroutes;
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3048 char *slotcap_name;
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3049
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3050 /*
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3051 * If no irq routing table, then go with the slot-names as set up
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3052 * in pciex_slot_names_prop() from slot capability register (if any).
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3053 */
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3054 if (pci_irq_nroutes == 0)
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3055 return;
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3056
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3057 /*
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3058 * Otherise delete the slot-names we already have and use the irq
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3059 * routing table values as returned by pci_slot_names_prop() instead,
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3060 * but keep any property of value "pcie0" as that can't be represented
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3061 * in the irq routing table.
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3062 */
5156
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3063 if (pci_bus_res[bus].dip != NULL) {
12054
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3064 if (ddi_prop_lookup_string(DDI_DEV_T_ANY, pci_bus_res[bus].dip,
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3065 DDI_PROP_DONTPASS, "slot-names", &slotcap_name) !=
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3066 DDI_SUCCESS || strcmp(slotcap_name, "pcie0") != 0)
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3067 (void) ndi_prop_remove(DDI_DEV_T_NONE,
bcacc803343d 6688291 PCI-E slot number of 0 should be respected
Stephen Hanson <Stephen.Hanson@Sun.COM>
parents: 11600
diff changeset
3068 pci_bus_res[bus].dip, "slot-names");
5156
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3069 }
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3070
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3071 len = pci_slot_names_prop(bus, slotprop, sizeof (slotprop));
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3072 if (len > 0) {
2466
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3073 /*
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3074 * Only create a peer bus node if this bus may be a peer bus.
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3075 * It may be a peer bus if the dip is NULL and if par_bus is
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3076 * -1 (par_bus is -1 if this bus was not found to be
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3077 * subordinate to any PCI-PCI bridge).
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3078 * If it's not a peer bus, then the ACPI BBN-handling code
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3079 * will remove it later.
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3080 */
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3081 if (pci_bus_res[bus].par_bus == (uchar_t)-1 &&
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3082 pci_bus_res[bus].dip == NULL) {
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3083
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3084 create_root_bus_dip(bus);
2466
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3085 }
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3086 if (pci_bus_res[bus].dip != NULL) {
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3087 ASSERT((len % sizeof (int)) == 0);
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3088 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE,
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3089 pci_bus_res[bus].dip, "slot-names",
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3090 (int *)slotprop, len / sizeof (int));
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3091 } else {
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3092 cmn_err(CE_NOTE, "!BIOS BUG: Invalid bus number in PCI "
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3093 "IRQ routing table; Not adding slot-names "
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3094 "property for incorrect bus %d", bus);
bfa6f0caa03d 6424853 pci_autoconfig should work around broken pci irq routing table entries for the slot-names property
sethg
parents: 2448
diff changeset
3095 }
603
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3096 }
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3097 }
3c7918e59df0 6323578 slot-names property got lost in the new boot shuffle
jg
parents: 397
diff changeset
3098
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3099 /*
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3100 * Handle both PCI root and PCI-PCI bridge range properties;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3101 * non-zero 'ppb' argument select PCI-PCI bridges versus root.
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3102 */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3103 static void
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3104 memlist_to_ranges(void **rp, struct memlist *entry, int type, int ppb)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3105 {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3106 ppb_ranges_t *ppb_rp = *rp;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3107 pci_ranges_t *pci_rp = *rp;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3108
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3109 while (entry != NULL) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3110 if (ppb) {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3111 ppb_rp->child_high = ppb_rp->parent_high = type;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3112 ppb_rp->child_mid = ppb_rp->parent_mid =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3113 (uint32_t)(entry->ml_address >> 32); /* XXX */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3114 ppb_rp->child_low = ppb_rp->parent_low =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3115 (uint32_t)entry->ml_address;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3116 ppb_rp->size_high =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3117 (uint32_t)(entry->ml_size >> 32); /* XXX */
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3118 ppb_rp->size_low = (uint32_t)entry->ml_size;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3119 *rp = ++ppb_rp;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3120 } else {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3121 pci_rp->child_high = type;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3122 pci_rp->child_mid = pci_rp->parent_high =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3123 (uint32_t)(entry->ml_address >> 32); /* XXX */
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3124 pci_rp->child_low = pci_rp->parent_low =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3125 (uint32_t)entry->ml_address;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3126 pci_rp->size_high =
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3127 (uint32_t)(entry->ml_size >> 32); /* XXX */
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3128 pci_rp->size_low = (uint32_t)entry->ml_size;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3129 *rp = ++pci_rp;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3130 }
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3131 entry = entry->ml_next;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3132 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3133 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3134
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3135 static void
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3136 add_ranges_prop(int bus, int ppb)
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3137 {
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3138 int total, alloc_size;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3139 void *rp, *next_rp;
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3140 struct memlist *iolist, *memlist, *pmemlist;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3141
8738
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3142 /* no devinfo node - unused bus, return */
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3143 if (pci_bus_res[bus].dip == NULL)
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3144 return;
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3145
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3146 iolist = memlist = pmemlist = (struct memlist *)NULL;
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3147
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3148 memlist_merge(&pci_bus_res[bus].io_avail, &iolist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3149 memlist_merge(&pci_bus_res[bus].io_used, &iolist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3150 memlist_merge(&pci_bus_res[bus].mem_avail, &memlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3151 memlist_merge(&pci_bus_res[bus].mem_used, &memlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3152 memlist_merge(&pci_bus_res[bus].pmem_avail, &pmemlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3153 memlist_merge(&pci_bus_res[bus].pmem_used, &pmemlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3154
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3155 total = memlist_count(iolist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3156 total += memlist_count(memlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3157 total += memlist_count(pmemlist);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3158
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3159 /* no property is created if no ranges are present */
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3160 if (total == 0)
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3161 return;
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3162
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3163 alloc_size = total *
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3164 (ppb ? sizeof (ppb_ranges_t) : sizeof (pci_ranges_t));
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3165
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3166 next_rp = rp = kmem_alloc(alloc_size, KM_SLEEP);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3167
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3168 memlist_to_ranges(&next_rp, iolist, PCI_ADDR_IO | PCI_REG_REL_M, ppb);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3169 memlist_to_ranges(&next_rp, memlist,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3170 PCI_ADDR_MEM32 | PCI_REG_REL_M, ppb);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3171 memlist_to_ranges(&next_rp, pmemlist,
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3172 PCI_ADDR_MEM32 | PCI_REG_REL_M | PCI_REG_PF_M, ppb);
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3173
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3174 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, pci_bus_res[bus].dip,
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3175 "ranges", (int *)rp, alloc_size / sizeof (int));
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3176
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3177 kmem_free(rp, alloc_size);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3178 memlist_free_all(&iolist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3179 memlist_free_all(&memlist);
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3180 memlist_free_all(&pmemlist);
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3181 }
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3182
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3183 static void
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3184 memlist_remove_list(struct memlist **list, struct memlist *remove_list)
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3185 {
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3186 while (list && *list && remove_list) {
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3187 (void) memlist_remove(list, remove_list->ml_address,
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3188 remove_list->ml_size);
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3189 remove_list = remove_list->ml_next;
8420
448e8a10ab62 6782932 pci_autoconfig: PCI enumerator needs to use PCI root-bus _CRS when present
Dana Myers <Dana.Myers@Sun.COM>
parents: 8215
diff changeset
3190 }
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3191 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3192
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3193 static int
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3194 memlist_to_spec(struct pci_phys_spec *sp, struct memlist *list, int type)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3195 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3196 int i = 0;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3197
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3198 while (list) {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3199 /* assume 32-bit addresses */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3200 sp->pci_phys_hi = type;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3201 sp->pci_phys_mid = 0;
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3202 sp->pci_phys_low = (uint32_t)list->ml_address;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3203 sp->pci_size_hi = 0;
11474
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3204 sp->pci_size_low = (uint32_t)list->ml_size;
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3205
857f9db4ef05 4517853 debug.h should include macros to assert implication and equivalence
Jonathan Adams <Jonathan.Adams@Sun.COM>
parents: 11327
diff changeset
3206 list = list->ml_next;
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3207 sp++, i++;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3208 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3209 return (i);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3210 }
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3211
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3212 static void
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3213 add_bus_available_prop(int bus)
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3214 {
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3215 int i, count;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3216 struct pci_phys_spec *sp;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3217
8738
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3218 /* no devinfo node - unused bus, return */
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3219 if (pci_bus_res[bus].dip == NULL)
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3220 return;
5797a74500fc 6801832 pci_autoconfig:pci_enumerate ends in a bad mutex panic from ddi_prop_change during boot
Dana Myers <Dana.Myers@Sun.COM>
parents: 8683
diff changeset
3221
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3222 count = memlist_count(pci_bus_res[bus].io_avail) +
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3223 memlist_count(pci_bus_res[bus].mem_avail) +
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3224 memlist_count(pci_bus_res[bus].pmem_avail);
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3225
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3226 if (count == 0) /* nothing available */
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3227 return;
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3228
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3229 sp = kmem_alloc(count * sizeof (*sp), KM_SLEEP);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3230 i = memlist_to_spec(&sp[0], pci_bus_res[bus].io_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3231 PCI_ADDR_IO | PCI_REG_REL_M);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3232 i += memlist_to_spec(&sp[i], pci_bus_res[bus].mem_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3233 PCI_ADDR_MEM32 | PCI_REG_REL_M);
10251
e188a43bda3c 6831312 cpu_freq / cpu_freq_hz is zero on IBM HS22 Nehalem blade
Dan Mick <Dan.Mick@Sun.COM>
parents: 9588
diff changeset
3234 i += memlist_to_spec(&sp[i], pci_bus_res[bus].pmem_avail,
0
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3235 PCI_ADDR_MEM32 | PCI_REG_REL_M | PCI_REG_PF_M);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3236 ASSERT(i == count);
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3237
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3238 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, pci_bus_res[bus].dip,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3239 "available", (int *)sp,
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3240 i * sizeof (struct pci_phys_spec) / sizeof (int));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3241 kmem_free(sp, count * sizeof (*sp));
68f95e015346 OpenSolaris Launch
stevel@tonic-gate
parents:
diff changeset
3242 }
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3243
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3244 static void
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3245 alloc_res_array(void)
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3246 {
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3247 static int array_size = 0;
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3248 int old_size;
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3249 void *old_res;
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3250
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3251 if (array_size > pci_bios_maxbus + 1)
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3252 return; /* array is big enough */
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3253
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3254 old_size = array_size;
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3255 old_res = pci_bus_res;
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3256
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3257 if (array_size == 0)
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3258 array_size = 16; /* start with a reasonable number */
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3259
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3260 while (array_size <= pci_bios_maxbus + 1)
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3261 array_size <<= 1;
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3262 pci_bus_res = (struct pci_bus_resource *)kmem_zalloc(
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3263 array_size * sizeof (struct pci_bus_resource), KM_SLEEP);
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3264
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3265 if (old_res) { /* copy content and free old array */
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3266 bcopy(old_res, pci_bus_res,
13019
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3267 old_size * sizeof (struct pci_bus_resource));
05a4e7665357 6973912 pci_autoconfig: alloc_res_array() feels a little off (by one)
Praveen Kumar Dasaraju Rama <Praveen.Dasaraju@Oracle.COM>
parents: 12683
diff changeset
3268 kmem_free(old_res, old_size * sizeof (struct pci_bus_resource));
397
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3269 }
0f40382f2a76 6309532 don't trust that BIOS - it's lying about its number of PCI buses
szhou
parents: 301
diff changeset
3270 }
3745
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3271
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3272 static void
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3273 create_ioapic_node(int bus, int dev, int fn, ushort_t vendorid,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3274 ushort_t deviceid)
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3275 {
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3276 static dev_info_t *ioapicsnode = NULL;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3277 static int numioapics = 0;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3278 dev_info_t *ioapic_node;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3279 uint64_t physaddr;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3280 uint32_t lobase, hibase = 0;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3281
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3282 /* BAR 0 contains the IOAPIC's memory-mapped I/O address */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3283 lobase = (*pci_getl_func)(bus, dev, fn, PCI_CONF_BASE0);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3284
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3285 /* We (and the rest of the world) only support memory-mapped IOAPICs */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3286 if ((lobase & PCI_BASE_SPACE_M) != PCI_BASE_SPACE_MEM)
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3287 return;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3288
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3289 if ((lobase & PCI_BASE_TYPE_M) == PCI_BASE_TYPE_ALL)
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3290 hibase = (*pci_getl_func)(bus, dev, fn, PCI_CONF_BASE0 + 4);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3291
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3292 lobase &= PCI_BASE_M_ADDR_M;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3293
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3294 physaddr = (((uint64_t)hibase) << 32) | lobase;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3295
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3296 /*
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3297 * Create a nexus node for all IOAPICs under the root node.
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3298 */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3299 if (ioapicsnode == NULL) {
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3300 if (ndi_devi_alloc(ddi_root_node(), IOAPICS_NODE_NAME,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3301 (pnode_t)DEVI_SID_NODEID, &ioapicsnode) != NDI_SUCCESS) {
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3302 return;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3303 }
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3304 (void) ndi_devi_online(ioapicsnode, 0);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3305 }
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3306
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3307 /*
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3308 * Create a child node for this IOAPIC
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3309 */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3310 ioapic_node = ddi_add_child(ioapicsnode, IOAPICS_CHILD_NAME,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3311 DEVI_SID_NODEID, numioapics++);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3312 if (ioapic_node == NULL) {
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3313 return;
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3314 }
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3315
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3316 /* Vendor and Device ID */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3317 (void) ndi_prop_update_int(DDI_DEV_T_NONE, ioapic_node,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3318 IOAPICS_PROP_VENID, vendorid);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3319 (void) ndi_prop_update_int(DDI_DEV_T_NONE, ioapic_node,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3320 IOAPICS_PROP_DEVID, deviceid);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3321
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3322 /* device_type */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3323 (void) ndi_prop_update_string(DDI_DEV_T_NONE, ioapic_node,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3324 "device_type", IOAPICS_DEV_TYPE);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3325
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3326 /* reg */
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3327 (void) ndi_prop_update_int64(DDI_DEV_T_NONE, ioapic_node,
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3328 "reg", physaddr);
9405aaf598cd 6490454 pcplusmp: Need workaround for IOAPIC masking erratum
sethg
parents: 3446
diff changeset
3329 }
5156
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3330
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3331 /*
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3332 * NOTE: For PCIe slots, the name is generated from the slot number
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3333 * information obtained from Slot Capabilities register.
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3334 * For non-PCIe slots, it is generated based on the slot number
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3335 * information in the PCI IRQ table.
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3336 */
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3337 static void
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3338 pciex_slot_names_prop(dev_info_t *dip, ushort_t slot_num)
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3339 {
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3340 char slotprop[256];
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3341 int len;
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3342
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3343 bzero(slotprop, sizeof (slotprop));
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3344
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3345 /* set mask to 1 as there is only one slot (i.e dev 0) */
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3346 *(uint32_t *)slotprop = 1;
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3347 len = 4;
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3348 (void) snprintf(slotprop + len, sizeof (slotprop) - len, "pcie%d",
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3349 slot_num);
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3350 len += strlen(slotprop + len) + 1;
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3351 len += len % 4;
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3352 (void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip, "slot-names",
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3353 (int *)slotprop, len / sizeof (int));
6b4e412afcf5 6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
prasad
parents: 5149
diff changeset
3354 }
11245
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3355
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3356 /*
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3357 * This is currently a hack, a better way is needed to determine if it
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3358 * is a PCIE platform.
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3359 */
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3360 static boolean_t
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3361 is_pcie_platform()
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3362 {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3363 uint8_t bus;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3364
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3365 for (bus = 0; bus < pci_bios_maxbus; bus++) {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3366 if (look_for_any_pciex_device(bus))
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3367 return (B_TRUE);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3368 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3369 return (B_FALSE);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3370 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3371
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3372 /*
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3373 * Enable reporting of AER capability next pointer.
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3374 * This needs to be done only for CK8-04 devices
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3375 * by setting NV_XVR_VEND_CYA1 (offset 0xf40) bit 13
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3376 * NOTE: BIOS is disabling this, it needs to be enabled temporarily
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3377 *
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3378 * This function is adapted from npe_ck804_fix_aer_ptr(), and is
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3379 * called from pci_boot.c.
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3380 */
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3381 static void
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3382 ck804_fix_aer_ptr(dev_info_t *dip, pcie_req_id_t bdf)
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3383 {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3384 dev_info_t *rcdip;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3385 ushort_t cya1;
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3386
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3387 rcdip = pcie_get_rc_dip(dip);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3388 ASSERT(rcdip != NULL);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3389
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3390 if ((pci_cfgacc_get16(rcdip, bdf, PCI_CONF_VENID) ==
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3391 NVIDIA_VENDOR_ID) &&
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3392 (pci_cfgacc_get16(rcdip, bdf, PCI_CONF_DEVID) ==
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3393 NVIDIA_CK804_DEVICE_ID) &&
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3394 (pci_cfgacc_get8(rcdip, bdf, PCI_CONF_REVID) >=
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3395 NVIDIA_CK804_AER_VALID_REVID)) {
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3396 cya1 = pci_cfgacc_get16(rcdip, bdf, NVIDIA_CK804_VEND_CYA1_OFF);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3397 if (!(cya1 & ~NVIDIA_CK804_VEND_CYA1_ERPT_MASK))
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3398 (void) pci_cfgacc_put16(rcdip, bdf,
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3399 NVIDIA_CK804_VEND_CYA1_OFF,
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3400 cya1 | NVIDIA_CK804_VEND_CYA1_ERPT_VAL);
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3401 }
28613b254aad 6831378 identify device type during early boot
Zhi-Jun Robin Fu <Zhijun.Fu@Sun.COM>
parents: 11225
diff changeset
3402 }