Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 97615
b: refs/heads/master
c: 282c454
h: refs/heads/master
i:
  97613: 54c2aad
  97611: c11370e
  97607: 0806917
  97599: 5194749
v: v3
  • Loading branch information
Venki Pallipadi authored and Thomas Gleixner committed Jun 4, 2008
1 parent 6897e71 commit c8f8390
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 511631011d39706ac81ee5e4c9084d61e5b4fd34
refs/heads/master: 282c454cd3a7041f59a37112bb2f82263bc38f6c
49 changes: 24 additions & 25 deletions trunk/arch/x86/mm/pat.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,32 +151,33 @@ static int pat_x_mtrr_type(u64 start, u64 end, unsigned long prot,
unsigned long pat_type;
u8 mtrr_type;

mtrr_type = mtrr_type_lookup(start, end);
if (mtrr_type == 0xFF) { /* MTRR not enabled */
*ret_prot = prot;
return 0;
}
if (mtrr_type == 0xFE) { /* MTRR match error */
*ret_prot = _PAGE_CACHE_UC;
return -1;
}
if (mtrr_type != MTRR_TYPE_UNCACHABLE &&
mtrr_type != MTRR_TYPE_WRBACK &&
mtrr_type != MTRR_TYPE_WRCOMB) { /* MTRR type unhandled */
*ret_prot = _PAGE_CACHE_UC;
return -1;
}

pat_type = prot & _PAGE_CACHE_MASK;
prot &= (~_PAGE_CACHE_MASK);

/* Currently doing intersection by hand. Optimize it later. */
/*
* We return the PAT request directly for types where PAT takes
* precedence with respect to MTRR and for UC_MINUS.
* Consistency checks with other PAT requests is done later
* while going through memtype list.
*/
if (pat_type == _PAGE_CACHE_WC) {
*ret_prot = prot | _PAGE_CACHE_WC;
return 0;
} else if (pat_type == _PAGE_CACHE_UC_MINUS) {
*ret_prot = prot | _PAGE_CACHE_UC_MINUS;
} else if (pat_type == _PAGE_CACHE_UC ||
mtrr_type == MTRR_TYPE_UNCACHABLE) {
return 0;
} else if (pat_type == _PAGE_CACHE_UC) {
*ret_prot = prot | _PAGE_CACHE_UC;
return 0;
}

/*
* Look for MTRR hint to get the effective type in case where PAT
* request is for WB.
*/
mtrr_type = mtrr_type_lookup(start, end);

if (mtrr_type == MTRR_TYPE_UNCACHABLE) {
*ret_prot = prot | _PAGE_CACHE_UC;
} else if (mtrr_type == MTRR_TYPE_WRCOMB) {
*ret_prot = prot | _PAGE_CACHE_WC;
Expand Down Expand Up @@ -233,14 +234,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,

if (req_type == -1) {
/*
* Special case where caller wants to inherit from mtrr or
* existing pat mapping, defaulting to UC_MINUS in case of
* no match.
* Call mtrr_lookup to get the type hint. This is an
* optimization for /dev/mem mmap'ers into WB memory (BIOS
* tools and ACPI tools). Use WB request for WB memory and use
* UC_MINUS otherwise.
*/
u8 mtrr_type = mtrr_type_lookup(start, end);
if (mtrr_type == 0xFE) { /* MTRR match error */
err = -1;
}

if (mtrr_type == MTRR_TYPE_WRBACK) {
req_type = _PAGE_CACHE_WB;
Expand Down

0 comments on commit c8f8390

Please sign in to comment.