patch-2.4.22 linux-2.4.22/arch/ia64/sn/fakeprom/fpmem.c
Next file: linux-2.4.22/arch/ia64/sn/fakeprom/fpmem.h
Previous file: linux-2.4.22/arch/ia64/sn/fakeprom/README
Back to the patch index
Back to the overall index
- Lines: 159
- Date:
2003-08-25 04:44:39.000000000 -0700
- Orig file:
linux-2.4.21/arch/ia64/sn/fakeprom/fpmem.c
- Orig date:
2003-06-13 07:51:30.000000000 -0700
diff -urN linux-2.4.21/arch/ia64/sn/fakeprom/fpmem.c linux-2.4.22/arch/ia64/sn/fakeprom/fpmem.c
@@ -4,7 +4,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 2000-2002 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
*/
@@ -13,7 +13,7 @@
* FPROM EFI memory descriptor build routines
*
* - Routines to build the EFI memory descriptor map
- * - Should also be usable by the SGI SN1 prom to convert
+ * - Should also be usable by the SGI prom to convert
* klconfig to efi_memmap
*/
@@ -53,10 +53,7 @@
#define KERNEL_SIZE (4*MB)
#define PROMRESERVED_SIZE (1*MB)
-#ifdef CONFIG_IA64_SGI_SN1
-#define PHYS_ADDRESS(_n, _x) (((long)_n<<33) | (long)_x)
-#define MD_BANK_SHFT 30
-#else
+#ifdef SGI_SN2
#define PHYS_ADDRESS(_n, _x) (((long)_n<<38) | (long)_x | 0x3000000000UL)
#define MD_BANK_SHFT 34
#endif
@@ -77,7 +74,7 @@
return sn_config->cpus;
}
-/* For SN1, get the index th nasid */
+/* For SN, get the index th nasid */
int
GetNasid(int index)
@@ -104,40 +101,7 @@
* actually disabled etc.
*/
-#ifdef CONFIG_IA64_SGI_SN1
-int
-IsBankPresent(int index, node_memmap_t nmemmap)
-{
- switch (index) {
- case 0:return nmemmap.b0;
- case 1:return nmemmap.b1;
- case 2:return nmemmap.b2;
- case 3:return nmemmap.b3;
- case 4:return nmemmap.b4;
- case 5:return nmemmap.b5;
- case 6:return nmemmap.b6;
- case 7:return nmemmap.b7;
- default:return -1 ;
- }
-}
-
-int
-GetBankSize(int index, node_memmap_t nmemmap)
-{
- switch (index) {
- case 0:
- case 1:return nmemmap.b01size;
- case 2:
- case 3:return nmemmap.b23size;
- case 4:
- case 5:return nmemmap.b45size;
- case 6:
- case 7:return nmemmap.b67size;
- default:return -1 ;
- }
-}
-
-#else
+#ifdef SGI_SN2
int
IsBankPresent(int index, node_memmap_t nmemmap)
{
@@ -168,13 +132,13 @@
#endif
void
-build_mem_desc(efi_memory_desc_t *md, int type, long paddr, long numbytes)
+build_mem_desc(efi_memory_desc_t *md, int type, long paddr, long numbytes, long attr)
{
md->type = type;
md->phys_addr = paddr;
md->virt_addr = 0;
md->num_pages = numbytes >> 12;
- md->attribute = EFI_MEMORY_WB;
+ md->attribute = attr;
}
int
@@ -192,12 +156,12 @@
for (cnode=0;cnode<numnodes;cnode++) {
nasid = GetNasid(cnode) ;
membank_info = GetMemBankInfo(cnode) ;
- for (bank=0;bank<PLAT_CLUMPS_PER_NODE;bank++) {
+ for (bank=0;bank<MD_BANKS_PER_NODE;bank++) {
if (IsBankPresent(bank, membank_info)) {
bsize = GetBankSize(bank, membank_info) ;
paddr = PHYS_ADDRESS(nasid, (long)bank<<MD_BANK_SHFT);
numbytes = BankSizeBytes(bsize);
-#ifdef CONFIG_IA64_SGI_SN2
+#ifdef SGI_SN2
/*
* Ignore directory.
* Shorten memory chunk by 1 page - makes a better
@@ -236,28 +200,40 @@
*/
if (bank == 0) {
if (cnode == 0) {
+ hole = 2*1024*1024;
+ build_mem_desc(md, EFI_PAL_CODE, paddr, hole, EFI_MEMORY_WB|EFI_MEMORY_WB);
+ numbytes -= hole;
+ paddr += hole;
+ count++ ;
+ md += mdsize;
hole = 1*1024*1024;
- build_mem_desc(md, EFI_PAL_CODE, paddr, hole);
+ build_mem_desc(md, EFI_CONVENTIONAL_MEMORY, paddr, hole, EFI_MEMORY_UC);
numbytes -= hole;
paddr += hole;
count++ ;
md += mdsize;
- hole = 3*1024*1024;
- build_mem_desc(md, EFI_RUNTIME_SERVICES_DATA, paddr, hole);
+ hole = 1*1024*1024;
+ build_mem_desc(md, EFI_RUNTIME_SERVICES_DATA, paddr, hole, EFI_MEMORY_WB|EFI_MEMORY_WB);
numbytes -= hole;
paddr += hole;
count++ ;
md += mdsize;
} else {
- hole = PROMRESERVED_SIZE;
- build_mem_desc(md, EFI_RUNTIME_SERVICES_DATA, paddr, hole);
+ hole = 2*1024*1024;
+ build_mem_desc(md, EFI_RUNTIME_SERVICES_DATA, paddr, hole, EFI_MEMORY_WB|EFI_MEMORY_WB);
+ numbytes -= hole;
+ paddr += hole;
+ count++ ;
+ md += mdsize;
+ hole = 2*1024*1024;
+ build_mem_desc(md, EFI_RUNTIME_SERVICES_DATA, paddr, hole, EFI_MEMORY_UC);
numbytes -= hole;
paddr += hole;
count++ ;
md += mdsize;
}
}
- build_mem_desc(md, EFI_CONVENTIONAL_MEMORY, paddr, numbytes);
+ build_mem_desc(md, EFI_CONVENTIONAL_MEMORY, paddr, numbytes, EFI_MEMORY_WB|EFI_MEMORY_WB);
md += mdsize ;
count++ ;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)