cpci_hotplug.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * CompactPCI Hot Plug Core Functions
  3. *
  4. * Copyright (C) 2002 SOMA Networks, Inc.
  5. * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
  6. * Copyright (C) 2001 IBM Corp.
  7. *
  8. * All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  18. * NON INFRINGEMENT. See the GNU General Public License for more
  19. * details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. *
  25. * Send feedback to <scottm@somanetworks.com>
  26. */
  27. #ifndef _CPCI_HOTPLUG_H
  28. #define _CPCI_HOTPLUG_H
  29. #include <linux/types.h>
  30. #include <linux/pci.h>
  31. #include <linux/pci_hotplug.h>
  32. /* PICMG 2.1 R2.0 HS CSR bits: */
  33. #define HS_CSR_INS 0x0080
  34. #define HS_CSR_EXT 0x0040
  35. #define HS_CSR_PI 0x0030
  36. #define HS_CSR_LOO 0x0008
  37. #define HS_CSR_PIE 0x0004
  38. #define HS_CSR_EIM 0x0002
  39. #define HS_CSR_DHA 0x0001
  40. struct slot {
  41. u8 number;
  42. unsigned int devfn;
  43. struct pci_bus *bus;
  44. struct pci_dev *dev;
  45. unsigned int extracting;
  46. struct hotplug_slot *hotplug_slot;
  47. struct list_head slot_list;
  48. };
  49. struct cpci_hp_controller_ops {
  50. int (*query_enum) (void);
  51. int (*enable_irq) (void);
  52. int (*disable_irq) (void);
  53. int (*check_irq) (void *dev_id);
  54. int (*hardware_test) (struct slot *slot, u32 value);
  55. u8 (*get_power) (struct slot *slot);
  56. int (*set_power) (struct slot *slot, int value);
  57. };
  58. struct cpci_hp_controller {
  59. unsigned int irq;
  60. unsigned long irq_flags;
  61. char *devname;
  62. void *dev_id;
  63. char *name;
  64. struct cpci_hp_controller_ops *ops;
  65. };
  66. static inline const char *slot_name(struct slot *slot)
  67. {
  68. return hotplug_slot_name(slot->hotplug_slot);
  69. }
  70. int cpci_hp_register_controller(struct cpci_hp_controller *controller);
  71. int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
  72. int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
  73. int cpci_hp_unregister_bus(struct pci_bus *bus);
  74. int cpci_hp_start(void);
  75. int cpci_hp_stop(void);
  76. /*
  77. * Internal function prototypes, these functions should not be used by
  78. * board/chassis drivers.
  79. */
  80. u8 cpci_get_attention_status(struct slot *slot);
  81. u8 cpci_get_latch_status(struct slot *slot);
  82. u8 cpci_get_adapter_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. #ifdef CONFIG_HOTPLUG_PCI_CPCI
  93. int cpci_hotplug_init(int debug);
  94. void cpci_hotplug_exit(void);
  95. #else
  96. static inline int cpci_hotplug_init(int debug) { return 0; }
  97. static inline void cpci_hotplug_exit(void) { }
  98. #endif
  99. #endif /* _CPCI_HOTPLUG_H */