summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorAriane van der Steldt <ariane@cvs.openbsd.org>2009-04-20 13:26:21 +0000
committerAriane van der Steldt <ariane@cvs.openbsd.org>2009-04-20 13:26:21 +0000
commit766a3b0775f071fc90f4d5596ea776418758a129 (patch)
treeaa233740981712afd1331ee174926dea4353b911 /sys/arch/amd64/include
parenteb6f96e5e437015a36d400dab7888625c8044243 (diff)
amas device for amd64, describes the physical memory layout on AMD64 CPU.
Replaces pchb with amas for the AMD64 address map. amas0 at pci0 dev 24 function 1 "AMD AMD64 0Fh Address Map" rev 0x00 Currently disabled (causing pchb to attach instead). ok art@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/amas.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/sys/arch/amd64/include/amas.h b/sys/arch/amd64/include/amas.h
new file mode 100644
index 00000000000..ab5b90b942e
--- /dev/null
+++ b/sys/arch/amd64/include/amas.h
@@ -0,0 +1,82 @@
+/* $OpenBSD: amas.h,v 1.1 2009/04/20 13:26:20 ariane Exp $ */
+
+/*
+ * Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Device: amas (AMD memory access/address switch).
+ *
+ * Driver for the amd athlon/opteron 64 address map.
+ * This device is integrated in 64-bit Athlon and Opteron cpus
+ * and contains mappings for memory to processor nodes.
+ *
+ * The AMD cpu can access memory in two ways: interleaved and non-interleaved.
+ *
+ * In interleaved mode, 16 MB regions are rotated across each node,
+ * example for 2 nodes:
+ * - region 0 (0-16 MB) on node 0.
+ * - region 1 (16-32 MB) on node 1.
+ * - region 2 (33-48 MB) on node 0.
+ * - region 3 (48-64 MB) on node 1.
+ * ...
+ * - region 2 * N on node 0.
+ * - region 2 * N + 1 on node 1.
+ * Interleaved mode requires that each node has the same amount of physical
+ * memory.
+ *
+ * In non-interleaved mode, memory for each node is a continuous address space,
+ * example for 2 nodes:
+ * - region 0 (all memory on CPU package 0) on node 0.
+ * - region 1 (all memory on CPU package 1) on node 1.
+ * Non-interleaved mode requires either that each node has the same amount of
+ * physical memory or that memory holes are allowed between each node.
+ *
+ * Configuring memory for interleaved or non-interleaved mode is handled by
+ * the BIOS.
+ */
+
+#ifndef _MACHINE_AMAS_H_
+#define _MACHINE_AMAS_H_
+
+#include <sys/types.h>
+#include <sys/device.h>
+
+#include <dev/pci/pcivar.h>
+
+#ifdef _KERNEL
+
+#define AMAS_MAX_NODES (8) /* AMAS supports 8 nodes at maximum. */
+
+/* Device configuration. */
+struct amas_softc {
+ struct device sc_dev;
+ /* PCI location of this device. */
+ pcitag_t pa_tag;
+ pci_chipset_tag_t pa_pc;
+ int family;
+};
+
+/* AMAS driver. */
+extern struct cfdriver amas_cd;
+
+int amas_match(struct device*, void*, void*);
+void amas_attach(struct device*, struct device*, void*);
+
+int amas_intl_nodes(struct amas_softc*);
+void amas_get_pagerange(struct amas_softc*, int node, paddr_t*, paddr_t*);
+
+#endif /* _KERNEL */
+#endif /* _MACHINE_AMAS_H_ */