blob: 3ddd75937a40e3d089f5ed2b964c0336bb80564e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
28#ifndef _CPCI_HOTPLUG_H
29#define _CPCI_HOTPLUG_H
30
31#include <linux/types.h>
32#include <linux/pci.h>
33
34/* PICMG 2.12 R2.0 HS CSR bits: */
35#define HS_CSR_INS 0x0080
36#define HS_CSR_EXT 0x0040
37#define HS_CSR_PI 0x0030
38#define HS_CSR_LOO 0x0008
39#define HS_CSR_PIE 0x0004
40#define HS_CSR_EIM 0x0002
41#define HS_CSR_DHA 0x0001
42
43struct slot {
44 u8 number;
45 unsigned int devfn;
46 struct pci_bus *bus;
47 struct pci_dev *dev;
48 unsigned int extracting;
49 struct hotplug_slot *hotplug_slot;
50 struct list_head slot_list;
51};
52
53struct cpci_hp_controller_ops {
54 int (*query_enum) (void);
55 int (*enable_irq) (void);
56 int (*disable_irq) (void);
57 int (*check_irq) (void *dev_id);
58 int (*hardware_test) (struct slot* slot, u32 value);
59 u8 (*get_power) (struct slot* slot);
60 int (*set_power) (struct slot* slot, int value);
61};
62
63struct cpci_hp_controller {
64 unsigned int irq;
65 unsigned long irq_flags;
66 char *devname;
67 void *dev_id;
68 char *name;
69 struct cpci_hp_controller_ops *ops;
70};
71
72extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
73extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
74extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
75extern int cpci_hp_unregister_bus(struct pci_bus *bus);
76extern int cpci_hp_start(void);
77extern int cpci_hp_stop(void);
78
79/*
80 * Internal function prototypes, these functions should not be used by
81 * board/chassis drivers.
82 */
83extern u8 cpci_get_attention_status(struct slot *slot);
84extern u8 cpci_get_latch_status(struct slot *slot);
85extern u8 cpci_get_adapter_status(struct slot *slot);
86extern u16 cpci_get_hs_csr(struct slot * slot);
87extern int cpci_set_attention_status(struct slot *slot, int status);
88extern int cpci_check_and_clear_ins(struct slot * slot);
89extern int cpci_check_ext(struct slot * slot);
90extern int cpci_clear_ext(struct slot * slot);
91extern int cpci_led_on(struct slot * slot);
92extern int cpci_led_off(struct slot * slot);
93extern int cpci_configure_slot(struct slot *slot);
94extern int cpci_unconfigure_slot(struct slot *slot);
95
96#endif /* _CPCI_HOTPLUG_H */