1450N/A * Copyright © 2008-2013 Intel Corporation 1450N/A * Permission is hereby granted, free of charge, to any person obtaining a 1450N/A * copy of this software and associated documentation files (the "Software"), 1450N/A * to deal in the Software without restriction, including without limitation 1450N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 1450N/A * and/or sell copies of the Software, and to permit persons to whom the 1450N/A * Software is furnished to do so, subject to the following conditions: 1450N/A * The above copyright notice and this permission notice (including the next 1450N/A * paragraph) shall be included in all copies or substantial portions of the 1450N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1450N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1450N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1450N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1450N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1450N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 1450N/A * Eric Anholt <eric@anholt.net> 1450N/A * Chris Wilson <chris@chris-wilson.co.uk> 1450N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 1450N/A * The BIOS typically reserves some of the system's memory for the exclusive 1450N/A * use of the integrated graphics. This memory is no longer available for 1450N/A * use by the OS and so the user finds that his system has less memory 1450N/A * available than he put in. We refer to this memory as stolen. 1450N/A * The BIOS will allocate its framebuffer from the stolen memory. Our 1450N/A * goal is try to reuse that object for our own fbcon which must always 1450N/A * be available for panics. Anything else we can reuse the stolen memory 1450N/A /* On the machines I have tested the Graphics Base of Stolen Memory 1450N/A * is unreliable, so on those compute the base by subtracting the 1450N/A * stolen memory from the Top of Low Usable DRAM which is where the 1450N/A * BIOS places the graphics stolen memory. 1450N/A * On gen2, the layout is slightly different with the Graphics Segment 1450N/A * immediately following Top of Memory (or Top of Usable DRAM). Note 1450N/A * it appears that TOUD is only reported by 865g, so we just use the 1450N/A * top of memory as determined by the e820 probe. 1450N/A * XXX gen2 requires an unavailable symbol and 945gm fails with 1450N/A /* Read Base Data of Stolen Memory Register (BDSM) directly. 1450N/A * Note that there is also a MCHBAR miror at 0x1080c0 or 1450N/A * we could use device 2:0x5c instead. 1450N/A base &= ~
4095;
/* lower bits used for locking register */ 1450N/A /* Read Graphics Base of Stolen Memory directly */ 1450N/A /* Stolen is immediately below Top of Low Usable DRAM */ 1450N/A /* Stolen is immediately above Top of Memory */ 1450N/A /* Try to over-allocate to reduce reallocations and fragmentation */ 1450N/A /* Release any current block */ 1450N/A /* Basic memrange allocator for stolen space */ 1450N/A /* We hide that we have no struct page backing our stolen object 1450N/A * by wrapping the contiguous physical allocation with a fake 1450N/A * dma mapping in a single scatterlist. 1450N/A /* Should only be called during free */ 1450N/A DRM_DEBUG_KMS(
"creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n",
1450N/A /* KISS and expect everything to be page-aligned */ 1450N/A /* Some objects just need physical mem from stolen space */ 1450N/A /* To simplify the initialisation sequence between KMS and GTT, 1450N/A * we allow construction of the stolen object prior to 1450N/A * setting up the GTT space. The actual reservation will occur