mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 14:43:03 +00:00
dad4f140ed
Pull XArray conversion from Matthew Wilcox: "The XArray provides an improved interface to the radix tree data structure, providing locking as part of the API, specifying GFP flags at allocation time, eliminating preloading, less re-walking the tree, more efficient iterations and not exposing RCU-protected pointers to its users. This patch set 1. Introduces the XArray implementation 2. Converts the pagecache to use it 3. Converts memremap to use it The page cache is the most complex and important user of the radix tree, so converting it was most important. Converting the memremap code removes the only other user of the multiorder code, which allows us to remove the radix tree code that supported it. I have 40+ followup patches to convert many other users of the radix tree over to the XArray, but I'd like to get this part in first. The other conversions haven't been in linux-next and aren't suitable for applying yet, but you can see them in the xarray-conv branch if you're interested" * 'xarray' of git://git.infradead.org/users/willy/linux-dax: (90 commits) radix tree: Remove multiorder support radix tree test: Convert multiorder tests to XArray radix tree tests: Convert item_delete_rcu to XArray radix tree tests: Convert item_kill_tree to XArray radix tree tests: Move item_insert_order radix tree test suite: Remove multiorder benchmarking radix tree test suite: Remove __item_insert memremap: Convert to XArray xarray: Add range store functionality xarray: Move multiorder_check to in-kernel tests xarray: Move multiorder_shrink to kernel tests xarray: Move multiorder account test in-kernel radix tree test suite: Convert iteration test to XArray radix tree test suite: Convert tag_tagged_items to XArray radix tree: Remove radix_tree_clear_tags radix tree: Remove radix_tree_maybe_preload_order radix tree: Remove split/join code radix tree: Remove radix_tree_update_node_t page cache: Finish XArray conversion dax: Convert page fault handlers to XArray ...
193 lines
4.7 KiB
C
193 lines
4.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* ACPI PCI Hot Plug Controller Driver
|
|
*
|
|
* Copyright (C) 1995,2001 Compaq Computer Corporation
|
|
* Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
|
|
* Copyright (C) 2001 IBM Corp.
|
|
* Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com)
|
|
* Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com)
|
|
* Copyright (C) 2002,2003 NEC Corporation
|
|
* Copyright (C) 2003-2005 Matthew Wilcox (willy@infradead.org)
|
|
* Copyright (C) 2003-2005 Hewlett Packard
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* Send feedback to <gregkh@us.ibm.com>,
|
|
* <t-kochi@bq.jp.nec.com>
|
|
*
|
|
*/
|
|
|
|
#ifndef _ACPIPHP_H
|
|
#define _ACPIPHP_H
|
|
|
|
#include <linux/acpi.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/pci_hotplug.h>
|
|
|
|
struct acpiphp_context;
|
|
struct acpiphp_bridge;
|
|
struct acpiphp_slot;
|
|
|
|
/*
|
|
* struct slot - slot information for each *physical* slot
|
|
*/
|
|
struct slot {
|
|
struct hotplug_slot hotplug_slot;
|
|
struct acpiphp_slot *acpi_slot;
|
|
unsigned int sun; /* ACPI _SUN (Slot User Number) value */
|
|
};
|
|
|
|
static inline const char *slot_name(struct slot *slot)
|
|
{
|
|
return hotplug_slot_name(&slot->hotplug_slot);
|
|
}
|
|
|
|
static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot)
|
|
{
|
|
return container_of(hotplug_slot, struct slot, hotplug_slot);
|
|
}
|
|
|
|
/*
|
|
* struct acpiphp_bridge - PCI bridge information
|
|
*
|
|
* for each bridge device in ACPI namespace
|
|
*/
|
|
struct acpiphp_bridge {
|
|
struct list_head list;
|
|
struct list_head slots;
|
|
struct kref ref;
|
|
|
|
struct acpiphp_context *context;
|
|
|
|
int nr_slots;
|
|
|
|
/* This bus (host bridge) or Secondary bus (PCI-to-PCI bridge) */
|
|
struct pci_bus *pci_bus;
|
|
|
|
/* PCI-to-PCI bridge device */
|
|
struct pci_dev *pci_dev;
|
|
|
|
bool is_going_away;
|
|
};
|
|
|
|
|
|
/*
|
|
* struct acpiphp_slot - PCI slot information
|
|
*
|
|
* PCI slot information for each *physical* PCI slot
|
|
*/
|
|
struct acpiphp_slot {
|
|
struct list_head node;
|
|
struct pci_bus *bus;
|
|
struct list_head funcs; /* one slot may have different
|
|
objects (i.e. for each function) */
|
|
struct slot *slot;
|
|
|
|
u8 device; /* pci device# */
|
|
u32 flags; /* see below */
|
|
};
|
|
|
|
|
|
/*
|
|
* struct acpiphp_func - PCI function information
|
|
*
|
|
* PCI function information for each object in ACPI namespace
|
|
* typically 8 objects per slot (i.e. for each PCI function)
|
|
*/
|
|
struct acpiphp_func {
|
|
struct acpiphp_bridge *parent;
|
|
struct acpiphp_slot *slot;
|
|
|
|
struct list_head sibling;
|
|
|
|
u8 function; /* pci function# */
|
|
u32 flags; /* see below */
|
|
};
|
|
|
|
struct acpiphp_context {
|
|
struct acpi_hotplug_context hp;
|
|
struct acpiphp_func func;
|
|
struct acpiphp_bridge *bridge;
|
|
unsigned int refcount;
|
|
};
|
|
|
|
static inline struct acpiphp_context *to_acpiphp_context(struct acpi_hotplug_context *hp)
|
|
{
|
|
return container_of(hp, struct acpiphp_context, hp);
|
|
}
|
|
|
|
static inline struct acpiphp_context *func_to_context(struct acpiphp_func *func)
|
|
{
|
|
return container_of(func, struct acpiphp_context, func);
|
|
}
|
|
|
|
static inline struct acpi_device *func_to_acpi_device(struct acpiphp_func *func)
|
|
{
|
|
return func_to_context(func)->hp.self;
|
|
}
|
|
|
|
static inline acpi_handle func_to_handle(struct acpiphp_func *func)
|
|
{
|
|
return func_to_acpi_device(func)->handle;
|
|
}
|
|
|
|
struct acpiphp_root_context {
|
|
struct acpi_hotplug_context hp;
|
|
struct acpiphp_bridge *root_bridge;
|
|
};
|
|
|
|
static inline struct acpiphp_root_context *to_acpiphp_root_context(struct acpi_hotplug_context *hp)
|
|
{
|
|
return container_of(hp, struct acpiphp_root_context, hp);
|
|
}
|
|
|
|
/*
|
|
* struct acpiphp_attention_info - device specific attention registration
|
|
*
|
|
* ACPI has no generic method of setting/getting attention status
|
|
* this allows for device specific driver registration
|
|
*/
|
|
struct acpiphp_attention_info
|
|
{
|
|
int (*set_attn)(struct hotplug_slot *slot, u8 status);
|
|
int (*get_attn)(struct hotplug_slot *slot, u8 *status);
|
|
struct module *owner;
|
|
};
|
|
|
|
/* ACPI _STA method value (ignore bit 4; battery present) */
|
|
#define ACPI_STA_ALL (0x0000000f)
|
|
|
|
/* slot flags */
|
|
|
|
#define SLOT_ENABLED (0x00000001)
|
|
#define SLOT_IS_GOING_AWAY (0x00000002)
|
|
|
|
/* function flags */
|
|
|
|
#define FUNC_HAS_STA (0x00000001)
|
|
#define FUNC_HAS_EJ0 (0x00000002)
|
|
|
|
/* function prototypes */
|
|
|
|
/* acpiphp_core.c */
|
|
int acpiphp_register_attention(struct acpiphp_attention_info *info);
|
|
int acpiphp_unregister_attention(struct acpiphp_attention_info *info);
|
|
int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot, unsigned int sun);
|
|
void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
|
|
|
|
/* acpiphp_glue.c */
|
|
typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
|
|
|
|
int acpiphp_enable_slot(struct acpiphp_slot *slot);
|
|
int acpiphp_disable_slot(struct acpiphp_slot *slot);
|
|
u8 acpiphp_get_power_status(struct acpiphp_slot *slot);
|
|
u8 acpiphp_get_attention_status(struct acpiphp_slot *slot);
|
|
u8 acpiphp_get_latch_status(struct acpiphp_slot *slot);
|
|
u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot);
|
|
|
|
/* variables */
|
|
extern bool acpiphp_disabled;
|
|
|
|
#endif /* _ACPIPHP_H */
|