1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
.\" $OpenBSD: pcibios.4,v 1.10 2001/08/03 14:30:26 mpech Exp $
.\" $NetBSD: pcibios.4,v 1.7 2000/08/03 13:32:39 soda Exp $
.\"
.\" Copyright (c) 2000 Michale Shalayeff, All rights reserved.
.\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Lennart Augustsson.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 22, 2000
.Dt PCIBIOS 4
.Os
.Sh NAME
.Nm pcibios
.Nd introduction to PCI BIOS support
.Sh SYNOPSIS
.Cd "pcibios0 at bios0 flags 0x0000"
.\" .Cd "#options PCIBIOS_IRQS_HINT=0x0a00 #IRQ 9,11"
.\" .Cd "#options PCIBIOS_INTR_FIXUP_FORCE"
.Pp
.Sh INTRODUCTION
.Ox
provides support for setting up PCI controllers, bridges, and devices
using information extracted from the BIOS.
.Pp
Ideally, the boot firmware of a machine (a.k.a. BIOS) should set
up all PCI devices; assigning them I/O and memory addresses and
interrupts. Alas, this does not always happen, so there is some
PC specific code that can do the initialization when
.Ox
boots.
.Pp
Flags is a bit mask each bit of which specifies a fixup procedure to
omit. The following list specifies these procedures and gives
flags bit values to disable them in case they cause problems.
.Pp
.Bl -tag -width 0x0000
.It 0x0001
Fixup PCI I/O and memory addresses.
.Pp
Some BIOS implementations don't allocate I/O space and
memory space for all PCI devices. Especially, a BIOS
which has
.Qq PnP OS mode
enabled shows this behavior.
Since necessary space isn't allocated, those devices
will not work without special handling.
.Pp
Without this flag force allocation of I/O space and memory space
instead of relying upon the BIOS to do so.
.Pp
If necessary space is already correctly assigned to the devices,
this option leaves the space as is.
.Pp
Although many BIOS implementations leave CardBus bridges'
space unallocated, the CardBus bridge device driver doesn't
require this option, since the driver allocates necessary space
by itself.
.It 0x0002
Fixup PCI bus numbering; needed for many
.Xr cardbus 4
bridges.
.Pp
Each PCI bus and CardBus should have a unique bus number.
But some BIOS implementations don't assign a bus number
for subordinate PCI buses. And many BIOS implementations
don't assign a bus number for CardBuses.
.Pp
A typical symptom of this is the following boot message:
.D1 Sy cardbus0 at cardslot0: bus 0 device 0...
Please note that this cardbus0 has a bus number
.Sq 0 ,
but normally the bus number 0 is used by the machine's
primary PCI bus. Thus, this bus number for cardbus is
incorrect
.Pq not assigned .
In this situation, a device located in cardbus0 doesn't
show correct device ID,
because its bus number 0 incorrectly refers to the primary
PCI bus, and a device ID in the primary PCI bus is shown
in the boot message instead of the device's ID in the cardbus0.
.Pp
Without this flag force assignment of bus numbers for all subordinate
PCI buses and CardBuses.
.Pp
Since this procedure renumbers all PCI buses and CardBuses,
all bus numbers of subordinate buses become different
when this option is enabled.
.It 0x0004
Fixup PCI interrupt routing.
.Pp
Some BIOS implementations don't assign an interrupt for
some devices.
.Pp
This procedure assigns an interrupt for such devices instead
of relying upon the BIOS to do so.
.Pp
If the BIOS has already assigned an interrupt to a device, this
procedure leaves the interrupt as is.
.It 0x0008
Make PCI interrupt routing fixup work with unknown interrupt routers.
If this flag is specified and a PCI interrupt routing table entry
indicates that only one IRQ is available for the entry, the IRQ is
assumed to be already connected to the device, and the corresponding PCI
Interrupt Configuration Register will be configured accordingly.
.Pp
Without this flag, if a PCI interrupt router is not known, interrupt
configuration will not be modified.
.It 0x0010
Be verbose when performing
.Nm
tasks.
Included in these diagnostics are: PCI device address fixup tables,
interrupt fixup reports, and other diagnostic and non-fatal messages.
.It 0x0020
Make the PCI interrupt routing fixup procedure verbose.
.El
.\" .It Nm PCIBIOS_IRQS_HINT
.\" hint for IRQ use.
.\" When the
.\" .Em PCIBIOS_INTR_FIXUP
.\" cannot guess an adequate IRQ for a device, the hint is used.
.\" .Pp
.\" The value is a logical or of power-of-2s of allowable interrupts:
.\" .Bl -column "XX-0xffff" "XX-0xffff" "XX-0xffff" "XX-0xffff" -compact -offset 2n
.\" .It Em "IRQ Value" Em "\tIRQ Value" Em "\tIRQ Value" Em "\tIRQ Value"
.\" .It "\& 0 0x0001" "\t 4 0x0010" "\t 8 0x0100" "\t12 0x1000"
.\" .It "\& 1 0x0002" "\t 5 0x0020" "\t 9 0x0200" "\t13 0x2000"
.\" .It "\& 2 0x0004" "\t 6 0x0040" "\t10 0x0400" "\t14 0x4000"
.\" .It "\& 3 0x0008" "\t 7 0x0080" "\t11 0x0800" "\t15 0x8000"
.\" .El
.\" For example,
.\" .Qq Sy options PCIBIOS_IRQS_HINT=0x0a00
.\" allows IRQ 9 and IRQ 11.
.\"
.\" The kernel global variable
.\" .Va pcibios_irqs_hint
.\" holds this value,
.\" so a user can override this value without kernel recompilation.
.\" For example:
.\" .Bl -bullet -compact
.\" .It
.\" To specify this value on the fly, type the following command
.\" at the boot prompt to drop into DDB (the in-kernel debugger;
.\" you have to specify
.\" .Qq Sy options DDB
.\" to make kernel with DDB):
.\" .Dl Ic boot -d
.\" And type the following command on
.\" .Qq Sy db>
.\" prompt:
.\" .Dl Ic write pcibios_irqs_hint 0x0a00
.\" Then type the following to continue to boot:
.\" .Dl Ic c
.\" .It
.\" To modify kernel image without kernel recompilation,
.\" run the following command on shell:
.\" .Dl Ic gdb --write /netbsd
.\" And type the following commands at the
.\" .Qq Sy (gdb)
.\" prompt:
.\" .Dl Ic set pcibios_irqs_hint=0xa00
.\" .Dl Ic quit
.\" .El
.\"
.\" .It Nm PCIBIOS_INTR_FIXUP_FORCE
.\" .Pp
.\" Some buggy BIOS implementations provide inconsistent
.\" information between the PCI Interrupt Configuration Register
.\" and the PCI Interrupt Routing table. In such case,
.\" the PCI Interrupt Configuration Register takes precedence
.\" by default. If this happens, a kernel with
.\" .Em PCIBIOSVERBOSE
.\" shows
.\" .Qq Sy WARNING: preserving irq XX
.\" in the PCI routing table.
.\"
.\" If
.\" .Em PCIBIOS_INTR_FIXUP_FORCE
.\" is specified in addition to the
.\" .Em PCIBIOS_INTR_FIXUP ,
.\" the PCI Interrupt Routing table takes precedence.
.\" In this case, a kernel with
.\" .Em PCIBIOSVERBOSE
.\" shows
.\" .Qq Sy WARNING: overriding irq XX
.\" in the PCI routing table.
.\"
.\" The necessity of this option is doubtful, and we may
.\" remove this option in the future. If you find that this
.\" option is worth preserving, please report it with send-pr.
.\"
.Sh SEE ALSO
.Xr autoconf 4 ,
.Xr cardbus 4 ,
.Xr pci 4
.Sh HISTORY
The
.Nm
code appeared in
.Nx 1.5 .
.Ox
support was added in
.Ox 2.8 .
In contrast to
.Nx
implementation
.Nm
in
.Ox
is a real device, where options control is done through the
.Nm flags
wich are modifiable through the
.Xr boot_config 8
interface.
For
.Ox 2.9
the PCI interrupt routing establishment sequence was redone to only
fixup and route interrupts when attaching interrupts for a particular PCI
device.
.Sh BUGS
The
.Em PCIBIOS Address Fixup
option may conflict with the PCI CardBus driver's own
address fixup.
|