pci_cfgreg.c (68a443c29298f8d4bedc4952cf0e502507fb9c15) pci_cfgreg.c (51ef421d928597792acfe581f46b062166e7160d)
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * Copyright (c) 2004, Scott Long <scottl@freebsd.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD$");
32
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * Copyright (c) 2000, Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000, BSDi
5 * Copyright (c) 2004, Scott Long <scottl@freebsd.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD$");
32
33#include "opt_xbox.h"
34
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/bus.h>
36#include <sys/lock.h>
37#include <sys/mutex.h>
38#include <sys/malloc.h>
39#include <sys/queue.h>
40#include <dev/pci/pcivar.h>
41#include <dev/pci/pcireg.h>
42#include <machine/pci_cfgreg.h>
43#include <machine/pc/bios.h>
44
45#include <vm/vm.h>
46#include <vm/vm_param.h>
47#include <vm/vm_kern.h>
48#include <vm/vm_extern.h>
49#include <vm/pmap.h>
50#include <machine/pmap.h>
51
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/bus.h>
38#include <sys/lock.h>
39#include <sys/mutex.h>
40#include <sys/malloc.h>
41#include <sys/queue.h>
42#include <dev/pci/pcivar.h>
43#include <dev/pci/pcireg.h>
44#include <machine/pci_cfgreg.h>
45#include <machine/pc/bios.h>
46
47#include <vm/vm.h>
48#include <vm/vm_param.h>
49#include <vm/vm_kern.h>
50#include <vm/vm_extern.h>
51#include <vm/pmap.h>
52#include <machine/pmap.h>
53
54#ifdef XBOX
55#include <machine/xbox.h>
56#endif
57
52#define PRVERB(a) do { \
53 if (bootverbose) \
54 printf a ; \
55} while(0)
56
57#define PCIE_CACHE 8
58struct pcie_cfg_elem {
59 TAILQ_ENTRY(pcie_cfg_elem) elem;

--- 142 unchanged lines hidden (view full) ---

202 */
203
204/* enable configuration space accesses and return data port address */
205static int
206pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes)
207{
208 int dataport = 0;
209
58#define PRVERB(a) do { \
59 if (bootverbose) \
60 printf a ; \
61} while(0)
62
63#define PCIE_CACHE 8
64struct pcie_cfg_elem {
65 TAILQ_ENTRY(pcie_cfg_elem) elem;

--- 142 unchanged lines hidden (view full) ---

208 */
209
210/* enable configuration space accesses and return data port address */
211static int
212pci_cfgenable(unsigned bus, unsigned slot, unsigned func, int reg, int bytes)
213{
214 int dataport = 0;
215
216#ifdef XBOX
217 if (arch_i386_is_xbox) {
218 /*
219 * The Xbox MCPX chipset is a derivative of the nForce 1
220 * chipset. It almost has the same bus layout; some devices
221 * cannot be used, because they have been removed.
222 */
223
224 /*
225 * Devices 00:00.1 and 00:00.2 used to be memory controllers on
226 * the nForce chipset, but on the Xbox, using them will lockup
227 * the chipset.
228 */
229 if (bus == 0 && slot == 0 && (func == 1 || func == 2))
230 return dataport;
231
232 /*
233 * Bus 1 only contains a VGA controller at 01:00.0. When you try
234 * to probe beyond that device, you only get garbage, which
235 * could cause lockups.
236 */
237 if (bus == 1 && (slot != 0 || func != 0))
238 return dataport;
239
240 /*
241 * Bus 2 used to contain the AGP controller, but the Xbox MCPX
242 * doesn't have one. Probing it can cause lockups.
243 */
244 if (bus >= 2)
245 return dataport;
246 }
247#endif
248
210 if (bus <= PCI_BUSMAX
211 && slot < devmax
212 && func <= PCI_FUNCMAX
213 && reg <= PCI_REGMAX
214 && bytes != 3
215 && (unsigned) bytes <= 4
216 && (reg & (bytes - 1)) == 0) {
217 switch (cfgmech) {

--- 372 unchanged lines hidden ---
249 if (bus <= PCI_BUSMAX
250 && slot < devmax
251 && func <= PCI_FUNCMAX
252 && reg <= PCI_REGMAX
253 && bytes != 3
254 && (unsigned) bytes <= 4
255 && (reg & (bytes - 1)) == 0) {
256 switch (cfgmech) {

--- 372 unchanged lines hidden ---