diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/char/ipmi/ipmi_si_sm.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_sm.h')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_sm.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/drivers/char/ipmi/ipmi_si_sm.h b/drivers/char/ipmi/ipmi_si_sm.h new file mode 100644 index 000000000000..a0212b004016 --- /dev/null +++ b/drivers/char/ipmi/ipmi_si_sm.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * ipmi_si_sm.h | ||
3 | * | ||
4 | * State machine interface for low-level IPMI system management | ||
5 | * interface state machines. This code is the interface between | ||
6 | * the ipmi_smi code (that handles the policy of a KCS, SMIC, or | ||
7 | * BT interface) and the actual low-level state machine. | ||
8 | * | ||
9 | * Author: MontaVista Software, Inc. | ||
10 | * Corey Minyard <minyard@mvista.com> | ||
11 | * source@mvista.com | ||
12 | * | ||
13 | * Copyright 2002 MontaVista Software Inc. | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify it | ||
16 | * under the terms of the GNU General Public License as published by the | ||
17 | * Free Software Foundation; either version 2 of the License, or (at your | ||
18 | * option) any later version. | ||
19 | * | ||
20 | * | ||
21 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
27 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
29 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
30 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | * | ||
32 | * You should have received a copy of the GNU General Public License along | ||
33 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
34 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
35 | */ | ||
36 | |||
37 | /* This is defined by the state machines themselves, it is an opaque | ||
38 | data type for them to use. */ | ||
39 | struct si_sm_data; | ||
40 | |||
41 | /* The structure for doing I/O in the state machine. The state | ||
42 | machine doesn't have the actual I/O routines, they are done through | ||
43 | this interface. */ | ||
44 | struct si_sm_io | ||
45 | { | ||
46 | unsigned char (*inputb)(struct si_sm_io *io, unsigned int offset); | ||
47 | void (*outputb)(struct si_sm_io *io, | ||
48 | unsigned int offset, | ||
49 | unsigned char b); | ||
50 | |||
51 | /* Generic info used by the actual handling routines, the | ||
52 | state machine shouldn't touch these. */ | ||
53 | void *info; | ||
54 | void *addr; | ||
55 | int regspacing; | ||
56 | int regsize; | ||
57 | int regshift; | ||
58 | }; | ||
59 | |||
60 | /* Results of SMI events. */ | ||
61 | enum si_sm_result | ||
62 | { | ||
63 | SI_SM_CALL_WITHOUT_DELAY, /* Call the driver again immediately */ | ||
64 | SI_SM_CALL_WITH_DELAY, /* Delay some before calling again. */ | ||
65 | SI_SM_TRANSACTION_COMPLETE, /* A transaction is finished. */ | ||
66 | SI_SM_IDLE, /* The SM is in idle state. */ | ||
67 | SI_SM_HOSED, /* The hardware violated the state machine. */ | ||
68 | SI_SM_ATTN /* The hardware is asserting attn and the | ||
69 | state machine is idle. */ | ||
70 | }; | ||
71 | |||
72 | /* Handlers for the SMI state machine. */ | ||
73 | struct si_sm_handlers | ||
74 | { | ||
75 | /* Put the version number of the state machine here so the | ||
76 | upper layer can print it. */ | ||
77 | char *version; | ||
78 | |||
79 | /* Initialize the data and return the amount of I/O space to | ||
80 | reserve for the space. */ | ||
81 | unsigned int (*init_data)(struct si_sm_data *smi, | ||
82 | struct si_sm_io *io); | ||
83 | |||
84 | /* Start a new transaction in the state machine. This will | ||
85 | return -2 if the state machine is not idle, -1 if the size | ||
86 | is invalid (to large or too small), or 0 if the transaction | ||
87 | is successfully completed. */ | ||
88 | int (*start_transaction)(struct si_sm_data *smi, | ||
89 | unsigned char *data, unsigned int size); | ||
90 | |||
91 | /* Return the results after the transaction. This will return | ||
92 | -1 if the buffer is too small, zero if no transaction is | ||
93 | present, or the actual length of the result data. */ | ||
94 | int (*get_result)(struct si_sm_data *smi, | ||
95 | unsigned char *data, unsigned int length); | ||
96 | |||
97 | /* Call this periodically (for a polled interface) or upon | ||
98 | receiving an interrupt (for a interrupt-driven interface). | ||
99 | If interrupt driven, you should probably poll this | ||
100 | periodically when not in idle state. This should be called | ||
101 | with the time that passed since the last call, if it is | ||
102 | significant. Time is in microseconds. */ | ||
103 | enum si_sm_result (*event)(struct si_sm_data *smi, long time); | ||
104 | |||
105 | /* Attempt to detect an SMI. Returns 0 on success or nonzero | ||
106 | on failure. */ | ||
107 | int (*detect)(struct si_sm_data *smi); | ||
108 | |||
109 | /* The interface is shutting down, so clean it up. */ | ||
110 | void (*cleanup)(struct si_sm_data *smi); | ||
111 | |||
112 | /* Return the size of the SMI structure in bytes. */ | ||
113 | int (*size)(void); | ||
114 | }; | ||
115 | |||
116 | /* Current state machines that we can use. */ | ||
117 | extern struct si_sm_handlers kcs_smi_handlers; | ||
118 | extern struct si_sm_handlers smic_smi_handlers; | ||
119 | extern struct si_sm_handlers bt_smi_handlers; | ||
120 | |||