Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / pci / hotplug / acpiphp.h
index d949987..467ac70 100644 (file)
@@ -7,6 +7,8 @@
  * 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 (matthew.wilcox@hp.com)
+ * Copyright (C) 2003-2005 Hewlett Packard
  *
  * All rights reserved.
  *
@@ -35,6 +37,7 @@
 
 #include <linux/acpi.h>
 #include <linux/kobject.h>     /* for KOBJ_NAME_LEN */
+#include <linux/mutex.h>
 #include "pci_hotplug.h"
 
 #define dbg(format, arg...)                                    \
 
 struct acpiphp_bridge;
 struct acpiphp_slot;
-struct pci_resource;
 
 /*
  * struct slot - slot information for each *physical* slot
  */
 struct slot {
-       u8 number;
        struct hotplug_slot     *hotplug_slot;
-       struct list_head        slot_list;
-
        struct acpiphp_slot     *acpi_slot;
 };
 
-/*
- * struct pci_resource - describes pci resource (mem, pfmem, io, bus)
- */
-struct pci_resource {
-       struct pci_resource * next;
-       u64 base;
-       u32 length;
-};
-
-/**
- * struct hpp_param - ACPI 2.0 _HPP Hot Plug Parameters
- * @cache_line_size in DWORD
- * @latency_timer in PCI clock
- * @enable_SERR 0 or 1
- * @enable_PERR 0 or 1
- */
-struct hpp_param {
-       u8 cache_line_size;
-       u8 latency_timer;
-       u8 enable_SERR;
-       u8 enable_PERR;
-};
 
 
 /**
@@ -101,10 +78,6 @@ struct acpiphp_bridge {
        int type;
        int nr_slots;
 
-       u8 seg;
-       u8 bus;
-       u8 sub;
-
        u32 flags;
 
        /* This bus (host bridge) or Secondary bus (PCI-to-PCI bridge) */
@@ -114,15 +87,9 @@ struct acpiphp_bridge {
        struct pci_dev *pci_dev;
 
        /* ACPI 2.0 _HPP parameters */
-       struct hpp_param hpp;
+       struct hotplug_params hpp;
 
        spinlock_t res_lock;
-
-       /* available resources on this bus */
-       struct pci_resource *mem_head;
-       struct pci_resource *p_mem_head;
-       struct pci_resource *io_head;
-       struct pci_resource *bus_head;
 };
 
 
@@ -136,9 +103,9 @@ struct acpiphp_slot {
        struct acpiphp_bridge *bridge;  /* parent */
        struct list_head funcs;         /* one slot may have different
                                           objects (i.e. for each function) */
-       struct semaphore crit_sect;
+       struct slot *slot;
+       struct mutex crit_sect;
 
-       u32             id;             /* slot id (serial #) for hotplug core */
        u8              device;         /* pci device# */
 
        u32             sun;            /* ACPI _SUN (slot unique number) */
@@ -163,12 +130,6 @@ struct acpiphp_func {
 
        u8              function;       /* pci function# */
        u32             flags;          /* see below */
-
-       /* resources used for this function */
-       struct pci_resource *mem_head;
-       struct pci_resource *p_mem_head;
-       struct pci_resource *io_head;
-       struct pci_resource *bus_head;
 };
 
 /**
@@ -184,6 +145,25 @@ struct acpiphp_attention_info
        struct module *owner;
 };
 
+
+struct dependent_device {
+       struct list_head device_list;
+       struct list_head pci_list;
+       acpi_handle handle;
+       struct acpiphp_func *func;
+};
+
+
+struct acpiphp_dock_station {
+       acpi_handle handle;
+       u32 last_dock_time;
+       u32 flags;
+       struct acpiphp_func *dock_bridge;
+       struct list_head dependent_devices;
+       struct list_head pci_dependent_devices;
+};
+
+
 /* PCI bus bridge HID */
 #define ACPI_PCI_HOST_HID              "PNP0A03"
 
@@ -221,19 +201,27 @@ struct acpiphp_attention_info
 #define FUNC_HAS_PS1           (0x00000020)
 #define FUNC_HAS_PS2           (0x00000040)
 #define FUNC_HAS_PS3           (0x00000080)
+#define FUNC_HAS_DCK            (0x00000100)
+#define FUNC_IS_DD              (0x00000200)
+
+/* dock station flags */
+#define DOCK_DOCKING            (0x00000001)
+#define DOCK_HAS_BRIDGE         (0x00000002)
 
 /* function prototypes */
 
 /* acpiphp_core.c */
 extern int acpiphp_register_attention(struct acpiphp_attention_info*info);
 extern int acpiphp_unregister_attention(struct acpiphp_attention_info *info);
+extern int acpiphp_register_hotplug_slot(struct acpiphp_slot *slot);
+extern void acpiphp_unregister_hotplug_slot(struct acpiphp_slot *slot);
 
 /* acpiphp_glue.c */
 extern int acpiphp_glue_init (void);
 extern void acpiphp_glue_exit (void);
 extern int acpiphp_get_num_slots (void);
-extern struct acpiphp_slot *get_slot_from_id (int id);
 typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
+void handle_hotplug_event_func(acpi_handle, u32, void*);
 
 extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
 extern int acpiphp_disable_slot (struct acpiphp_slot *slot);
@@ -243,24 +231,15 @@ extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot);
 extern u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot);
 extern u32 acpiphp_get_address (struct acpiphp_slot *slot);
 
-/* acpiphp_pci.c */
-extern struct pci_dev *acpiphp_allocate_pcidev (struct pci_bus *pbus, int dev, int fn);
-extern int acpiphp_configure_slot (struct acpiphp_slot *slot);
-extern int acpiphp_configure_function (struct acpiphp_func *func);
-extern void acpiphp_unconfigure_function (struct acpiphp_func *func);
-extern int acpiphp_detect_pci_resource (struct acpiphp_bridge *bridge);
-extern int acpiphp_init_func_resource (struct acpiphp_func *func);
-
-/* acpiphp_res.c */
-extern struct pci_resource *acpiphp_get_io_resource (struct pci_resource **head, u32 size);
-extern struct pci_resource *acpiphp_get_resource (struct pci_resource **head, u32 size);
-extern struct pci_resource *acpiphp_get_resource_with_base (struct pci_resource **head, u64 base, u32 size);
-extern int acpiphp_resource_sort_and_combine (struct pci_resource **head);
-extern struct pci_resource *acpiphp_make_resource (u64 base, u32 length);
-extern void acpiphp_move_resource (struct pci_resource **from, struct pci_resource **to);
-extern void acpiphp_free_resource (struct pci_resource **res);
-extern void acpiphp_dump_resource (struct acpiphp_bridge *bridge); /* debug */
-extern void acpiphp_dump_func_resource (struct acpiphp_func *func); /* debug */
+/* acpiphp_dock.c */
+extern int find_dock_station(void);
+extern void remove_dock_station(void);
+extern void add_dependent_device(struct dependent_device *new_dd);
+extern void add_pci_dependent_device(struct dependent_device *new_dd);
+extern struct dependent_device *get_dependent_device(acpi_handle handle);
+extern int is_dependent_device(acpi_handle handle);
+extern int detect_dependent_devices(acpi_handle *bridge_handle);
+extern struct dependent_device *alloc_dependent_device(acpi_handle handle);
 
 /* variables */
 extern int acpiphp_debug;