drm/i915/bios: be more explicit about discarding iomem address space
Add one explicit discard of __iomem address space qualifier in validate_vbt(), and respect it otherwise. This adds clarity in the code, and reduces the sparse warnings from the module to just one. Quoting Daniel, "The vbt really is plain old memory. Except that it's reserved in the e820 table as something special and hence treated as io range by the kernel. But it is memory, hence casting away the __iomem is imo the right approach." Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Родитель
0ec463d310
Коммит
acbb479390
|
@ -1199,15 +1199,22 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = {
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct bdb_header *validate_vbt(const void *base, size_t size,
|
static const struct bdb_header *validate_vbt(const void __iomem *_base,
|
||||||
const void *_vbt,
|
size_t size,
|
||||||
|
const void __iomem *_vbt,
|
||||||
const char *source)
|
const char *source)
|
||||||
{
|
{
|
||||||
const struct vbt_header *vbt = _vbt;
|
/*
|
||||||
size_t offset;
|
* This is the one place where we explicitly discard the address space
|
||||||
|
* (__iomem) of the BIOS/VBT. (And this will cause a sparse complaint.)
|
||||||
|
* From now on everything is based on 'base', and treated as regular
|
||||||
|
* memory.
|
||||||
|
*/
|
||||||
|
const void *base = (const void *) _base;
|
||||||
|
size_t offset = _vbt - _base;
|
||||||
|
const struct vbt_header *vbt = base + offset;
|
||||||
const struct bdb_header *bdb;
|
const struct bdb_header *bdb;
|
||||||
|
|
||||||
offset = _vbt - base;
|
|
||||||
if (offset + sizeof(struct vbt_header) > size) {
|
if (offset + sizeof(struct vbt_header) > size) {
|
||||||
DRM_DEBUG_DRIVER("VBT header incomplete\n");
|
DRM_DEBUG_DRIVER("VBT header incomplete\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1235,14 +1242,14 @@ static const struct bdb_header *validate_vbt(const void *base, size_t size,
|
||||||
return bdb;
|
return bdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct bdb_header *find_vbt(void *bios, size_t size)
|
static const struct bdb_header *find_vbt(void __iomem *bios, size_t size)
|
||||||
{
|
{
|
||||||
const struct bdb_header *bdb = NULL;
|
const struct bdb_header *bdb = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
/* Scour memory looking for the VBT signature. */
|
/* Scour memory looking for the VBT signature. */
|
||||||
for (i = 0; i + 4 < size; i++) {
|
for (i = 0; i + 4 < size; i++) {
|
||||||
if (memcmp(bios + i, "$VBT", 4) == 0) {
|
if (ioread32(bios + i) == *((const u32 *) "$VBT")) {
|
||||||
bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
|
bdb = validate_vbt(bios, size, bios + i, "PCI ROM");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче