Import code from FreeBSD to tell the controller how much physical RAM the
system has. This has the (scary-because-we've-been-running-so-long- without-it) commit message (for the first version of the change): Tell the controller how much physical memory we have. Without this there was a chance that our DMA regions would collide with the memory window used by the cache on the controller. The result would be massive data corruption. This seemed to mainly affect systems with >2GB of memory.
This commit is contained in:
parent
8c4b63fb77
commit
a21419937e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aac.c,v 1.31 2007/05/24 15:07:47 briggs Exp $ */
|
||||
/* $NetBSD: aac.c,v 1.32 2007/05/26 12:45:02 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.31 2007/05/24 15:07:47 briggs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.32 2007/05/26 12:45:02 briggs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -509,7 +509,17 @@ aac_init(struct aac_softc *sc)
|
||||
offsetof(struct aac_common, ac_printf));
|
||||
ip->PrintfBufferSize = htole32(AAC_PRINTF_BUFSIZE);
|
||||
|
||||
ip->HostPhysMemPages = 0; /* not used? */
|
||||
/*
|
||||
* The adapter assumes that pages are 4K in size, except on some
|
||||
* broken firmware versions that do the page->byte conversion twice,
|
||||
* therefore 'assuming' that this value is in 16MB units (2^24).
|
||||
* Round up since the granularity is so high.
|
||||
*/
|
||||
ip->HostPhysMemPages = ctob(physmem) / AAC_PAGE_SIZE;
|
||||
if (sc->sc_quirks & AAC_QUIRK_BROKEN_MMAP) {
|
||||
ip->HostPhysMemPages =
|
||||
(ip->HostPhysMemPages + AAC_PAGE_SIZE) / AAC_PAGE_SIZE;
|
||||
}
|
||||
ip->HostElapsedSeconds = 0; /* reset later if invalid */
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aacreg.h,v 1.7 2007/05/26 02:09:40 briggs Exp $ */
|
||||
/* $NetBSD: aacreg.h,v 1.8 2007/05/26 12:45:08 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
|
||||
@ -151,10 +151,7 @@ struct aac_queue_table {
|
||||
*/
|
||||
struct aac_adapter_init {
|
||||
u_int32_t InitStructRevision;
|
||||
#define AAC_INIT_STRUCT_REVISION 3
|
||||
#define AAC_INIT_STRUCT_REVISION_4 4
|
||||
u_int32_t MiniPortRevision;
|
||||
#define AAC_INIT_STRUCT_MINIPORT_REVISION 1
|
||||
u_int32_t FilesystemRevision;
|
||||
u_int32_t CommHeaderAddress;
|
||||
u_int32_t FastIoCommAreaAddress;
|
||||
@ -168,12 +165,17 @@ struct aac_adapter_init {
|
||||
u_int32_t HostElapsedSeconds;
|
||||
/* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
|
||||
u_int32_t InitFlags; /* flags for supported features */
|
||||
#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1
|
||||
u_int32_t MaxIoCommands; /* max outstanding commands */
|
||||
u_int32_t MaxIoSize; /* largest I/O command */
|
||||
u_int32_t MaxFibSize; /* largest FIB to adapter */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define AAC_INIT_STRUCT_REVISION 3
|
||||
#define AAC_INIT_STRUCT_REVISION_4 4
|
||||
#define AAC_INIT_STRUCT_MINIPORT_REVISION 1
|
||||
#define AAC_INITFLAGS_NEW_COMM_SUPPORTED 1
|
||||
#define AAC_PAGE_SIZE 4096 /* Used to set HostPhysMemPages */
|
||||
|
||||
/*
|
||||
* Shared data types
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user