| 1 | /* SPDX-License-Identifier: GPL-2.0+ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * CompactPCI Hot Plug Core Functions | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (C) 2002 SOMA Networks, Inc. | 
|---|
| 6 | * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com) | 
|---|
| 7 | * Copyright (C) 2001 IBM Corp. | 
|---|
| 8 | * | 
|---|
| 9 | * All rights reserved. | 
|---|
| 10 | * | 
|---|
| 11 | * Send feedback to <scottm@somanetworks.com> | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | #ifndef _CPCI_HOTPLUG_H | 
|---|
| 15 | #define _CPCI_HOTPLUG_H | 
|---|
| 16 |  | 
|---|
| 17 | #include <linux/types.h> | 
|---|
| 18 | #include <linux/pci.h> | 
|---|
| 19 | #include <linux/pci_hotplug.h> | 
|---|
| 20 |  | 
|---|
| 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 | 
|---|
| 29 |  | 
|---|
| 30 | struct slot { | 
|---|
| 31 | u8 number; | 
|---|
| 32 | unsigned int devfn; | 
|---|
| 33 | struct pci_bus *bus; | 
|---|
| 34 | struct pci_dev *dev; | 
|---|
| 35 | unsigned int latch_status:1; | 
|---|
| 36 | unsigned int adapter_status:1; | 
|---|
| 37 | unsigned int ; | 
|---|
| 38 | struct hotplug_slot hotplug_slot; | 
|---|
| 39 | struct list_head slot_list; | 
|---|
| 40 | }; | 
|---|
| 41 |  | 
|---|
| 42 | struct cpci_hp_controller_ops { | 
|---|
| 43 | int (*query_enum)(void); | 
|---|
| 44 | int (*enable_irq)(void); | 
|---|
| 45 | int (*disable_irq)(void); | 
|---|
| 46 | int (*check_irq)(void *dev_id); | 
|---|
| 47 | }; | 
|---|
| 48 |  | 
|---|
| 49 | struct cpci_hp_controller { | 
|---|
| 50 | unsigned int irq; | 
|---|
| 51 | unsigned long irq_flags; | 
|---|
| 52 | char *devname; | 
|---|
| 53 | void *dev_id; | 
|---|
| 54 | char *name; | 
|---|
| 55 | struct cpci_hp_controller_ops *ops; | 
|---|
| 56 | }; | 
|---|
| 57 |  | 
|---|
| 58 | static inline const char *slot_name(struct slot *slot) | 
|---|
| 59 | { | 
|---|
| 60 | return hotplug_slot_name(slot: &slot->hotplug_slot); | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | static inline struct slot *to_slot(struct hotplug_slot *hotplug_slot) | 
|---|
| 64 | { | 
|---|
| 65 | return container_of(hotplug_slot, struct slot, hotplug_slot); | 
|---|
| 66 | } | 
|---|
| 67 |  | 
|---|
| 68 | int cpci_hp_register_controller(struct cpci_hp_controller *controller); | 
|---|
| 69 | int cpci_hp_unregister_controller(struct cpci_hp_controller *controller); | 
|---|
| 70 | int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last); | 
|---|
| 71 | int cpci_hp_unregister_bus(struct pci_bus *bus); | 
|---|
| 72 | int cpci_hp_start(void); | 
|---|
| 73 | int cpci_hp_stop(void); | 
|---|
| 74 |  | 
|---|
| 75 | /* Global variables */ | 
|---|
| 76 | extern int cpci_debug; | 
|---|
| 77 |  | 
|---|
| 78 | /* | 
|---|
| 79 | * Internal function prototypes, these functions should not be used by | 
|---|
| 80 | * board/chassis drivers. | 
|---|
| 81 | */ | 
|---|
| 82 | u8 cpci_get_attention_status(struct slot *slot); | 
|---|
| 83 | u16 cpci_get_hs_csr(struct slot *slot); | 
|---|
| 84 | int cpci_set_attention_status(struct slot *slot, int status); | 
|---|
| 85 | int cpci_check_and_clear_ins(struct slot *slot); | 
|---|
| 86 | int cpci_check_ext(struct slot *slot); | 
|---|
| 87 | int cpci_clear_ext(struct slot *slot); | 
|---|
| 88 | int cpci_led_on(struct slot *slot); | 
|---|
| 89 | int cpci_led_off(struct slot *slot); | 
|---|
| 90 | int cpci_configure_slot(struct slot *slot); | 
|---|
| 91 | int cpci_unconfigure_slot(struct slot *slot); | 
|---|
| 92 |  | 
|---|
| 93 | #ifdef CONFIG_HOTPLUG_PCI_CPCI | 
|---|
| 94 | int cpci_hotplug_init(int debug); | 
|---|
| 95 | #else | 
|---|
| 96 | static inline int cpci_hotplug_init(int debug) { return 0; } | 
|---|
| 97 | #endif | 
|---|
| 98 |  | 
|---|
| 99 | #endif	/* _CPCI_HOTPLUG_H */ | 
|---|
| 100 |  | 
|---|