/* * Copyright 2012 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs
*/ #include"priv.h"
if (!(map = nvkm_kmap(memory))) { for (i = 0; i < size; i += 4)
nvkm_wo32(memory, i, iobj->suspend[i / 4]);
} else {
memcpy_toio(map, iobj->suspend, size);
}
nvkm_done(memory);
kvfree(iobj->suspend);
iobj->suspend = NULL;
}
int
nvkm_instobj_save(struct nvkm_instobj *iobj)
{ struct nvkm_memory *memory = &iobj->memory; const u64 size = nvkm_memory_size(memory); void __iomem *map; int i;
iobj->suspend = kvmalloc(size, GFP_KERNEL); if (!iobj->suspend) return -ENOMEM;
if (!(map = nvkm_kmap(memory))) { for (i = 0; i < size; i += 4)
iobj->suspend[i / 4] = nvkm_ro32(memory, i);
} else {
memcpy_fromio(iobj->suspend, map, size);
}
nvkm_done(memory); return 0;
}
void
nvkm_instmem_boot(struct nvkm_instmem *imem)
{ /* Separate bootstrapped objects from normal list, as we need * to make sure they're accessed with the slowpath on suspend * and resume.
*/ struct nvkm_instobj *iobj, *itmp;
spin_lock(&imem->lock);
list_for_each_entry_safe(iobj, itmp, &imem->list, head) {
list_move_tail(&iobj->head, &imem->boot);
}
spin_unlock(&imem->lock);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.