| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | |
|---|
| 2 | 3 | /* |
|---|
| 3 | 4 | * acpi_lpit.c - LPIT table processing functions |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2017 Intel Corporation. All rights reserved. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 9 | | - * 2 as published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 7 | */ |
|---|
| 16 | 8 | |
|---|
| 17 | 9 | #include <linux/cpu.h> |
|---|
| .. | .. |
|---|
| 112 | 104 | |
|---|
| 113 | 105 | info->gaddr = lpit_native->residency_counter; |
|---|
| 114 | 106 | if (info->gaddr.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
|---|
| 115 | | - info->iomem_addr = ioremap_nocache(info->gaddr.address, |
|---|
| 107 | + info->iomem_addr = ioremap(info->gaddr.address, |
|---|
| 116 | 108 | info->gaddr.bit_width / 8); |
|---|
| 117 | 109 | if (!info->iomem_addr) |
|---|
| 118 | 110 | return; |
|---|
| .. | .. |
|---|
| 137 | 129 | |
|---|
| 138 | 130 | static void lpit_process(u64 begin, u64 end) |
|---|
| 139 | 131 | { |
|---|
| 140 | | - while (begin + sizeof(struct acpi_lpit_native) < end) { |
|---|
| 132 | + while (begin + sizeof(struct acpi_lpit_native) <= end) { |
|---|
| 141 | 133 | struct acpi_lpit_native *lpit_native = (struct acpi_lpit_native *)begin; |
|---|
| 142 | 134 | |
|---|
| 143 | 135 | if (!lpit_native->header.type && !lpit_native->header.flags) { |
|---|
| .. | .. |
|---|
| 156 | 148 | void acpi_init_lpit(void) |
|---|
| 157 | 149 | { |
|---|
| 158 | 150 | acpi_status status; |
|---|
| 159 | | - u64 lpit_begin; |
|---|
| 160 | 151 | struct acpi_table_lpit *lpit; |
|---|
| 161 | 152 | |
|---|
| 162 | 153 | status = acpi_get_table(ACPI_SIG_LPIT, 0, (struct acpi_table_header **)&lpit); |
|---|
| 163 | | - |
|---|
| 164 | 154 | if (ACPI_FAILURE(status)) |
|---|
| 165 | 155 | return; |
|---|
| 166 | 156 | |
|---|
| 167 | | - lpit_begin = (u64)lpit + sizeof(*lpit); |
|---|
| 168 | | - lpit_process(lpit_begin, lpit_begin + lpit->header.length); |
|---|
| 157 | + lpit_process((u64)lpit + sizeof(*lpit), |
|---|
| 158 | + (u64)lpit + lpit->header.length); |
|---|
| 159 | + |
|---|
| 160 | + acpi_put_table((struct acpi_table_header *)lpit); |
|---|
| 169 | 161 | } |
|---|