1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * CompactPCI Hot Plug Core Functions
5 * Copyright (C) 2002 SOMA Networks, Inc.
6 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
7 * Copyright (C) 2001 IBM Corp.
11 * Send feedback to <scottm@somanetworks.com>
14 #ifndef _CPCI_HOTPLUG_H
15 #define _CPCI_HOTPLUG_H
17 #include <linux/types.h>
18 #include <linux/pci.h>
19 #include <linux/pci_hotplug.h>
21 /* PICMG 2.1 R2.0 HS CSR bits: */
22 #define HS_CSR_INS 0x0080
23 #define HS_CSR_EXT 0x0040
24 #define HS_CSR_PI 0x0030
25 #define HS_CSR_LOO 0x0008
26 #define HS_CSR_PIE 0x0004
27 #define HS_CSR_EIM 0x0002
28 #define HS_CSR_DHA 0x0001
35 unsigned int extracting
;
36 struct hotplug_slot
*hotplug_slot
;
37 struct list_head slot_list
;
40 struct cpci_hp_controller_ops
{
41 int (*query_enum
)(void);
42 int (*enable_irq
)(void);
43 int (*disable_irq
)(void);
44 int (*check_irq
)(void *dev_id
);
45 int (*hardware_test
)(struct slot
*slot
, u32 value
);
46 u8 (*get_power
)(struct slot
*slot
);
47 int (*set_power
)(struct slot
*slot
, int value
);
50 struct cpci_hp_controller
{
52 unsigned long irq_flags
;
56 struct cpci_hp_controller_ops
*ops
;
59 static inline const char *slot_name(struct slot
*slot
)
61 return hotplug_slot_name(slot
->hotplug_slot
);
64 int cpci_hp_register_controller(struct cpci_hp_controller
*controller
);
65 int cpci_hp_unregister_controller(struct cpci_hp_controller
*controller
);
66 int cpci_hp_register_bus(struct pci_bus
*bus
, u8 first
, u8 last
);
67 int cpci_hp_unregister_bus(struct pci_bus
*bus
);
68 int cpci_hp_start(void);
69 int cpci_hp_stop(void);
72 * Internal function prototypes, these functions should not be used by
73 * board/chassis drivers.
75 u8
cpci_get_attention_status(struct slot
*slot
);
76 u8
cpci_get_latch_status(struct slot
*slot
);
77 u8
cpci_get_adapter_status(struct slot
*slot
);
78 u16
cpci_get_hs_csr(struct slot
*slot
);
79 int cpci_set_attention_status(struct slot
*slot
, int status
);
80 int cpci_check_and_clear_ins(struct slot
*slot
);
81 int cpci_check_ext(struct slot
*slot
);
82 int cpci_clear_ext(struct slot
*slot
);
83 int cpci_led_on(struct slot
*slot
);
84 int cpci_led_off(struct slot
*slot
);
85 int cpci_configure_slot(struct slot
*slot
);
86 int cpci_unconfigure_slot(struct slot
*slot
);
88 #ifdef CONFIG_HOTPLUG_PCI_CPCI
89 int cpci_hotplug_init(int debug
);
91 static inline int cpci_hotplug_init(int debug
) { return 0; }
94 #endif /* _CPCI_HOTPLUG_H */