~ubuntu-branches/ubuntu/maverick/ipmitool/maverick

« back to all changes in this revision

Viewing changes to src/plugins/imb/imbapi.h

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2005-04-07 01:18:44 UTC
  • Revision ID: james.westby@ubuntu.com-20050407011844-a1b206z5iefiu5vi
Tags: upstream-1.8.1
ImportĀ upstreamĀ versionĀ 1.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*M*
 
2
//  PVCS:
 
3
//      $Workfile:   imb_api.h  $
 
4
//      $Revision: 1.2 $
 
5
//      $Modtime:   Jul 22 2002 16:40:32  $
 
6
//      $Author: iceblink $
 
7
// 
 
8
//  Combined include files needed for imbapi.c
 
9
//
 
10
 *M*/
 
11
/*----------------------------------------------------------------------* 
 
12
The BSD License 
 
13
Copyright (c) 2002, Intel Corporation
 
14
All rights reserved.
 
15
Redistribution and use in source and binary forms, with or without 
 
16
modification, are permitted provided that the following conditions are met:
 
17
  a.. Redistributions of source code must retain the above copyright notice, 
 
18
      this list of conditions and the following disclaimer. 
 
19
  b.. Redistributions in binary form must reproduce the above copyright notice,
 
20
      this list of conditions and the following disclaimer in the documentation 
 
21
      and/or other materials provided with the distribution. 
 
22
  c.. Neither the name of Intel Corporation nor the names of its contributors 
 
23
      may be used to endorse or promote products derived from this software 
 
24
      without specific prior written permission. 
 
25
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 
26
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 
27
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 
28
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
 
29
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
 
30
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
 
31
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
 
32
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 
33
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 
34
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
35
 *----------------------------------------------------------------------*/
 
36
#ifndef _WINDEFS_H
 
37
#define _WINDEFS_H
 
38
#ifndef FALSE
 
39
#define FALSE   0
 
40
#endif
 
41
#ifndef TRUE
 
42
#define TRUE    1
 
43
#endif
 
44
#ifndef NULL
 
45
#define NULL 0
 
46
#endif
 
47
#ifndef WIN32   
 
48
/* WIN32 defines this in stdio.h */
 
49
#ifndef _WCHAR_T
 
50
#define _WCHAR_T
 
51
typedef long    wchar_t;
 
52
#endif
 
53
#endif
 
54
#define far
 
55
#define near
 
56
#define FAR                 far
 
57
#define NEAR                near
 
58
#ifndef CONST
 
59
#define CONST               const
 
60
#endif
 
61
typedef unsigned long       DWORD;
 
62
typedef int                 BOOL;
 
63
typedef unsigned char       BYTE;
 
64
typedef unsigned short      WORD;
 
65
typedef float               FLOAT;
 
66
typedef FLOAT               *PFLOAT;
 
67
typedef BOOL near           *PBOOL;
 
68
typedef BOOL far            *LPBOOL;
 
69
typedef BYTE near           *PBYTE;
 
70
typedef BYTE far            *LPBYTE;
 
71
typedef int near            *PINT;
 
72
typedef int far             *LPINT;
 
73
typedef WORD near           *PWORD;
 
74
typedef WORD far            *LPWORD;
 
75
typedef long far            *LPLONG;
 
76
typedef DWORD near          *PDWORD;
 
77
typedef DWORD far           *LPDWORD;
 
78
typedef void far            *LPVOID;
 
79
typedef CONST void far      *LPCVOID;
 
80
typedef int                 INT;
 
81
typedef unsigned int        UINT;
 
82
typedef unsigned int        *PUINT;
 
83
typedef DWORD NTSTATUS;
 
84
/*
 
85
  File structures
 
86
*/
 
87
#ifndef WIN32
 
88
typedef struct _OVERLAPPED {
 
89
    DWORD   Internal;
 
90
    DWORD   InternalHigh;
 
91
    DWORD   Offset;
 
92
    DWORD   OffsetHigh;
 
93
/*    HANDLE  hEvent; */
 
94
} OVERLAPPED, *LPOVERLAPPED;
 
95
#endif
 
96
/*
 
97
 * Data structure redefines
 
98
 */
 
99
typedef char CHAR;
 
100
typedef short SHORT;
 
101
typedef long LONG;
 
102
typedef char * PCHAR;
 
103
typedef short * PSHORT;
 
104
typedef long * PLONG;
 
105
typedef unsigned char UCHAR;
 
106
typedef unsigned short USHORT;
 
107
typedef unsigned long ULONG;
 
108
typedef unsigned char * PUCHAR;
 
109
typedef unsigned short * PUSHORT;
 
110
typedef unsigned long * PULONG;
 
111
typedef char CCHAR;
 
112
typedef short CSHORT;
 
113
typedef ULONG CLONG;
 
114
typedef CCHAR * PCCHAR;
 
115
typedef CSHORT * PCSHORT;
 
116
typedef CLONG * PCLONG;
 
117
typedef void * PVOID;
 
118
#ifndef WIN32
 
119
typedef void VOID;
 
120
typedef struct _LARGE_INTEGER {
 
121
        ULONG LowPart;
 
122
        LONG HighPart;
 
123
} LARGE_INTEGER;
 
124
typedef struct _ULARGE_INTEGER {
 
125
        ULONG LowPart;
 
126
        ULONG HighPart;
 
127
} ULARGE_INTEGER;
 
128
#endif
 
129
typedef LARGE_INTEGER * PLARGE_INTEGER;
 
130
typedef LARGE_INTEGER PHYSICAL_ADDRESS;
 
131
typedef LARGE_INTEGER * PPHYSICAL_ADDRESS;
 
132
typedef ULARGE_INTEGER * PULARGE_INTEGER;
 
133
typedef UCHAR BOOLEAN;
 
134
typedef BOOLEAN *PBOOLEAN;
 
135
typedef wchar_t             WCHAR;
 
136
typedef WCHAR               *PWCHAR, *PWSTR;
 
137
typedef CONST WCHAR         *LPCWSTR, *PCWSTR;
 
138
 
 
139
#ifndef _SYS_TYPES_H
 
140
#ifndef _CADDR_T
 
141
#define _CADDR_T
 
142
  typedef char *        caddr_t;
 
143
#endif
 
144
#endif
 
145
/*
 
146
 Unicode strings are counted 16-bit character strings. If they are
 
147
 NULL terminated, Length does not include trailing NULL.
 
148
*/
 
149
typedef struct _UNICODE_STRING {
 
150
    USHORT Length;
 
151
    USHORT MaximumLength;
 
152
    PWSTR  Buffer;
 
153
} UNICODE_STRING;
 
154
typedef UNICODE_STRING *PUNICODE_STRING;
 
155
#define UNICODE_NULL ((WCHAR)0)   /* winnt*/
 
156
#define IN      /* */
 
157
#define OUT     /* */
 
158
#define OPTIONAL        /* */
 
159
 
 
160
#ifndef WIN32
 
161
#define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
 
162
#define UNREFERENCED_PARAMETER(x)
 
163
typedef int HANDLE;
 
164
#define INVALID_HANDLE_VALUE    ((HANDLE)-1)
 
165
#endif
 
166
typedef HANDLE  *PHANDLE;
 
167
/*
 
168
 Define the method codes for how buffers are passed for I/O and FS controls
 
169
*/
 
170
#define METHOD_BUFFERED                 0
 
171
/*
 
172
 Define the access check value for any access
 
173
 The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
 
174
 ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
 
175
 constants *MUST* always be in sync.
 
176
*/
 
177
#define FILE_ANY_ACCESS                 0
 
178
/*
 
179
  These are the generic rights.
 
180
*/
 
181
#define    MAX_PATH        260
 
182
#define GetLastError()  (NTstatus.Status)
 
183
/*
 
184
 Macro definition for defining IOCTL and FSCTL function control codes.  Note
 
185
 that function codes 0-2047 are reserved for Microsoft Corporation, and
 
186
 2048-4095 are reserved for customers.
 
187
*/
 
188
/*
 
189
 * Linux drivers expect ioctls defined using macros defined in ioctl.h.
 
190
 * So, instead of using the CTL_CODE defined for NT and UW, I define CTL_CODE
 
191
 * using these macros. That way imb_if.h, where the ioctls are defined get
 
192
 * to use the correct ioctl command we expect. 
 
193
 * Notes: I am using the generic _IO macro instead of the more specific
 
194
 * ones. The macros expect 8bit entities, so I am cleaning what is sent to
 
195
 * us from imb_if.h  - Mahendra
 
196
 */
 
197
#ifndef WIN32
 
198
#define CTL_CODE(DeviceType, Function, Method, Access)\
 
199
                _IO(DeviceType & 0x00FF, Function & 0x00FF)
 
200
#else
 
201
#define CTL_CODE( DeviceType, Function, Method, Access ) ((ULONG)(      \
 
202
    ((ULONG)(DeviceType) << 16) | ((ULONG)(Access) << 14) | ((ULONG)(Function) << 2) | ((ULONG)Method) \
 
203
))
 
204
#endif
 
205
#endif /*_WINDEFS_H */
 
206
/*----------------------------------------------------------------------*/
 
207
#ifndef _SMI_H
 
208
#define _SMI_H
 
209
#define SMI_Version1_00 0x00001000
 
210
struct smi {
 
211
    DWORD smi_VersionNo;
 
212
    DWORD smi_Reserved1;
 
213
    DWORD smi_Reserved2;
 
214
    LPVOID ntstatus;    /* address of NT status block*/
 
215
    LPVOID  lpvInBuffer;        /* address of buffer for input data*/
 
216
    DWORD  cbInBuffer;  /* size of input buffer*/
 
217
    LPVOID  lpvOutBuffer;       /* address of output buffer*/
 
218
    DWORD  cbOutBuffer; /* size of output buffer*/
 
219
    LPDWORD  lpcbBytesReturned; /* address of actual bytes of output*/
 
220
    LPOVERLAPPED  lpoOverlapped;         /* address of overlapped structure*/
 
221
};
 
222
#ifndef STATUS_SUCCESS
 
223
typedef struct _IO_STATUS_BLOCK {
 
224
    ULONG Status;
 
225
    ULONG Information;
 
226
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
 
227
/*
 
228
 * I2C ioctl's return NTStatus codes
 
229
 */
 
230
#define STATUS_SUCCESS                   (0x00000000U)
 
231
#define STATUS_UNSUCCESSFUL              (0xC0000001U)
 
232
#define STATUS_DEVICE_BUSY               (0x80000011U)
 
233
#ifndef WIN32
 
234
#define STATUS_PENDING                   (0x00000103U)
 
235
// see <win2000ddk>\inc\winnt.h(1171)
 
236
#endif
 
237
#define STATUS_INVALID_PARAMETER         (0xC000000DU)
 
238
#define STATUS_INVALID_DEVICE_REQUEST    (0xC0000010U)
 
239
#define STATUS_BUFFER_TOO_SMALL          (0xC0000023U)
 
240
#define STATUS_FILE_CLOSED               (0xC0000128U)
 
241
#define STATUS_INSUFFICIENT_RESOURCES    (0xC000009AU)
 
242
#define STATUS_NO_DATA_DETECTED          (0x80000022U)
 
243
#define STATUS_NO_SUCH_DEVICE            (0xC000000EU)
 
244
#define STATUS_ALLOTTED_EXCEEDED         (0xC000000FU)
 
245
#define STATUS_IO_DEVICE_ERROR           (0xC0000185U)
 
246
#define STATUS_TOO_MANY_OPEN_FILES       (0xC000011FU)
 
247
#define STATUS_ACCESS_DENIED             (0xC0000022U)
 
248
#define STATUS_BUFFER_OVERFLOW           (0x80000005U)
 
249
#define STATUS_CANCELLED                 (0xC0000120U)
 
250
#endif  /* STATUS_SUCCESS*/
 
251
#endif  /* _SMI_H*/
 
252
/*----------------------------------------------------------------------*/
 
253
#ifndef IMB_IF__
 
254
#define IMB_IF__
 
255
/*
 
256
 * This is the structure passed in to the IOCTL_IMB_SHUTDOWN_CODE request
 
257
 */
 
258
typedef struct {
 
259
        int     code;           
 
260
        int     delayTime;  
 
261
} ShutdownCmdBuffer;
 
262
#define         SD_NO_ACTION                            0
 
263
#define         SD_RESET                                1
 
264
#define         SD_POWER_OFF                            2
 
265
#pragma pack(1)
 
266
/*
 
267
 * This is the generic IMB packet format, the final checksum cant be
 
268
 * represented in this structure and will show up as the last data byte
 
269
 */
 
270
typedef struct {
 
271
        BYTE rsSa;
 
272
        BYTE nfLn;
 
273
        BYTE cSum1;
 
274
        BYTE rqSa;
 
275
        BYTE seqLn;
 
276
        BYTE cmd;
 
277
        BYTE data[1];
 
278
} ImbPacket;
 
279
#define MIN_IMB_PACKET_SIZE     7       
 
280
#define MAX_IMB_PACKET_SIZE     33
 
281
/*
 
282
 * This is the standard IMB response format where the first byte of
 
283
 * IMB packet data is interpreted as a command completion code.
 
284
*/
 
285
typedef struct {
 
286
        BYTE rsSa;
 
287
        BYTE nfLn;
 
288
        BYTE cSum1;
 
289
        BYTE rqSa;
 
290
        BYTE seqLn;
 
291
        BYTE cmd;
 
292
        BYTE cCode;
 
293
        BYTE data[1];
 
294
} ImbRespPacket;
 
295
#define MIN_IMB_RESPONSE_SIZE   7       /* min packet + completion code */
 
296
#define MAX_IMB_RESPONSE_SIZE   MAX_IMB_PACKET_SIZE
 
297
/************************
 
298
 *  ImbRequestBuffer
 
299
 ************************/
 
300
/*D*
 
301
//  Name:       ImbRequestBuffer
 
302
//  Purpose:    Structure definition for holding IMB message data
 
303
//  Context:    Used by SendTimedImbpMessage and SendTimedI2cMessge
 
304
//              functions in the library interface. In use, it is overlayed on a
 
305
//                              char buffer of size MIN_IMB_REQ_BUF_SIZE + 
 
306
//  Fields:     
 
307
//              respBufSize     size of the response buffer
 
308
//
 
309
//              timeout         timeout value in milli seconds   
 
310
//                     
 
311
//              req             body of request to send
 
312
//              
 
313
*D*/                    
 
314
typedef struct {
 
315
        BYTE rsSa;
 
316
        BYTE cmd;
 
317
        BYTE netFn;
 
318
        BYTE rsLun;     
 
319
        BYTE dataLength;
 
320
        BYTE data[1];   
 
321
} ImbRequest;
 
322
typedef struct {
 
323
   DWORD        flags;                  /* request flags*/
 
324
#define NO_RESPONSE_EXPECTED    0x01    /*dont wait around for an IMB response*/
 
325
   DWORD        timeOut;                /* in uSec units*/
 
326
   ImbRequest   req;                    /* message buffer*/
 
327
} ImbRequestBuffer;
 
328
#define MIN_IMB_REQ_BUF_SIZE    13      /* a buffer without any request data*/
 
329
/************************
 
330
 *  ImbResponseBuffer
 
331
 ************************/
 
332
/*D*
 
333
//  Name:       ImbResponseBuffer
 
334
//  Purpose:    Structure definition for response of a previous send 
 
335
//  Context:    Used by DeviceIoControl to pass the message to be sent to
 
336
//              MISSMIC port
 
337
//  Fields:     
 
338
//              cCode           completion code returned by firmware
 
339
//              data            buffer for  response data from firmware
 
340
*D*/
 
341
typedef struct {
 
342
        BYTE       cCode;       
 
343
        BYTE       data[1];     
 
344
} ImbResponseBuffer;
 
345
#define MIN_IMB_RESP_BUF_SIZE   1       
 
346
#define MAX_IMB_RESP_SIZE               (MIN_IMB_RESP_BUF_SIZE + MAX_IMB_RESPONSE_SIZE)
 
347
#pragma pack()
 
348
/*
 
349
 * Async message access structures and types
 
350
 */
 
351
typedef DWORD   ImbAsyncSeq;
 
352
/*
 
353
 * This is the structure passed in to IOCTL_IMB_GET_ASYNC_MSG
 
354
*/
 
355
typedef struct {
 
356
        DWORD           timeOut;   
 
357
        ImbAsyncSeq     lastSeq;   
 
358
} ImbAsyncRequest;
 
359
#define ASYNC_SEQ_START         0
 
360
typedef struct {
 
361
        ImbAsyncSeq     thisSeq;
 
362
        BYTE data[1];
 
363
} ImbAsyncResponse;
 
364
#define MIN_ASYNC_RESP_SIZE     sizeof( ImbAsyncSeq )
 
365
#define MAX_ASYNC_RESP_SIZE     (MIN_ASYNC_RESP_SIZE + MAX_IMB_PACKET_SIZE)
 
366
/*
 
367
** Driver Ioctls
 
368
** In Linux, these calculate to:
 
369
** IOCTL_IMB_SEND_MESSAGE    =1082
 
370
** IOCTL_IMB_GET_ASYNC_MSG   =1088
 
371
** IOCTL_IMB_MAP_MEMORY      =108e
 
372
** IOCTL_IMB_UNMAP_MEMORY    =1090
 
373
** IOCTL_IMB_SHUTDOWN_CODE   =1092
 
374
** IOCTL_IMB_REGISTER_ASYNC_OBJ  =1098
 
375
** IOCTL_IMB_DEREGISTER_ASYNC_OBJ=109a
 
376
** IOCTL_IMB_CHECK_EVENT     =109c
 
377
** IOCTL_IMB_POLL_ASYNC      =1094
 
378
*/
 
379
#define FILE_DEVICE_IMB                 0x00008010
 
380
#define IOCTL_IMB_BASE                  0x00000880
 
381
#define IOCTL_IMB_SEND_MESSAGE          CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 2),  METHOD_BUFFERED, FILE_ANY_ACCESS)
 
382
#define IOCTL_IMB_GET_ASYNC_MSG         CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 8),  METHOD_BUFFERED, FILE_ANY_ACCESS)
 
383
#define IOCTL_IMB_MAP_MEMORY            CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 14), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
384
#define IOCTL_IMB_UNMAP_MEMORY          CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 16), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
385
#define IOCTL_IMB_SHUTDOWN_CODE         CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 18), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
386
#define IOCTL_IMB_REGISTER_ASYNC_OBJ    CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 24), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
387
#define IOCTL_IMB_DEREGISTER_ASYNC_OBJ  CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 26), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
388
#define IOCTL_IMB_CHECK_EVENT           CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 28), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
389
#define IOCTL_IMB_POLL_ASYNC            CTL_CODE(FILE_DEVICE_IMB, (IOCTL_IMB_BASE + 20), METHOD_BUFFERED, FILE_ANY_ACCESS)
 
390
#endif /* IMB_IF__ */
 
391
/*----------------------------------------------------------------------*/
 
392
/*  No asynchronous messages available */
 
393
#define IMB_MSG_NOT_AVAILABLE            ((NTSTATUS)0xE0070012L)
 
394
#ifdef IMBLOG_H__
 
395
/* Define the facility codes */
 
396
#define FACILITY_RPC_STUBS               0x3
 
397
#define FACILITY_RPC_RUNTIME             0x2
 
398
#define FACILITY_IO_ERROR_CODE           0x4
 
399
#define IMB_IO_ERROR_CODE                0x7
 
400
 
 
401
#define STATUS_SEVERITY_WARNING          0x2
 
402
#define STATUS_SEVERITY_SUCCESS          0x0
 
403
#define STATUS_SEVERITY_INFORMATIONAL    0x1
 
404
#define STATUS_SEVERITY_ERROR            0x3
 
405
/*  Not enough memory for internal storage  of device %1. */
 
406
#define INSUFFICIENT_RESOURCES           ((NTSTATUS)0xE0070001L)
 
407
 
 
408
#define INVALID_INPUT_BUFFER             ((NTSTATUS)0xE0070002L)
 
409
 
 
410
#define INVALID_OUTPUT_BUFFER            ((NTSTATUS)0xE0070003L)
 
411
 
 
412
#define IMB_SEND_TIMEOUT                 ((NTSTATUS)0xE0070004L)
 
413
 
 
414
#define IMB_RECEIVE_TIMEOUT              ((NTSTATUS)0xE0070005L)
 
415
 
 
416
#define IMB_IF_SEND_TIMEOUT              ((NTSTATUS)0xE0070006L)
 
417
 
 
418
#define IMB_IF_RECEIVE_TIMEOUT           ((NTSTATUS)0xE0040007L)
 
419
 
 
420
#define HARDWARE_FAILURE                 ((NTSTATUS)0xE0040008L)
 
421
 
 
422
#define DRIVER_FAILURE                   ((NTSTATUS)0xE0040009L)
 
423
 
 
424
#define IMB_INVALID_IF_RESPONSE          ((NTSTATUS)0xE004000AL)
 
425
 
 
426
#define IMB_INVALID_PACKET               ((NTSTATUS)0xE004000BL)
 
427
 
 
428
#define IMB_RESPONSE_DATA_OVERFLOW       ((NTSTATUS)0xE004000CL)
 
429
 
 
430
#define IMB_INVALID_REQUEST              ((NTSTATUS)0xE007000DL)
 
431
 
 
432
#define INVALID_DRIVER_IOCTL             ((NTSTATUS)0xE007000EL)
 
433
 
 
434
#define INVALID_DRIVER_REQUEST           ((NTSTATUS)0xE007000FL)
 
435
 
 
436
#define IMB_CANT_GET_SMS_BUFFER          ((NTSTATUS)0xE0070010L)
 
437
 
 
438
#define INPUT_BUFFER_TOO_SMALL           ((NTSTATUS)0xE0070011L)
 
439
 
 
440
#define IMB_SEND_ERROR                   ((NTSTATUS)0xE0070013L)
 
441
#endif /* IMBLOG_H__ */
 
442
/*----------------------------------------------------------------------*/
 
443
#ifndef IMBAPI_H__
 
444
#define IMBAPI_H__
 
445
#include <sys/types.h>
 
446
#define WRITE_READ_I2C          0x52
 
447
#define WRITE_EMP_BUFFER        0x7a
 
448
#define GET_DEVICE_ID           0x1
 
449
#define SEND_MESSAGE            0x34
 
450
#define BMC_SA                  0x20
 
451
#define BMC_LUN                 0
 
452
#define APP_NETFN               0x06
 
453
#define IPMI_09_VERSION         0x90
 
454
#define IPMI_10_VERSION         0x01
 
455
 
 
456
#define IPMI_15_VERSION         0x51
 
457
 
 
458
#ifndef IPMI10_GET_DEVICE_ID_RESP_LENGTH
 
459
#define IPMI10_GET_DEVICE_ID_RESP_LENGTH        12
 
460
#endif
 
461
 
 
462
#define IPMB_CHANNEL                    0x0
 
463
#define EMP_CHANNEL                     0x1
 
464
#define LAN_CHANNEL                     0x2
 
465
#define RESERVED_LUN                    0x3
 
466
#define IPMB_LUN                        0x2
 
467
#define EMP_LUN                         0x0
 
468
 
 
469
#define         PUBLIC_BUS              0
 
470
 
 
471
#define BMC_CONTROLLER                  0x20
 
472
#define FPC_CONTROLLER                  0x22
 
473
typedef enum {
 
474
        ACCESN_OK,
 
475
        ACCESN_ERROR,
 
476
        ACCESN_OUT_OF_RANGE,
 
477
        ACCESN_END_OF_DATA,
 
478
        ACCESN_UNSUPPORTED,
 
479
        ACCESN_INVALID_TRANSACTION,
 
480
        ACCESN_TIMED_OUT
 
481
} ACCESN_STATUS;
 
482
#pragma pack(1)
 
483
/*
 
484
 * Request structure provided to SendTimedImbpRequest()
 
485
*/
 
486
typedef struct {
 
487
        unsigned char   cmdType;
 
488
        unsigned char   rsSa;
 
489
        unsigned char   busType;        
 
490
        unsigned char   netFn;  
 
491
        unsigned char   rsLun;  
 
492
        unsigned char * data;   
 
493
        int             dataLength;
 
494
} IMBPREQUESTDATA;
 
495
/*
 
496
 * Request structure provided to SendTimedI2cRequest()
 
497
*/
 
498
typedef struct {
 
499
        unsigned char   rsSa;                           
 
500
        unsigned char   busType;                
 
501
        unsigned char   numberOfBytesToRead;
 
502
        unsigned char * data;                   
 
503
        int             dataLength;     
 
504
} I2CREQUESTDATA;
 
505
#pragma pack()
 
506
/*#ifdef IMB_API
 
507
 *
 
508
 * This section is provided to be able to compile using imb_if.h
 
509
 *
 
510
 *
 
511
 * function return type. This is also defined in the local instrumentation
 
512
 * so we ifdef here to avoid conflict.
 
513
*/
 
514
#define METHOD_BUFFERED         0
 
515
#define FILE_ANY_ACCESS         0
 
516
/*
 
517
 * This is necessary to compile using memIf.h
 
518
 */
 
519
typedef enum _INTERFACE_TYPE
 
520
{
 
521
    Internal,
 
522
    Isa,
 
523
    Eisa,
 
524
    MicroChannel,
 
525
    TurboChannel,
 
526
    MaximumInterfaceType
 
527
} INTERFACE_TYPE, * PINTERFACE_TYPE;
 
528
#ifdef WIN32
 
529
/* From memIf.h */
 
530
#pragma pack(1)
 
531
typedef struct
 
532
{
 
533
    INTERFACE_TYPE   InterfaceType; // Isa, Eisa, etc....
 
534
    ULONG            BusNumber;     // Bus number
 
535
    PHYSICAL_ADDRESS BusAddress;    // Bus-relative address
 
536
    ULONG            AddressSpace;  // 0 is memory, 1 is I/O
 
537
    ULONG            Length;        // Length of section to map
 
538
} PHYSICAL_MEMORY_INFO, * PPHYSICAL_MEMORY_INFO;
 
539
#pragma pack()
 
540
#endif
 
541
/*#else // not IMB_API */
 
542
/*
 
543
 * These are defined in imb_if.h but are needed by users of the imbapi library
 
544
*/
 
545
#define ASYNC_SEQ_START         0
 
546
/*
 
547
 * This is the generic IMB packet format, the final checksum cant be
 
548
 * represented in this structure and will show up as the last data byte
 
549
 */
 
550
/*
 
551
 #define MIN_IMB_PACKET_SIZE    7
 
552
 #define MAX_IMB_PACKET_SIZE    33
 
553
*/
 
554
#define MAX_BUFFER_SIZE         64
 
555
/*#endif // IMB_API */
 
556
/****************************** 
 
557
 *  FUNCTION PROTOTYPES
 
558
 ******************************/
 
559
ACCESN_STATUS
 
560
SendTimedImbpRequest (
 
561
        IMBPREQUESTDATA *reqPtr,
 
562
        int             timeOut,
 
563
        BYTE *          respDataPtr,
 
564
        int *           respDataLen,    
 
565
        BYTE *          completionCode
 
566
        );
 
567
ACCESN_STATUS
 
568
SendTimedI2cRequest (
 
569
        I2CREQUESTDATA *reqPtr, 
 
570
        int             timeOut,
 
571
        BYTE *          respDataPtr,    
 
572
        int *           respDataLen,
 
573
        BYTE *          completionCode  
 
574
        );
 
575
ACCESN_STATUS
 
576
SendAsyncImbpRequest (
 
577
        IMBPREQUESTDATA *reqPtr,
 
578
        BYTE *           seqNo          
 
579
        );
 
580
ACCESN_STATUS
 
581
GetAsyncImbpMessage (
 
582
        ImbPacket *     msgPtr, 
 
583
        DWORD *         msgLen, 
 
584
        DWORD           timeOut,
 
585
        ImbAsyncSeq *   seqNo,  
 
586
        DWORD           channelNumber 
 
587
        );
 
588
ACCESN_STATUS
 
589
GetAsyncImbpMessage_Ex (
 
590
        ImbPacket *     msgPtr, 
 
591
        DWORD *         msgLen,
 
592
        DWORD           timeOut,
 
593
        ImbAsyncSeq *   seqNo,  
 
594
        DWORD           channelNumber, 
 
595
        BYTE *          sessionHandle, 
 
596
        BYTE *          privilege 
 
597
        );
 
598
ACCESN_STATUS
 
599
UnmapPhysicalMemory( int virtualAddress, int Length );
 
600
ACCESN_STATUS
 
601
StartAsyncMesgPoll(void);
 
602
ACCESN_STATUS
 
603
MapPhysicalMemory (
 
604
        int startAddress,       
 
605
        int addressLength,
 
606
        int *virtualAddress     
 
607
        );
 
608
ACCESN_STATUS
 
609
SetShutDownCode (
 
610
        int delayTime,
 
611
        int code        
 
612
        );
 
613
ACCESN_STATUS
 
614
SendTimedEmpMessageResponse (
 
615
        ImbPacket * ptr,        
 
616
        char      *responseDataBuf,
 
617
        int       responseDataLen,
 
618
        int       timeOut
 
619
        );
 
620
ACCESN_STATUS
 
621
SendTimedEmpMessageResponse_Ex (
 
622
        ImbPacket * ptr,
 
623
        char      *responseDataBuf,
 
624
        int       responseDataLen,
 
625
        int       timeOut,      
 
626
        BYTE      sessionHandle,
 
627
        BYTE      channelNumber
 
628
        );
 
629
ACCESN_STATUS
 
630
SendTimedLanMessageResponse (
 
631
        ImbPacket * ptr,
 
632
        char      *responseDataBuf,
 
633
        int       responseDataLen,
 
634
        int       timeOut       
 
635
        );
 
636
ACCESN_STATUS
 
637
SendTimedLanMessageResponse_Ex (
 
638
        ImbPacket * ptr,
 
639
        char      *responseDataBuf,
 
640
        int       responseDataLen,
 
641
        int       timeOut       ,
 
642
        BYTE      sessionHandle,
 
643
        BYTE      channelNumber
 
644
        );
 
645
ACCESN_STATUS
 
646
IsAsyncMessageAvailable (unsigned int   eventId );
 
647
ACCESN_STATUS
 
648
RegisterForImbAsyncMessageNotification (unsigned int *handleId);
 
649
ACCESN_STATUS
 
650
UnRegisterForImbAsyncMessageNotification (unsigned int handleId,int iFlag);
 
651
BYTE    GetIpmiVersion(void);
 
652
#endif /* IMBAPI_H__ */