amd.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) amd.c (f8bd9f25c9815161a39886fdd96d110b536a6074)
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/init.h>
3#include <linux/mm.h>
4#include <asm/mtrr.h>
5#include <asm/msr.h>
6
7#include "mtrr.h"
8

--- 95 unchanged lines hidden (view full) ---

104 * o base suitably aligned to the power
105 */
106 if (type > MTRR_TYPE_WRCOMB || size < (1 << (17 - PAGE_SHIFT))
107 || (size & ~(size - 1)) - size || (base & (size - 1)))
108 return -EINVAL;
109 return 0;
110}
111
1// SPDX-License-Identifier: GPL-2.0
2#include <linux/init.h>
3#include <linux/mm.h>
4#include <asm/mtrr.h>
5#include <asm/msr.h>
6
7#include "mtrr.h"
8

--- 95 unchanged lines hidden (view full) ---

104 * o base suitably aligned to the power
105 */
106 if (type > MTRR_TYPE_WRCOMB || size < (1 << (17 - PAGE_SHIFT))
107 || (size & ~(size - 1)) - size || (base & (size - 1)))
108 return -EINVAL;
109 return 0;
110}
111
112static const struct mtrr_ops amd_mtrr_ops = {
112const struct mtrr_ops amd_mtrr_ops = {
113 .vendor = X86_VENDOR_AMD,
114 .set = amd_set_mtrr,
115 .get = amd_get_mtrr,
116 .get_free_region = generic_get_free_region,
117 .validate_add_page = amd_validate_add_page,
118 .have_wrcomb = positive_have_wrcomb,
119};
113 .vendor = X86_VENDOR_AMD,
114 .set = amd_set_mtrr,
115 .get = amd_get_mtrr,
116 .get_free_region = generic_get_free_region,
117 .validate_add_page = amd_validate_add_page,
118 .have_wrcomb = positive_have_wrcomb,
119};
120
121int __init amd_init_mtrr(void)
122{
123 set_mtrr_ops(&amd_mtrr_ops);
124 return 0;
125}