#ifndef _LINUX_IOPORT_H
#define _LINUX_IOPORT_H
#ifndef __ASSEMBLY__
#include <linux/bits.h>
#include <linux/compiler.h>
#include <linux/minmax.h>
#include <linux/types.h>
struct resource { … };
#define IORESOURCE_BITS …
#define IORESOURCE_TYPE_BITS …
#define IORESOURCE_IO …
#define IORESOURCE_MEM …
#define IORESOURCE_REG …
#define IORESOURCE_IRQ …
#define IORESOURCE_DMA …
#define IORESOURCE_BUS …
#define IORESOURCE_PREFETCH …
#define IORESOURCE_READONLY …
#define IORESOURCE_CACHEABLE …
#define IORESOURCE_RANGELENGTH …
#define IORESOURCE_SHADOWABLE …
#define IORESOURCE_SIZEALIGN …
#define IORESOURCE_STARTALIGN …
#define IORESOURCE_MEM_64 …
#define IORESOURCE_WINDOW …
#define IORESOURCE_MUXED …
#define IORESOURCE_EXT_TYPE_BITS …
#define IORESOURCE_SYSRAM …
#define IORESOURCE_SYSRAM_DRIVER_MANAGED …
#define IORESOURCE_SYSRAM_MERGEABLE …
#define IORESOURCE_EXCLUSIVE …
#define IORESOURCE_DISABLED …
#define IORESOURCE_UNSET …
#define IORESOURCE_AUTO …
#define IORESOURCE_BUSY …
#define IORESOURCE_SYSTEM_RAM …
#define IORESOURCE_IRQ_HIGHEDGE …
#define IORESOURCE_IRQ_LOWEDGE …
#define IORESOURCE_IRQ_HIGHLEVEL …
#define IORESOURCE_IRQ_LOWLEVEL …
#define IORESOURCE_IRQ_SHAREABLE …
#define IORESOURCE_IRQ_OPTIONAL …
#define IORESOURCE_IRQ_WAKECAPABLE …
#define IORESOURCE_DMA_TYPE_MASK …
#define IORESOURCE_DMA_8BIT …
#define IORESOURCE_DMA_8AND16BIT …
#define IORESOURCE_DMA_16BIT …
#define IORESOURCE_DMA_MASTER …
#define IORESOURCE_DMA_BYTE …
#define IORESOURCE_DMA_WORD …
#define IORESOURCE_DMA_SPEED_MASK …
#define IORESOURCE_DMA_COMPATIBLE …
#define IORESOURCE_DMA_TYPEA …
#define IORESOURCE_DMA_TYPEB …
#define IORESOURCE_DMA_TYPEF …
#define IORESOURCE_MEM_WRITEABLE …
#define IORESOURCE_MEM_CACHEABLE …
#define IORESOURCE_MEM_RANGELENGTH …
#define IORESOURCE_MEM_TYPE_MASK …
#define IORESOURCE_MEM_8BIT …
#define IORESOURCE_MEM_16BIT …
#define IORESOURCE_MEM_8AND16BIT …
#define IORESOURCE_MEM_32BIT …
#define IORESOURCE_MEM_SHADOWABLE …
#define IORESOURCE_MEM_EXPANSIONROM …
#define IORESOURCE_MEM_NONPOSTED …
#define IORESOURCE_IO_16BIT_ADDR …
#define IORESOURCE_IO_FIXED …
#define IORESOURCE_IO_SPARSE …
#define IORESOURCE_ROM_ENABLE …
#define IORESOURCE_ROM_SHADOW …
#define IORESOURCE_PCI_FIXED …
#define IORESOURCE_PCI_EA_BEI …
enum { … };
enum { … };
#define DEFINE_RES_NAMED(_start, _size, _name, _flags) …
#define DEFINE_RES_IO_NAMED(_start, _size, _name) …
#define DEFINE_RES_IO(_start, _size) …
#define DEFINE_RES_MEM_NAMED(_start, _size, _name) …
#define DEFINE_RES_MEM(_start, _size) …
#define DEFINE_RES_REG_NAMED(_start, _size, _name) …
#define DEFINE_RES_REG(_start, _size) …
#define DEFINE_RES_IRQ_NAMED(_irq, _name) …
#define DEFINE_RES_IRQ(_irq) …
#define DEFINE_RES_DMA_NAMED(_dma, _name) …
#define DEFINE_RES_DMA(_dma) …
resource_alignf;
struct resource_constraint { … };
extern struct resource ioport_resource;
extern struct resource iomem_resource;
extern struct resource *request_resource_conflict(struct resource *root, struct resource *new);
extern int request_resource(struct resource *root, struct resource *new);
extern int release_resource(struct resource *new);
void release_child_resources(struct resource *new);
extern void reserve_region_with_split(struct resource *root,
resource_size_t start, resource_size_t end,
const char *name);
extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
extern int remove_resource(struct resource *old);
extern void arch_remove_reservations(struct resource *avail);
extern int allocate_resource(struct resource *root, struct resource *new,
resource_size_t size, resource_size_t min,
resource_size_t max, resource_size_t align,
resource_alignf alignf,
void *alignf_data);
struct resource *lookup_resource(struct resource *root, resource_size_t start);
int adjust_resource(struct resource *res, resource_size_t start,
resource_size_t size);
resource_size_t resource_alignment(struct resource *res);
static inline resource_size_t resource_size(const struct resource *res)
{ … }
static inline unsigned long resource_type(const struct resource *res)
{ … }
static inline unsigned long resource_ext_type(const struct resource *res)
{ … }
static inline bool resource_contains(const struct resource *r1, const struct resource *r2)
{ … }
static inline bool resource_overlaps(const struct resource *r1, const struct resource *r2)
{ … }
static inline bool resource_intersection(const struct resource *r1, const struct resource *r2,
struct resource *r)
{ … }
static inline bool resource_union(const struct resource *r1, const struct resource *r2,
struct resource *r)
{ … }
int find_resource_space(struct resource *root, struct resource *new,
resource_size_t size, struct resource_constraint *constraint);
#define request_region(start,n,name) …
#define request_muxed_region(start,n,name) …
#define __request_mem_region(start,n,name, excl) …
#define request_mem_region(start,n,name) …
#define request_mem_region_muxed(start, n, name) …
#define request_mem_region_exclusive(start,n,name) …
#define rename_region(region, newname) …
extern struct resource * __request_region(struct resource *,
resource_size_t start,
resource_size_t n,
const char *name, int flags);
#define release_region(start,n) …
#define release_mem_region(start,n) …
extern void __release_region(struct resource *, resource_size_t,
resource_size_t);
#ifdef CONFIG_MEMORY_HOTREMOVE
extern void release_mem_region_adjustable(resource_size_t, resource_size_t);
#endif
#ifdef CONFIG_MEMORY_HOTPLUG
extern void merge_system_ram_resource(struct resource *res);
#endif
struct device;
extern int devm_request_resource(struct device *dev, struct resource *root,
struct resource *new);
extern void devm_release_resource(struct device *dev, struct resource *new);
#define devm_request_region(dev,start,n,name) …
#define devm_request_mem_region(dev,start,n,name) …
extern struct resource * __devm_request_region(struct device *dev,
struct resource *parent, resource_size_t start,
resource_size_t n, const char *name);
#define devm_release_region(dev, start, n) …
#define devm_release_mem_region(dev, start, n) …
extern void __devm_release_region(struct device *dev, struct resource *parent,
resource_size_t start, resource_size_t n);
extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
extern bool iomem_is_exclusive(u64 addr);
extern bool resource_is_exclusive(struct resource *resource, u64 addr,
resource_size_t size);
extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
extern int
walk_mem_res(u64 start, u64 end, void *arg,
int (*func)(struct resource *, void *));
extern int
walk_system_ram_res(u64 start, u64 end, void *arg,
int (*func)(struct resource *, void *));
extern int
walk_system_ram_res_rev(u64 start, u64 end, void *arg,
int (*func)(struct resource *, void *));
extern int
walk_iomem_res_desc(unsigned long desc, unsigned long flags, u64 start, u64 end,
void *arg, int (*func)(struct resource *, void *));
struct resource *devm_request_free_mem_region(struct device *dev,
struct resource *base, unsigned long size);
struct resource *request_free_mem_region(struct resource *base,
unsigned long size, const char *name);
struct resource *alloc_free_mem_region(struct resource *base,
unsigned long size, unsigned long align, const char *name);
static inline void irqresource_disabled(struct resource *res, u32 irq)
{ … }
extern struct address_space *iomem_get_mapping(void);
#endif
#endif