Patch to allow XBox-users to use the onboard nve(4) nForce ethernet driver.
The patch crudely forces the NIC out of operating mode before the nve(4) driver can initialize it; this is required to properly initialize the NIC. It is XBox-specific, as this condition can only occur on XBoxes (Most loaders will simply leave the NIC running, forcing us to use a crude workaround like this to get it in a workable condition). Due to the XBox-only aspect, this has been solved in XBox-specific initialization code and not within nve(4). Reviewed by: imp Approved by: imp (mentor) No objection: bz@, obrien@, q@ontheweb.com.au
This commit is contained in:
parent
a943b1ff7a
commit
fc05a84231
@ -101,3 +101,5 @@ device rue # RealTek RTL8150 USB Ethernet
|
|||||||
|
|
||||||
device sound
|
device sound
|
||||||
device snd_ich # nForce audio
|
device snd_ich # nForce audio
|
||||||
|
|
||||||
|
device nve # nVidia nForce MCP on-board Ethernet Networking
|
||||||
|
@ -27,10 +27,13 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/systm.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/eventhandler.h>
|
#include <sys/eventhandler.h>
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <machine/xbox.h>
|
#include <machine/xbox.h>
|
||||||
|
#include <vm/vm.h>
|
||||||
|
#include <vm/pmap.h>
|
||||||
#include "opt_global.h"
|
#include "opt_global.h"
|
||||||
|
|
||||||
#ifndef I686_CPU
|
#ifndef I686_CPU
|
||||||
@ -49,12 +52,35 @@ xbox_poweroff(void* junk, int howto)
|
|||||||
static void
|
static void
|
||||||
xbox_init(void)
|
xbox_init(void)
|
||||||
{
|
{
|
||||||
|
char* ptr;
|
||||||
|
|
||||||
if (!arch_i386_is_xbox)
|
if (!arch_i386_is_xbox)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* register our poweroff function */
|
/* register our poweroff function */
|
||||||
EVENTHANDLER_REGISTER (shutdown_final, xbox_poweroff, NULL,
|
EVENTHANDLER_REGISTER (shutdown_final, xbox_poweroff, NULL,
|
||||||
SHUTDOWN_PRI_LAST);
|
SHUTDOWN_PRI_LAST);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some XBOX loaders, such as Cromwell, have a flaw which cause the
|
||||||
|
* nve(4) driver to fail attaching to the NIC.
|
||||||
|
*
|
||||||
|
* This is because they leave the NIC running; this will cause the
|
||||||
|
* Nvidia driver to fail as the NIC does not return any sensible
|
||||||
|
* values and thus fails attaching (using an error 0x5, this means
|
||||||
|
* it cannot find a valid PHY)
|
||||||
|
*
|
||||||
|
* We bluntly tell the NIC to stop whatever it's doing; this makes
|
||||||
|
* nve(4) attach correctly. As the NIC always resides at
|
||||||
|
* 0xfef00000-0xfef003ff on an XBOX, we simply hardcode this address.
|
||||||
|
*/
|
||||||
|
ptr = pmap_mapdev (0xfef00000, 0x400);
|
||||||
|
*(uint32_t*)(ptr + 0x188) = 0; /* clear adapter control field */
|
||||||
|
pmap_unmapdev ((vm_offset_t)ptr, 0x400);
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSINIT(xbox, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, xbox_init, NULL)
|
/*
|
||||||
|
* This must be called before the drivers, as the if_nve(4) driver will fail
|
||||||
|
* if we do not do this in advance.
|
||||||
|
*/
|
||||||
|
SYSINIT(xbox, SI_SUB_DRIVERS, SI_ORDER_FIRST, xbox_init, NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user