Add a heuristic to set rbus_min_start based on total RAM. The new
behavior is to choose 0.5 GB for <= 192 MB, 1 GB normally, and 2 GB for >= 1 GB. This should make the defaults work additionally old Thinkpad 600Es, and also on notebooks with lots of RAM (e.g. T60 with 2GB). ok christos@
This commit is contained in:
parent
151f7e0198
commit
11343fbd1f
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: cardbus.4,v 1.28 2006/10/07 23:35:39 elad Exp $
|
||||
.\" $NetBSD: cardbus.4,v 1.29 2007/01/12 20:34:09 gdt Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1999-2006 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -34,7 +34,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd October 7, 2006
|
||||
.Dd January 6, 2007
|
||||
.Dt CARDBUS 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -174,10 +174,15 @@ and access the devices using the
|
||||
abstraction.
|
||||
When the mapping does not work, PCMCIA cards are typically ignored on
|
||||
insert, and Cardbus cards are recognized but nonfunctional.
|
||||
The location is machine-specific, and the default location does not
|
||||
work on all hardware.
|
||||
On i386, the following kernel configuration line, which maps Cardbus
|
||||
space at 512M rather than 1GB, has been found to make Cardbus support
|
||||
On i386, the kernel has a heuristic to choose a memory address for
|
||||
mapping, defaulting to 1 GB, but choosing 0.5 GB on machines with less
|
||||
than 192 MB RAM and 2 GB on machines with more than 1 GB of RAM.
|
||||
The intent is to use an address that is larger than available RAM, but
|
||||
low enough to work; some systems seem to have trouble with
|
||||
addresses requiring more than 20 address lines.
|
||||
On i386, the following kernel configuration line disables the
|
||||
heuristics and forces Cardbus
|
||||
memory space to be mapped at 512M; this value makes Cardbus support
|
||||
(including PCMCIA attachment under a cbb) work on some notebook
|
||||
models, including the IBM Thinkpad 600E (2645-4AU) and the Compaq
|
||||
ARMADA M700:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.592 2007/01/07 01:04:26 jmcneill Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.593 2007/01/12 20:34:09 gdt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006 The NetBSD Foundation, Inc.
|
||||
@ -72,7 +72,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.592 2007/01/07 01:04:26 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.593 2007/01/12 20:34:09 gdt Exp $");
|
||||
|
||||
#include "opt_beep.h"
|
||||
#include "opt_compat_ibcs2.h"
|
||||
@ -191,6 +191,14 @@ uint32_t arch_i386_xbox_memsize = 0;
|
||||
#include "npx.h"
|
||||
#include "ksyms.h"
|
||||
|
||||
#include "cardbus.h"
|
||||
#if NCARDBUS > 0
|
||||
/* For rbus_min_start hint. */
|
||||
#include <machine/bus.h>
|
||||
#include <dev/cardbus/rbus.h>
|
||||
#include <machine/rbus_machdep.h>
|
||||
#endif
|
||||
|
||||
#include "mca.h"
|
||||
#if NMCA > 0
|
||||
#include <machine/mca_machdep.h> /* for mca_busprobe() */
|
||||
@ -460,6 +468,11 @@ cpu_startup()
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
#if NCARDBUS > 0
|
||||
/* Tell RBUS how much RAM we have, so it can use heuristics. */
|
||||
rbus_min_start_hint(ptoa(physmem));
|
||||
#endif
|
||||
|
||||
minaddr = 0;
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rbus_machdep.c,v 1.18 2005/12/11 12:17:41 christos Exp $ */
|
||||
/* $NetBSD: rbus_machdep.c,v 1.19 2007/01/12 20:34:09 gdt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.18 2005/12/11 12:17:41 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.19 2007/01/12 20:34:09 gdt Exp $");
|
||||
|
||||
#include "opt_pcibios.h"
|
||||
#include "opt_pcifixup.h"
|
||||
@ -65,9 +65,61 @@ __KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.18 2005/12/11 12:17:41 christos E
|
||||
|
||||
#ifndef RBUS_MIN_START
|
||||
#define RBUS_MIN_START 0x40000000 /* 1GB */
|
||||
#else
|
||||
/*
|
||||
* Note that kernel config forced RBUS_MIN_START.
|
||||
*/
|
||||
#define RBUS_MIN_START_FORCED
|
||||
#endif
|
||||
bus_addr_t rbus_min_start = RBUS_MIN_START;
|
||||
|
||||
/*
|
||||
* Dynamically set the start address for rbus. This must be called
|
||||
* before rbus is initialized. The start address should be determined
|
||||
* by the amount of installed memory. Generally 1 GB has been found
|
||||
* to be a good value, but it fails on some Thinkpads (e.g. 2645-4AU),
|
||||
* for which 0.5 GB is a good value. It also fails on (at least)
|
||||
* Thinkpads with 2GB of RAM, for which 2 GB is a good value.
|
||||
*
|
||||
* Thus, a general strategy of setting rbus_min_start to the amount of
|
||||
* memory seems in order. However, the actually amount of memory is
|
||||
* generally slightly more than the amount found, e.g. 1014MB vs 1024,
|
||||
* or 2046 vs 2048.
|
||||
*/
|
||||
void
|
||||
rbus_min_start_hint(size_t ram)
|
||||
{
|
||||
#ifdef RBUS_MIN_START_FORCED
|
||||
printf("rbus: rbus_min_start from config at 0x%0lx\n", rbus_min_start);
|
||||
|
||||
#else
|
||||
if (ram <= 192*1024*1024UL) {
|
||||
/*
|
||||
* <= 192 MB, so try 0.5 GB. This will work on Thinkpad
|
||||
* 600E (2645-4AU), which fails at 1GB, and on some other
|
||||
* older machines that may have trouble with addresses
|
||||
* needing more than 20 bits.
|
||||
*/
|
||||
rbus_min_start = 512 * 1024 * 1024UL;
|
||||
}
|
||||
|
||||
if (ram >= 1024*1024*1024UL) {
|
||||
/*
|
||||
* >= 1GB, so try 2 GB.
|
||||
*/
|
||||
rbus_min_start = 2 * 1024 * 1024 * 1024UL;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX For machines with more than 2G, the right choice is not
|
||||
* clear.
|
||||
*/
|
||||
|
||||
printf("rbus: rbus_min_start set to 0x%0lx\n", rbus_min_start);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rbus_tag_t rbus_fakeparent_mem(struct pci_attach_args *pa)
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rbus_machdep.h,v 1.6 2003/02/26 21:29:03 fvdl Exp $ */
|
||||
/* $NetBSD: rbus_machdep.h,v 1.7 2007/01/12 20:34:09 gdt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999
|
||||
@ -46,4 +46,6 @@ struct pci_attach_args; /* XXX */
|
||||
rbus_tag_t rbus_pccbb_parent_io(struct pci_attach_args *);
|
||||
rbus_tag_t rbus_pccbb_parent_mem(struct pci_attach_args *);
|
||||
|
||||
void rbus_min_start_hint(size_t);
|
||||
|
||||
#endif /* _ARCH_I386_I386_RBUS_MACHDEP_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user