Lines Matching +full:mem +full:- +full:base

1 // SPDX-License-Identifier: MIT
21 * graphics drivers, such as EFI-GOP or VESA, early during the boot process.
23 * hardware-specific driver. To take over the device, the dedicated driver
25 * ownership of framebuffer memory and hand-over between drivers.
32 * .. code-block:: c
36 * struct resource *mem;
37 * resource_size_t base, size;
40 * mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
41 * if (!mem)
42 * return -ENODEV;
43 * base = mem->start;
44 * size = resource_size(mem);
46 * ret = aperture_remove_conflicting_devices(base, size, "example");
61 * The given example reads the platform device's I/O-memory range from the
82 * .. code-block:: c
86 * struct resource *mem;
87 * resource_size_t base, size;
89 * mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
90 * if (!mem)
91 * return -ENODEV;
92 * base = mem->start;
93 * size = resource_size(mem);
95 * ret = devm_aperture_acquire_for_platform_device(pdev, base, size);
107 * // Hot-unplug the device
135 resource_size_t base; member
153 bool detached = !ap->dev; in devm_aperture_acquire_release()
159 list_del(&ap->lh); in devm_aperture_acquire_release()
164 resource_size_t base, resource_size_t size, in devm_aperture_acquire() argument
167 size_t end = base + size; in devm_aperture_acquire()
175 if (overlap(base, end, ap->base, ap->base + ap->size)) { in devm_aperture_acquire()
177 return -EBUSY; in devm_aperture_acquire()
184 return -ENOMEM; in devm_aperture_acquire()
187 ap->dev = dev; in devm_aperture_acquire()
188 ap->base = base; in devm_aperture_acquire()
189 ap->size = size; in devm_aperture_acquire()
190 ap->detach = detach; in devm_aperture_acquire()
191 INIT_LIST_HEAD(&ap->lh); in devm_aperture_acquire()
193 list_add(&ap->lh, &apertures); in devm_aperture_acquire()
206 * to do for firmware-based fb drivers, such as EFI, VESA or VGA. After in aperture_detach_platform_device()
210 * For non-platform devices, a new callback would be required. in aperture_detach_platform_device()
220 * devm_aperture_acquire_for_platform_device - Acquires ownership of an aperture
223 * @base: the aperture's byte offset in physical memory
240 resource_size_t base, in devm_aperture_acquire_for_platform_device() argument
243 return devm_aperture_acquire(&pdev->dev, base, size, aperture_detach_platform_device); in devm_aperture_acquire_for_platform_device()
247 static void aperture_detach_devices(resource_size_t base, resource_size_t size) in aperture_detach_devices() argument
249 resource_size_t end = base + size; in aperture_detach_devices()
256 struct device *dev = ap->dev; in aperture_detach_devices()
261 if (!overlap(base, end, ap->base, ap->base + ap->size)) in aperture_detach_devices()
264 ap->dev = NULL; /* detach from device */ in aperture_detach_devices()
265 list_del(&ap->lh); in aperture_detach_devices()
267 ap->detach(dev); in aperture_detach_devices()
274 * aperture_remove_conflicting_devices - remove devices in the given range
275 * @base: the aperture's base address in physical memory
279 * This function removes devices that own apertures within @base and @size.
284 int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, in aperture_remove_conflicting_devices() argument
300 aperture_detach_devices(base, size); in aperture_remove_conflicting_devices()
307 * __aperture_remove_legacy_vga_devices - remove legacy VGA devices of a PCI devices
311 * framebuffer or a console. This is useful if you have a VGA-compatible
312 * PCI graphics device with framebuffers in non-BAR locations. Drivers
342 * aperture_remove_conflicting_pci_devices - remove existing framebuffers for PCI devices
356 resource_size_t base, size; in aperture_remove_conflicting_pci_devices() local
371 base = pci_resource_start(pdev, bar); in aperture_remove_conflicting_pci_devices()
373 aperture_detach_devices(base, size); in aperture_remove_conflicting_pci_devices()