1 /* $NetBSD: xbox.c,v 1.3 2007/02/04 15:26:27 jmcneill Exp $ */
4 * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
30 * Microsoft XBOX helper functions
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: xbox.c,v 1.3 2007/02/04 15:26:27 jmcneill Exp $");
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/device.h>
40 #include <machine/bus.h>
42 #include <arch/i386/include/xbox.h>
47 extern void pic16lc_setled(uint8_t);
48 extern void pic16lc_reboot(void);
49 extern void pic16lc_poweroff(void);
52 #define XBOX_NFORCE_NIC 0xfef00000
60 if (!arch_i386_is_xbox
)
64 * From Rink Springer @ FreeBSD:
66 * Some XBOX loaders, such as Cromwell, have a flaw which cause the
67 * nfe(4) driver to fail attaching to the NIC.
69 * This is because they leave the NIC running; this will cause the
70 * Nvidia driver to fail as the NIC does not return any sensible
71 * values and thus fails attaching (using an error 0x5, this means
72 * it cannot find a valid PHY)
74 * We bluntly tell the NIC to stop whatever it's doing; this makes
75 * nfe(4) attach correctly. As the NIC always resides at
76 * 0xfef00000-0xfef003ff on an XBOX, we simply hardcode this address.
78 rv
= bus_space_map(X86_BUS_SPACE_MEM
, XBOX_NFORCE_NIC
,
81 bus_space_write_4(X86_BUS_SPACE_MEM
, h
, 0x188, 0);
82 bus_space_unmap(X86_BUS_SPACE_MEM
, h
, 0x400);
89 xbox_setled(uint8_t val
)
94 printf("xbox_setled: pic16lc driver missing from kernel!\n");
104 printf("xbox_reboot: pic16lc driver missing from kernel!\n");
105 printf("xbox_reboot: halting...\n");
117 printf("xbox_poweroff: pic16lc driver missing from kernel!\n");
118 printf("xbox_poweroff: halting...\n");