/* * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2000 Silicon Graphics, Inc. * Copyright (C) 2000 by Jack Steiner (steiner@sgi.com) */ /* * 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 * klconfig to efi_memmap */ #include #include "fpmem.h" /* * args points to a layout in memory like this * * 32 bit 32 bit * * numnodes numcpus * * 16 bit 16 bit 32 bit * nasid0 cpuconf membankdesc0 * nasid1 cpuconf membankdesc1 * . * . * . * . * . */ sn_memmap_t *sn_memmap ; sn_config_t *sn_config ; /* * There is a hole in the node 0 address space. Dont put it * in the memory map */ #define NODE0_HOLE_SIZE (20*MB) #define NODE0_HOLE_END (4UL*GB) #define MB (1024*1024) #define GB (1024*MB) #define KERNEL_SIZE (4*MB) #define PROMRESERVED_SIZE (1*MB) #define MD_BANK_SHFT 30 #define TO_NODE(_n, _x) (((long)_n<<33L) | (long)_x) /* * For SN, this may not take an arg and gets the numnodes from * the prom variable or by traversing klcfg or promcfg */ int GetNumNodes(void) { return sn_config->nodes; } int GetNumCpus(void) { return sn_config->cpus; } /* For SN1, get the index th nasid */ int GetNasid(int index) { return sn_memmap[index].nasid ; } node_memmap_t GetMemBankInfo(int index) { return sn_memmap[index].node_memmap ; } int IsCpuPresent(int cnode, int cpu) { return sn_memmap[cnode].cpuconfig & (1<type = type; md->phys_addr = paddr; md->virt_addr = 0; md->num_pages = numbytes >> 12; md->attribute = EFI_MEMORY_WB; } int build_efi_memmap(void *md, int mdsize) { int numnodes = GetNumNodes() ; int cnode,bank ; int nasid ; node_memmap_t membank_info ; int bsize; int count = 0 ; long paddr, hole, numbytes; for (cnode=0;cnode