cpci_hotplug.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #ifndef _CPCI_HOTPLUG_H
  14. #define _CPCI_HOTPLUG_H
  15. #include <linux/types.h>
  16. #include <linux/pci.h>
  17. #include <linux/pci_hotplug.h>
  18. /* PICMG 2.1 R2.0 HS CSR bits: */
  19. #define HS_CSR_INS 0x0080
  20. #define HS_CSR_EXT 0x0040
  21. #define HS_CSR_PI 0x0030
  22. #define HS_CSR_LOO 0x0008
  23. #define HS_CSR_PIE 0x0004
  24. #define HS_CSR_EIM 0x0002
  25. #define HS_CSR_DHA 0x0001
  26. struct slot {
  27. u8 number;
  28. unsigned int devfn;
  29. struct pci_bus *bus;
  30. struct pci_dev *dev;
  31. unsigned int extracting;
  32. struct hotplug_slot *hotplug_slot;
  33. struct list_head slot_list;
  34. };
  35. struct cpci_hp_controller_ops {
  36. int (*query_enum)(void);
  37. int (*enable_irq)(void);
  38. int (*disable_irq)(void);
  39. int (*check_irq)(void *dev_id);
  40. int (*hardware_test)(struct slot *slot, u32 value);
  41. u8 (*get_power)(struct slot *slot);
  42. int (*set_power)(struct slot *slot, int value);
  43. };
  44. struct cpci_hp_controller {
  45. unsigned int irq;
  46. unsigned long irq_flags;
  47. char *devname;
  48. void *dev_id;
  49. char *name;
  50. struct cpci_hp_controller_ops *ops;
  51. };
  52. static inline const char *slot_name(struct slot *slot)
  53. {
  54. return hotplug_slot_name(slot->hotplug_slot);
  55. }
  56. int cpci_hp_register_controller(struct cpci_hp_controller *controller);
  57. int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
  58. int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
  59. int cpci_hp_unregister_bus(struct pci_bus *bus);
  60. int cpci_hp_start(void);
  61. int cpci_hp_stop(void);
  62. /*
  63. * Internal function prototypes, these functions should not be used by
  64. * board/chassis drivers.
  65. */
  66. u8 cpci_get_attention_status(struct slot *slot);
  67. u8 cpci_get_latch_status(struct slot *slot);
  68. u8 cpci_get_adapter_status(struct slot *slot);
  69. u16 cpci_get_hs_csr(struct slot *slot);
  70. int cpci_set_attention_status(struct slot *slot, int status);
  71. int cpci_check_and_clear_ins(struct slot *slot);
  72. int cpci_check_ext(struct slot *slot);
  73. int cpci_clear_ext(struct slot *slot);
  74. int cpci_led_on(struct slot *slot);
  75. int cpci_led_off(struct slot *slot);
  76. int cpci_configure_slot(struct slot *slot);
  77. int cpci_unconfigure_slot(struct slot *slot);
  78. #ifdef CONFIG_HOTPLUG_PCI_CPCI
  79. int cpci_hotplug_init(int debug);
  80. #else
  81. static inline int cpci_hotplug_init(int debug) { return 0; }
  82. #endif
  83. #endif /* _CPCI_HOTPLUG_H */