Changes in 4.9.198 scsi: ufs: skip shutdown if hba is not powered scsi: megaraid: disable device when probe failed after enabled device scsi: qla2xxx: Fix unbound sleep in fcport delete path. ARM: OMAP2+: Fix missing reset done flag for am3 and am43 ARM: dts: am4372: Set memory bandwidth limit for DISPC MIPS: dts: ar9331: fix interrupt-controller size nl80211: fix null pointer dereference mac80211: fix txq null pointer dereference mips: Loongson: Fix the link time qualifier of 'serial_exit()' net: hisilicon: Fix usage of uninitialized variable in function mdio_sc_cfg_reg_write() namespace: fix namespace.pl script to support relative paths Revert "drm/radeon: Fix EEH during kexec" ocfs2: fix panic due to ocfs2_wq is null loop: Add LOOP_SET_DIRECT_IO to compat ioctl net: bcmgenet: Fix RGMII_MODE_EN value for GENET v1/2/3 net: bcmgenet: Set phydev->dev_flags only for internal PHYs sctp: change sctp_prot .no_autobind with true net: avoid potential infinite loop in tc_ctl_action() ipv4: Return -ENETUNREACH if we can't create route but saddr is valid memfd: Fix locking when tagging pins USB: legousbtower: fix memleak on disconnect ALSA: hda/realtek - Add support for ALC711 usb: udc: lpc32xx: fix bad bit shift operation USB: serial: ti_usb_3410_5052: fix port-close races USB: ldusb: fix memleak on disconnect USB: usblp: fix use-after-free on disconnect USB: ldusb: fix read info leaks MIPS: tlbex: Fix build_restore_pagemask KScratch restore staging: wlan-ng: fix exit return when sme->key_idx >= NUM_WEPKEYS scsi: core: try to get module before removing device Input: da9063 - fix capability and drop KEY_SLEEP ASoC: rsnd: Reinitialize bit clock inversion flag for every format setting cfg80211: wext: avoid copying malformed SSIDs mac80211: Reject malformed SSID elements drm/edid: Add 6 bpc quirk for SDC panel in Lenovo G50 scsi: zfcp: fix reaction on bit error threshold notification mm/slub: fix a deadlock in show_slab_objects() xtensa: drop EXPORT_SYMBOL for outs*/ins* parisc: Fix vmap memory leak in ioremap()/iounmap() CIFS: avoid using MID 0xFFFF btrfs: block-group: Fix a memory leak due to missing btrfs_put_block_group() memstick: jmb38x_ms: Fix an error handling path in 'jmb38x_ms_probe()' cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown xen/netback: fix error path of xenvif_connect_data() PCI: PM: Fix pci_power_up() Revert "net: sit: fix memory leak in sit_init_net()" RDMA/cxgb4: Do not dma memory off of the stack Linux 4.9.198 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
102 lines
2.4 KiB
C
102 lines
2.4 KiB
C
/*
|
|
* arch/parisc/mm/ioremap.c
|
|
*
|
|
* (C) Copyright 1995 1996 Linus Torvalds
|
|
* (C) Copyright 2001-2019 Helge Deller <deller@gmx.de>
|
|
* (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
|
|
*/
|
|
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/module.h>
|
|
#include <linux/io.h>
|
|
#include <asm/pgalloc.h>
|
|
|
|
/*
|
|
* Generic mapping function (not visible outside):
|
|
*/
|
|
|
|
/*
|
|
* Remap an arbitrary physical address space into the kernel virtual
|
|
* address space.
|
|
*
|
|
* NOTE! We need to allow non-page-aligned mappings too: we will obviously
|
|
* have to convert them into an offset in a page-aligned mapping, but the
|
|
* caller shouldn't need to know that small detail.
|
|
*/
|
|
void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
|
|
{
|
|
void __iomem *addr;
|
|
struct vm_struct *area;
|
|
unsigned long offset, last_addr;
|
|
pgprot_t pgprot;
|
|
|
|
#ifdef CONFIG_EISA
|
|
unsigned long end = phys_addr + size - 1;
|
|
/* Support EISA addresses */
|
|
if ((phys_addr >= 0x00080000 && end < 0x000fffff) ||
|
|
(phys_addr >= 0x00500000 && end < 0x03bfffff)) {
|
|
phys_addr |= F_EXTEND(0xfc000000);
|
|
flags |= _PAGE_NO_CACHE;
|
|
}
|
|
#endif
|
|
|
|
/* Don't allow wraparound or zero size */
|
|
last_addr = phys_addr + size - 1;
|
|
if (!size || last_addr < phys_addr)
|
|
return NULL;
|
|
|
|
/*
|
|
* Don't allow anybody to remap normal RAM that we're using..
|
|
*/
|
|
if (phys_addr < virt_to_phys(high_memory)) {
|
|
char *t_addr, *t_end;
|
|
struct page *page;
|
|
|
|
t_addr = __va(phys_addr);
|
|
t_end = t_addr + (size - 1);
|
|
|
|
for (page = virt_to_page(t_addr);
|
|
page <= virt_to_page(t_end); page++) {
|
|
if(!PageReserved(page))
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |
|
|
_PAGE_ACCESSED | flags);
|
|
|
|
/*
|
|
* Mappings have to be page-aligned
|
|
*/
|
|
offset = phys_addr & ~PAGE_MASK;
|
|
phys_addr &= PAGE_MASK;
|
|
size = PAGE_ALIGN(last_addr + 1) - phys_addr;
|
|
|
|
/*
|
|
* Ok, go for it..
|
|
*/
|
|
area = get_vm_area(size, VM_IOREMAP);
|
|
if (!area)
|
|
return NULL;
|
|
|
|
addr = (void __iomem *) area->addr;
|
|
if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
|
|
phys_addr, pgprot)) {
|
|
vunmap(addr);
|
|
return NULL;
|
|
}
|
|
|
|
return (void __iomem *) (offset + (char __iomem *)addr);
|
|
}
|
|
EXPORT_SYMBOL(__ioremap);
|
|
|
|
void iounmap(const volatile void __iomem *io_addr)
|
|
{
|
|
unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
|
|
|
|
if (is_vmalloc_addr((void *)addr))
|
|
vunmap((void *)addr);
|
|
}
|
|
EXPORT_SYMBOL(iounmap);
|