projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dm: x86: baytrail: Correct PCI region 3 when driver model is used
[oweals/u-boot.git]
/
arch
/
x86
/
cpu
/
mtrr.c
diff --git
a/arch/x86/cpu/mtrr.c
b/arch/x86/cpu/mtrr.c
index d5a825d1815edbee282d4b12a7c90b4dedc3c09c..5d36b3e0204d63cd9a15d2829cd9c96d48100fe2 100644
(file)
--- a/
arch/x86/cpu/mtrr.c
+++ b/
arch/x86/cpu/mtrr.c
@@
-17,9
+17,14
@@
#include <asm/msr.h>
#include <asm/mtrr.h>
#include <asm/msr.h>
#include <asm/mtrr.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* Prepare to adjust MTRRs */
void mtrr_open(struct mtrr_state *state)
{
/* Prepare to adjust MTRRs */
void mtrr_open(struct mtrr_state *state)
{
+ if (!gd->arch.has_mtrr)
+ return;
+
state->enable_cache = dcache_status();
if (state->enable_cache)
state->enable_cache = dcache_status();
if (state->enable_cache)
@@
-31,6
+36,9
@@
void mtrr_open(struct mtrr_state *state)
/* Clean up after adjusting MTRRs, and enable them */
void mtrr_close(struct mtrr_state *state)
{
/* Clean up after adjusting MTRRs, and enable them */
void mtrr_close(struct mtrr_state *state)
{
+ if (!gd->arch.has_mtrr)
+ return;
+
wrmsrl(MTRR_DEF_TYPE_MSR, state->deftype | MTRR_DEF_TYPE_EN);
if (state->enable_cache)
enable_caches();
wrmsrl(MTRR_DEF_TYPE_MSR, state->deftype | MTRR_DEF_TYPE_EN);
if (state->enable_cache)
enable_caches();
@@
-43,6
+51,9
@@
int mtrr_commit(bool do_caches)
uint64_t mask;
int i;
uint64_t mask;
int i;
+ if (!gd->arch.has_mtrr)
+ return -ENOSYS;
+
mtrr_open(&state);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++) {
mask = ~(req->size - 1);
mtrr_open(&state);
for (i = 0; i < gd->arch.mtrr_req_count; i++, req++) {
mask = ~(req->size - 1);
@@
-64,6
+75,9
@@
int mtrr_add_request(int type, uint64_t start, uint64_t size)
struct mtrr_request *req;
uint64_t mask;
struct mtrr_request *req;
uint64_t mask;
+ if (!gd->arch.has_mtrr)
+ return -ENOSYS;
+
if (gd->arch.mtrr_req_count == MAX_MTRR_REQUESTS)
return -ENOSPC;
req = &gd->arch.mtrr_req[gd->arch.mtrr_req_count++];
if (gd->arch.mtrr_req_count == MAX_MTRR_REQUESTS)
return -ENOSPC;
req = &gd->arch.mtrr_req[gd->arch.mtrr_req_count++];