aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utglobal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utglobal.c')
-rw-r--r--drivers/acpi/utilities/utglobal.c64
1 files changed, 35 insertions, 29 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 7f72839841ca..413e1dd8ae36 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -217,23 +217,23 @@ const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to 217 * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
218 * perform a Notify() operation on it. 218 * perform a Notify() operation on it.
219 */ 219 */
220const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = 220const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = {
221 { {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL}, 221 {"_GPE", ACPI_TYPE_LOCAL_SCOPE, NULL},
222{"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 222 {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL},
223{"_SB_", ACPI_TYPE_DEVICE, NULL}, 223 {"_SB_", ACPI_TYPE_DEVICE, NULL},
224{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, 224 {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
225{"_TZ_", ACPI_TYPE_THERMAL, NULL}, 225 {"_TZ_", ACPI_TYPE_THERMAL, NULL},
226{"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL}, 226 {"_REV", ACPI_TYPE_INTEGER, (char *)ACPI_CA_SUPPORT_LEVEL},
227{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, 227 {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
228{"_GL_", ACPI_TYPE_MUTEX, (char *)1}, 228 {"_GL_", ACPI_TYPE_MUTEX, (char *)1},
229 229
230#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) 230#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
231{"_OSI", ACPI_TYPE_METHOD, (char *)1}, 231 {"_OSI", ACPI_TYPE_METHOD, (char *)1},
232#endif 232#endif
233 233
234 /* Table terminator */ 234 /* Table terminator */
235 235
236{NULL, ACPI_TYPE_ANY, NULL} 236 {NULL, ACPI_TYPE_ANY, NULL}
237}; 237};
238 238
239/* 239/*
@@ -503,11 +503,13 @@ char *acpi_ut_get_region_name(u8 space_id)
503/* Event type decoding */ 503/* Event type decoding */
504 504
505static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { 505static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
506/*! [Begin] no source code translation (keep these strings as-is) */
506 "PM_Timer", 507 "PM_Timer",
507 "global_lock", 508 "GlobalLock",
508 "power_button", 509 "PowerButton",
509 "sleep_button", 510 "SleepButton",
510 "real_time_clock", 511 "RealTimeClock",
512/*! [End] no source code translation !*/
511}; 513};
512 514
513char *acpi_ut_get_event_name(u32 event_id) 515char *acpi_ut_get_event_name(u32 event_id)
@@ -545,12 +547,13 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
545/* Printable names of the ACPI object types */ 547/* Printable names of the ACPI object types */
546 548
547static const char *acpi_gbl_ns_type_names[] = { 549static const char *acpi_gbl_ns_type_names[] = {
550/*! [Begin] no source code translation (keep these strings as-is) */
548 /* 00 */ "Untyped", 551 /* 00 */ "Untyped",
549 /* 01 */ "Integer", 552 /* 01 */ "Integer",
550 /* 02 */ "String", 553 /* 02 */ "String",
551 /* 03 */ "Buffer", 554 /* 03 */ "Buffer",
552 /* 04 */ "Package", 555 /* 04 */ "Package",
553 /* 05 */ "field_unit", 556 /* 05 */ "FieldUnit",
554 /* 06 */ "Device", 557 /* 06 */ "Device",
555 /* 07 */ "Event", 558 /* 07 */ "Event",
556 /* 08 */ "Method", 559 /* 08 */ "Method",
@@ -559,23 +562,24 @@ static const char *acpi_gbl_ns_type_names[] = {
559 /* 11 */ "Power", 562 /* 11 */ "Power",
560 /* 12 */ "Processor", 563 /* 12 */ "Processor",
561 /* 13 */ "Thermal", 564 /* 13 */ "Thermal",
562 /* 14 */ "buffer_field", 565 /* 14 */ "BufferField",
563 /* 15 */ "ddb_handle", 566 /* 15 */ "DdbHandle",
564 /* 16 */ "debug_object", 567 /* 16 */ "DebugObject",
565 /* 17 */ "region_field", 568 /* 17 */ "RegionField",
566 /* 18 */ "bank_field", 569 /* 18 */ "BankField",
567 /* 19 */ "index_field", 570 /* 19 */ "IndexField",
568 /* 20 */ "Reference", 571 /* 20 */ "Reference",
569 /* 21 */ "Alias", 572 /* 21 */ "Alias",
570 /* 22 */ "method_alias", 573 /* 22 */ "MethodAlias",
571 /* 23 */ "Notify", 574 /* 23 */ "Notify",
572 /* 24 */ "addr_handler", 575 /* 24 */ "AddrHandler",
573 /* 25 */ "resource_desc", 576 /* 25 */ "ResourceDesc",
574 /* 26 */ "resource_fld", 577 /* 26 */ "ResourceFld",
575 /* 27 */ "Scope", 578 /* 27 */ "Scope",
576 /* 28 */ "Extra", 579 /* 28 */ "Extra",
577 /* 29 */ "Data", 580 /* 29 */ "Data",
578 /* 30 */ "Invalid" 581 /* 30 */ "Invalid"
582/*! [End] no source code translation !*/
579}; 583};
580 584
581char *acpi_ut_get_type_name(acpi_object_type type) 585char *acpi_ut_get_type_name(acpi_object_type type)
@@ -658,15 +662,16 @@ char *acpi_ut_get_node_name(void *object)
658/* Printable names of object descriptor types */ 662/* Printable names of object descriptor types */
659 663
660static const char *acpi_gbl_desc_type_names[] = { 664static const char *acpi_gbl_desc_type_names[] = {
665/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
661 /* 00 */ "Invalid", 666 /* 00 */ "Invalid",
662 /* 01 */ "Cached", 667 /* 01 */ "Cached",
663 /* 02 */ "State-Generic", 668 /* 02 */ "State-Generic",
664 /* 03 */ "State-Update", 669 /* 03 */ "State-Update",
665 /* 04 */ "State-Package", 670 /* 04 */ "State-Package",
666 /* 05 */ "State-Control", 671 /* 05 */ "State-Control",
667 /* 06 */ "State-root_parse_scope", 672 /* 06 */ "State-RootParseScope",
668 /* 07 */ "State-parse_scope", 673 /* 07 */ "State-ParseScope",
669 /* 08 */ "State-walk_scope", 674 /* 08 */ "State-WalkScope",
670 /* 09 */ "State-Result", 675 /* 09 */ "State-Result",
671 /* 10 */ "State-Notify", 676 /* 10 */ "State-Notify",
672 /* 11 */ "State-Thread", 677 /* 11 */ "State-Thread",
@@ -674,6 +679,7 @@ static const char *acpi_gbl_desc_type_names[] = {
674 /* 13 */ "Parser", 679 /* 13 */ "Parser",
675 /* 14 */ "Operand", 680 /* 14 */ "Operand",
676 /* 15 */ "Node" 681 /* 15 */ "Node"
682/*! [End] no source code translation !*/
677}; 683};
678 684
679char *acpi_ut_get_descriptor_name(void *object) 685char *acpi_ut_get_descriptor_name(void *object)
c"> /* * User and Kernel pagetables are identical */ #define _PAGE_TABLE _PAGE_TABLE_LEN #define _KERNPG_TABLE _PAGE_TABLE_LEN /* * The Kernel segment-tables includes the User segment-table */ #define _SEGMENT_TABLE (_USER_SEG_TABLE_LEN|0x80000000|0x100) #define _KERNSEG_TABLE _KERNEL_SEG_TABLE_LEN #define USER_STD_MASK 0x00000080UL #else /* __s390x__ */ /* Bits in the segment table entry */ #define _PMD_ENTRY_INV 0x20 /* invalid segment table entry */ #define _PMD_ENTRY 0x00 /* Bits in the region third table entry */ #define _PGD_ENTRY_INV 0x20 /* invalid region table entry */ #define _PGD_ENTRY 0x07 /* * User and kernel page directory */ #define _REGION_THIRD 0x4 #define _REGION_THIRD_LEN 0x3 #define _REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100) #define _KERN_REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN) #define USER_STD_MASK 0x0000000000000080UL /* Bits in the storage key */ #define _PAGE_CHANGED 0x02 /* HW changed bit */ #define _PAGE_REFERENCED 0x04 /* HW referenced bit */ #endif /* __s390x__ */ /* * Page protection definitions. */ #define PAGE_NONE __pgprot(_PAGE_TYPE_NONE) #define PAGE_RO __pgprot(_PAGE_TYPE_RO) #define PAGE_RW __pgprot(_PAGE_TYPE_RW) #define PAGE_EX_RO __pgprot(_PAGE_TYPE_EX_RO) #define PAGE_EX_RW __pgprot(_PAGE_TYPE_EX_RW) #define PAGE_KERNEL PAGE_RW #define PAGE_COPY PAGE_RO /* * Dependent on the EXEC_PROTECT option s390 can do execute protection. * Write permission always implies read permission. In theory with a * primary/secondary page table execute only can be implemented but * it would cost an additional bit in the pte to distinguish all the * different pte types. To avoid that execute permission currently * implies read permission as well. */ /*xwr*/ #define __P000 PAGE_NONE #define __P001 PAGE_RO #define __P010 PAGE_RO #define __P011 PAGE_RO #define __P100 PAGE_EX_RO #define __P101 PAGE_EX_RO #define __P110 PAGE_EX_RO #define __P111 PAGE_EX_RO #define __S000 PAGE_NONE #define __S001 PAGE_RO #define __S010 PAGE_RW #define __S011 PAGE_RW #define __S100 PAGE_EX_RO #define __S101 PAGE_EX_RO #define __S110 PAGE_EX_RW #define __S111 PAGE_EX_RW #ifndef __s390x__ # define PMD_SHADOW_SHIFT 1 # define PGD_SHADOW_SHIFT 1 #else /* __s390x__ */ # define PMD_SHADOW_SHIFT 2 # define PGD_SHADOW_SHIFT 2 #endif /* __s390x__ */ static inline struct page *get_shadow_page(struct page *page) { if (s390_noexec && !list_empty(&page->lru)) return virt_to_page(page->lru.next); return NULL; } static inline pte_t *get_shadow_pte(pte_t *ptep) { unsigned long pteptr = (unsigned long) (ptep); if (s390_noexec) { unsigned long offset = pteptr & (PAGE_SIZE - 1); void *addr = (void *) (pteptr ^ offset); struct page *page = virt_to_page(addr); if (!list_empty(&page->lru)) return (pte_t *) ((unsigned long) page->lru.next | offset); } return NULL; } static inline pmd_t *get_shadow_pmd(pmd_t *pmdp) { unsigned long pmdptr = (unsigned long) (pmdp); if (s390_noexec) { unsigned long offset = pmdptr & ((PAGE_SIZE << PMD_SHADOW_SHIFT) - 1); void *addr = (void *) (pmdptr ^ offset); struct page *page = virt_to_page(addr); if (!list_empty(&page->lru)) return (pmd_t *) ((unsigned long) page->lru.next | offset); } return NULL; } static inline pgd_t *get_shadow_pgd(pgd_t *pgdp) { unsigned long pgdptr = (unsigned long) (pgdp); if (s390_noexec) { unsigned long offset = pgdptr & ((PAGE_SIZE << PGD_SHADOW_SHIFT) - 1); void *addr = (void *) (pgdptr ^ offset); struct page *page = virt_to_page(addr); if (!list_empty(&page->lru)) return (pgd_t *) ((unsigned long) page->lru.next | offset); } return NULL; } /* * Certain architectures need to do special things when PTEs * within a page table are directly modified. Thus, the following * hook is made available. */ static inline void set_pte(pte_t *pteptr, pte_t pteval) { pte_t *shadow_pte = get_shadow_pte(pteptr); *pteptr = pteval; if (shadow_pte) { if (!(pte_val(pteval) & _PAGE_INVALID) && (pte_val(pteval) & _PAGE_SWX)) pte_val(*shadow_pte) = pte_val(pteval) | _PAGE_RO; else pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY; } } #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) /* * pgd/pmd/pte query functions */ #ifndef __s390x__ static inline int pgd_present(pgd_t pgd) { return 1; } static inline int pgd_none(pgd_t pgd) { return 0; } static inline int pgd_bad(pgd_t pgd) { return 0; } static inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _SEG_PRESENT; } static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PAGE_TABLE_INV; } static inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE; } #else /* __s390x__ */ static inline int pgd_present(pgd_t pgd) { return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY; } static inline int pgd_none(pgd_t pgd) { return pgd_val(pgd) & _PGD_ENTRY_INV; } static inline int pgd_bad(pgd_t pgd) { return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY; } static inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY; } static inline int pmd_none(pmd_t pmd) { return pmd_val(pmd) & _PMD_ENTRY_INV; } static inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY; } #endif /* __s390x__ */ static inline int pte_none(pte_t pte) { return (pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT); } static inline int pte_present(pte_t pte) { unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT | _PAGE_SWX; return (pte_val(pte) & mask) == _PAGE_TYPE_NONE || (!(pte_val(pte) & _PAGE_INVALID) && !(pte_val(pte) & _PAGE_SWT)); } static inline int pte_file(pte_t pte) { unsigned long mask = _PAGE_RO | _PAGE_INVALID | _PAGE_SWT; return (pte_val(pte) & mask) == _PAGE_TYPE_FILE; } #define pte_same(a,b) (pte_val(a) == pte_val(b)) /* * query functions pte_write/pte_dirty/pte_young only work if * pte_present() is true. Undefined behaviour if not.. */ static inline int pte_write(pte_t pte) { return (pte_val(pte) & _PAGE_RO) == 0; } static inline int pte_dirty(pte_t pte) { /* A pte is neither clean nor dirty on s/390. The dirty bit * is in the storage key. See page_test_and_clear_dirty for * details. */ return 0; } static inline int pte_young(pte_t pte) { /* A pte is neither young nor old on s/390. The young bit * is in the storage key. See page_test_and_clear_young for * details. */ return 0; } static inline int pte_read(pte_t pte) { /* All pages are readable since we don't use the fetch * protection bit in the storage key. */ return 1; } /* * pgd/pmd/pte modification functions */ #ifndef __s390x__ static inline void pgd_clear(pgd_t * pgdp) { } static inline void pmd_clear_kernel(pmd_t * pmdp) { pmd_val(pmdp[0]) = _PAGE_TABLE_INV; pmd_val(pmdp[1]) = _PAGE_TABLE_INV; pmd_val(pmdp[2]) = _PAGE_TABLE_INV; pmd_val(pmdp[3]) = _PAGE_TABLE_INV; } static inline void pmd_clear(pmd_t * pmdp) { pmd_t *shadow_pmd = get_shadow_pmd(pmdp); pmd_clear_kernel(pmdp); if (shadow_pmd) pmd_clear_kernel(shadow_pmd); } #else /* __s390x__ */ static inline void pgd_clear_kernel(pgd_t * pgdp) { pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY; } static inline void pgd_clear(pgd_t * pgdp) { pgd_t *shadow_pgd = get_shadow_pgd(pgdp); pgd_clear_kernel(pgdp); if (shadow_pgd) pgd_clear_kernel(shadow_pgd); } static inline void pmd_clear_kernel(pmd_t * pmdp) { pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY; } static inline void pmd_clear(pmd_t * pmdp) { pmd_t *shadow_pmd = get_shadow_pmd(pmdp); pmd_clear_kernel(pmdp); if (shadow_pmd) pmd_clear_kernel(shadow_pmd); } #endif /* __s390x__ */ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t *shadow_pte = get_shadow_pte(ptep); pte_val(*ptep) = _PAGE_TYPE_EMPTY; if (shadow_pte) pte_val(*shadow_pte) = _PAGE_TYPE_EMPTY; } /* * The following pte modification functions only work if * pte_present() is true. Undefined behaviour if not.. */ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { pte_val(pte) &= PAGE_MASK; pte_val(pte) |= pgprot_val(newprot); return pte; } static inline pte_t pte_wrprotect(pte_t pte) { /* Do not clobber _PAGE_TYPE_NONE pages! */ if (!(pte_val(pte) & _PAGE_INVALID)) pte_val(pte) |= _PAGE_RO; return pte; } static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_RO; return pte; } static inline pte_t pte_mkclean(pte_t pte) { /* The only user of pte_mkclean is the fork() code. We must *not* clear the *physical* page dirty bit just because fork() wants to clear the dirty bit in *one* of the page's mappings. So we just do nothing. */ return pte; } static inline pte_t pte_mkdirty(pte_t pte) { /* We do not explicitly set the dirty bit because the * sske instruction is slow. It is faster to let the * next instruction set the dirty bit. */ return pte; } static inline pte_t pte_mkold(pte_t pte) { /* S/390 doesn't keep its dirty/referenced bit in the pte. * There is no point in clearing the real referenced bit. */ return pte; } static inline pte_t pte_mkyoung(pte_t pte) { /* S/390 doesn't keep its dirty/referenced bit in the pte. * There is no point in setting the real referenced bit. */ return pte; } static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { return 0; } static inline int ptep_clear_flush_young(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { /* No need to flush TLB; bits are in storage key */ return ptep_test_and_clear_young(vma, address, ptep); } static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) { return 0; } static inline int ptep_clear_flush_dirty(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { /* No need to flush TLB; bits are in storage key */ return ptep_test_and_clear_dirty(vma, address, ptep); } static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t pte = *ptep; pte_clear(mm, addr, ptep); return pte; } static inline void __ptep_ipte(unsigned long address, pte_t *ptep) { if (!(pte_val(*ptep) & _PAGE_INVALID)) { #ifndef __s390x__ /* S390 has 1mb segments, we are emulating 4MB segments */ pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); #else /* ipte in zarch mode can do the math */ pte_t *pto = ptep; #endif asm volatile( " ipte %2,%3" : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address)); } pte_val(*ptep) = _PAGE_TYPE_EMPTY; } static inline pte_t ptep_clear_flush(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { pte_t pte = *ptep; pte_t *shadow_pte = get_shadow_pte(ptep); __ptep_ipte(address, ptep); if (shadow_pte) __ptep_ipte(address, shadow_pte); return pte; } static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t old_pte = *ptep; set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); } static inline void ptep_establish(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry) { ptep_clear_flush(vma, address, ptep); set_pte(ptep, entry); } #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ ptep_establish(__vma, __address, __ptep, __entry) /* * Test and clear dirty bit in storage key. * We can't clear the changed bit atomically. This is a potential * race against modification of the referenced bit. This function * should therefore only be called if it is not mapped in any * address space. */ static inline int page_test_dirty(struct page *page) { return (page_get_storage_key(page_to_phys(page)) & _PAGE_CHANGED) != 0; } static inline void page_clear_dirty(struct page *page) { page_set_storage_key(page_to_phys(page), PAGE_DEFAULT_KEY); } /* * Test and clear referenced bit in storage key. */ static inline int page_test_and_clear_young(struct page *page) { unsigned long physpage = page_to_phys(page); int ccode; asm volatile( " rrbe 0,%1\n" " ipm %0\n" " srl %0,28\n" : "=d" (ccode) : "a" (physpage) : "cc" ); return ccode & 2; } /* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot) { pte_t __pte; pte_val(__pte) = physpage + pgprot_val(pgprot); return __pte; } static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) { unsigned long physpage = page_to_phys(page); return mk_pte_phys(physpage, pgprot); } static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) { unsigned long physpage = __pa((pfn) << PAGE_SHIFT); return mk_pte_phys(physpage, pgprot); } #ifdef __s390x__ static inline pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot) { unsigned long physpage = __pa((pfn) << PAGE_SHIFT); return __pmd(physpage + pgprot_val(pgprot)); } #endif /* __s390x__ */ #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) #define pte_page(x) pfn_to_page(pte_pfn(x)) #define pmd_page_vaddr(pmd) (pmd_val(pmd) & PAGE_MASK) #define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT) #define pgd_page_vaddr(pgd) (pgd_val(pgd) & PAGE_MASK) #define pgd_page(pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT) /* to find an entry in a page-table-directory */ #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) /* to find an entry in a kernel page-table-directory */ #define pgd_offset_k(address) pgd_offset(&init_mm, address) #ifndef __s390x__ /* Find an entry in the second-level page table.. */ static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address) { return (pmd_t *) dir; } #else /* __s390x__ */ /* Find an entry in the second-level page table.. */ #define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) #define pmd_offset(dir,addr) \ ((pmd_t *) pgd_page_vaddr(*(dir)) + pmd_index(addr)) #endif /* __s390x__ */ /* Find an entry in the third-level page table.. */ #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) #define pte_offset_kernel(pmd, address) \ ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) #define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address) #define pte_unmap(pte) do { } while (0) #define pte_unmap_nested(pte) do { } while (0) /* * 31 bit swap entry format: * A page-table entry has some bits we have to treat in a special way. * Bits 0, 20 and bit 23 have to be zero, otherwise an specification * exception will occur instead of a page translation exception. The * specifiation exception has the bad habit not to store necessary * information in the lowcore. * Bit 21 and bit 22 are the page invalid bit and the page protection * bit. We set both to indicate a swapped page. * Bit 30 and 31 are used to distinguish the different page types. For * a swapped page these bits need to be zero. * This leaves the bits 1-19 and bits 24-29 to store type and offset. * We use the 5 bits from 25-29 for the type and the 20 bits from 1-19 * plus 24 for the offset. * 0| offset |0110|o|type |00| * 0 0000000001111111111 2222 2 22222 33 * 0 1234567890123456789 0123 4 56789 01 * * 64 bit swap entry format: * A page-table entry has some bits we have to treat in a special way. * Bits 52 and bit 55 have to be zero, otherwise an specification * exception will occur instead of a page translation exception. The * specifiation exception has the bad habit not to store necessary * information in the lowcore. * Bit 53 and bit 54 are the page invalid bit and the page protection * bit. We set both to indicate a swapped page. * Bit 62 and 63 are used to distinguish the different page types. For * a swapped page these bits need to be zero. * This leaves the bits 0-51 and bits 56-61 to store type and offset. * We use the 5 bits from 57-61 for the type and the 53 bits from 0-51 * plus 56 for the offset. * | offset |0110|o|type |00| * 0000000000111111111122222222223333333333444444444455 5555 5 55566 66 * 0123456789012345678901234567890123456789012345678901 2345 6 78901 23 */ #ifndef __s390x__ #define __SWP_OFFSET_MASK (~0UL >> 12) #else #define __SWP_OFFSET_MASK (~0UL >> 11) #endif static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) { pte_t pte; offset &= __SWP_OFFSET_MASK; pte_val(pte) = _PAGE_TYPE_SWAP | ((type & 0x1f) << 2) | ((offset & 1UL) << 7) | ((offset & ~1UL) << 11); return pte; } #define __swp_type(entry) (((entry).val >> 2) & 0x1f) #define __swp_offset(entry) (((entry).val >> 11) | (((entry).val >> 7) & 1)) #define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) }) #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) #ifndef __s390x__ # define PTE_FILE_MAX_BITS 26 #else /* __s390x__ */ # define PTE_FILE_MAX_BITS 59 #endif /* __s390x__ */ #define pte_to_pgoff(__pte) \ ((((__pte).pte >> 12) << 7) + (((__pte).pte >> 1) & 0x7f)) #define pgoff_to_pte(__off) \ ((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \ | _PAGE_TYPE_FILE }) #endif /* !__ASSEMBLY__ */ #define kern_addr_valid(addr) (1) extern int add_shared_memory(unsigned long start, unsigned long size); extern int remove_shared_memory(unsigned long start, unsigned long size); /* * No page table caches to initialise */ #define pgtable_cache_init() do { } while (0) #define __HAVE_ARCH_MEMMAP_INIT extern void memmap_init(unsigned long, int, unsigned long, unsigned long); #define __HAVE_ARCH_PTEP_ESTABLISH #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY #define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH #define __HAVE_ARCH_PTEP_GET_AND_CLEAR #define __HAVE_ARCH_PTEP_CLEAR_FLUSH #define __HAVE_ARCH_PTEP_SET_WRPROTECT #define __HAVE_ARCH_PTE_SAME #define __HAVE_ARCH_PAGE_TEST_DIRTY #define __HAVE_ARCH_PAGE_CLEAR_DIRTY #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG #include <asm-generic/pgtable.h> #endif /* _S390_PAGE_H */