The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/include/asm-mips64/mmzone.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
    3  */
    4 #ifndef _ASM_MMZONE_H_
    5 #define _ASM_MMZONE_H_
    6 
    7 #include <linux/config.h>
    8 #include <asm/sn/types.h>
    9 #include <asm/sn/addrs.h>
   10 #include <asm/sn/arch.h>
   11 #include <asm/sn/klkernvars.h>
   12 
   13 typedef struct plat_pglist_data {
   14         pg_data_t       gendata;
   15         kern_vars_t     kern_vars;
   16 } plat_pg_data_t;
   17 
   18 /*
   19  * Following are macros that are specific to this numa platform.
   20  */
   21 
   22 extern int numa_debug(void);
   23 extern plat_pg_data_t *plat_node_data[];
   24 
   25 #define PHYSADDR_TO_NID(pa)             NASID_TO_COMPACT_NODEID(NASID_GET(pa))
   26 #define PLAT_NODE_DATA(n)               (plat_node_data[n])
   27 #define PLAT_NODE_DATA_STARTNR(n)    (PLAT_NODE_DATA(n)->gendata.node_start_mapnr)
   28 #define PLAT_NODE_DATA_SIZE(n)       (PLAT_NODE_DATA(n)->gendata.node_size)
   29 #define PLAT_NODE_DATA_LOCALNR(p, n) \
   30                 (((p) - PLAT_NODE_DATA(n)->gendata.node_start_paddr) >> PAGE_SHIFT)
   31 
   32 #define numa_node_id()  cputocnode(current->processor)
   33 
   34 #ifdef CONFIG_DISCONTIGMEM
   35 
   36 /*
   37  * Following are macros that each numa implmentation must define.
   38  */
   39 
   40 /*
   41  * Given a kernel address, find the home node of the underlying memory.
   42  */
   43 #define KVADDR_TO_NID(kaddr) \
   44         ((NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr))) != -1) ? \
   45         (NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr)))) : \
   46         (printk("NUMABUG: %s line %d addr 0x%lx", __FILE__, __LINE__, kaddr), \
   47         numa_debug(), -1))
   48 
   49 /*
   50  * Return a pointer to the node data for node n.
   51  */
   52 #define NODE_DATA(n)    (&((PLAT_NODE_DATA(n))->gendata))
   53 
   54 /*
   55  * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
   56  */
   57 #define NODE_MEM_MAP(nid)       (NODE_DATA(nid)->node_mem_map)
   58 
   59 /*
   60  * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
   61  * and returns the mem_map of that node.
   62  */
   63 #define ADDR_TO_MAPBASE(kaddr) \
   64                         NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
   65 
   66 /*
   67  * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
   68  * and returns the kaddr corresponding to first physical page in the
   69  * node's mem_map.
   70  */
   71 #define LOCAL_BASE_ADDR(kaddr)  ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1))
   72 
   73 #define LOCAL_MAP_NR(kvaddr) \
   74         (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT)
   75 
   76 #define MIPS64_NR(kaddr) (((unsigned long)(kaddr) > (unsigned long)high_memory)\
   77                 ? (max_mapnr + 1) : (LOCAL_MAP_NR((kaddr)) + \
   78                 (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \
   79                 sizeof(mem_map_t))))
   80 
   81 #define kern_addr_valid(addr)   ((KVADDR_TO_NID((unsigned long)addr) > \
   82         -1) ? 0 : (test_bit(LOCAL_MAP_NR((addr)), \
   83         NODE_DATA(KVADDR_TO_NID((unsigned long)addr))->valid_addr_bitmap)))
   84 
   85 #define virt_to_page(kaddr)     (mem_map + MIPS64_NR(kaddr))
   86 #define VALID_PAGE(page)        ((page - mem_map) < max_mapnr)
   87 
   88 #endif /* CONFIG_DISCONTIGMEM */
   89 
   90 #endif /* _ASM_MMZONE_H_ */

Cache object: 8ccc1fd23466b9fd5de3c46a07f2b487


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.