39 #include <linux/pci.h>
41 #include <asm/processor.h>
72 unsigned long pio2kbase, pio4kbase;
75 if (pio2kbase < pio4kbase) {
76 pioaddr = addr + pio2kbase;
77 piolen = pio4kbase - pio2kbase +
80 pioaddr = addr + pio4kbase;
81 piolen = pio2kbase - pio4kbase +
90 for (bits = 0; !(piolen & (1ULL <<
bits)); bits++)
93 if (piolen != (1ULL << bits)) {
97 piolen = 1ULL << (bits + 1);
99 if (pioaddr & (piolen - 1)) {
101 ipath_dbg(
"pioaddr %llx not on right boundary for size "
103 (
unsigned long long) pioaddr,
104 (
unsigned long long) piolen);
105 atmp = pioaddr & ~(piolen - 1);
106 if (atmp < addr || (atmp + piolen) > (addr + len)) {
108 "(%llx/%llx), no WC mtrr\n",
109 (
unsigned long long) atmp,
110 (
unsigned long long) piolen << 1);
113 ipath_dbg(
"changing WC base from %llx to %llx, "
114 "len from %llx to %llx\n",
115 (
unsigned long long) pioaddr,
116 (
unsigned long long) atmp,
117 (
unsigned long long) piolen,
118 (
unsigned long long) piolen << 1);
127 "(addr %llx, len=0x%llx)\n",
128 (
unsigned long long) pioaddr,
129 (
unsigned long long) piolen);
134 "mtrr_add() WC for PIO bufs "
141 "cookie is %d\n", cookie);
164 "mtrr_del(%lx, %lx, %lx) failed: %d\n",