radeon_atomwrapper.c revision 209ff23f
1/*
2 * Copyright 2007  Luc Verhaegen <lverhaegen@novell.com>
3 * Copyright 2007  Matthias Hopf <mhopf@novell.com>
4 * Copyright 2007  Egbert Eich   <eich@novell.com>
5 * Copyright 2007  Advanced Micro Devices, Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26#ifdef HAVE_CONFIG_H
27# include "config.h"
28#endif
29
30#include "radeon_atomwrapper.h"
31
32#define INT32 INT32
33#include "CD_Common_Types.h"
34#include "CD_Definitions.h"
35
36
37int
38ParseTableWrapper(void *pspace, int index, void *handle, void *BIOSBase,
39		  char **msg_return)
40{
41    DEVICE_DATA deviceData;
42    int ret = 0;
43
44    /* FILL OUT PARAMETER SPACE */
45    deviceData.pParameterSpace = (UINT32*) pspace;
46    deviceData.CAIL = handle;
47    deviceData.pBIOS_Image = BIOSBase;
48    deviceData.format = TABLE_FORMAT_BIOS;
49
50    switch (ParseTable(&deviceData, index)) { /* IndexInMasterTable */
51	case CD_SUCCESS:
52	    ret = 1;
53	    *msg_return = "ParseTable said: CD_SUCCESS";
54	    break;
55	case CD_CALL_TABLE:
56	    ret = 1;
57	    *msg_return = "ParseTable said: CD_CALL_TABLE";
58	    break;
59	case CD_COMPLETED:
60	    ret = 1;
61	    *msg_return = "ParseTable said: CD_COMPLETED";
62	    break;
63	case CD_GENERAL_ERROR:
64	    ret = 0;
65	    *msg_return = " ParseTable said: CD_GENERAL_ERROR";
66	    break;
67	case CD_INVALID_OPCODE:
68	    ret = 0;
69	    *msg_return = " ParseTable said: CD_INVALID_OPCODE";
70	    break;
71	case CD_NOT_IMPLEMENTED:
72	    ret = 0;
73	    *msg_return = " ParseTable said: CD_NOT_IMPLEMENTED";
74	    break;
75	case CD_EXEC_TABLE_NOT_FOUND:
76	    ret = 0;
77	    *msg_return = " ParseTable said: CD_EXEC_TABLE_NOT_FOUND";
78	    break;
79	case CD_EXEC_PARAMETER_ERROR:
80	    ret = 0;
81	    *msg_return = " ParseTable said: CD_EXEC_PARAMETER_ERROR";
82	    break;
83	case CD_EXEC_PARSER_ERROR:
84	    ret = 0;
85	    *msg_return = " ParseTable said: CD_EXEC_PARSER_ERROR";
86	    break;
87	case CD_INVALID_DESTINATION_TYPE:
88	    ret = 0;
89	    *msg_return = " ParseTable said: CD_INVALID_DESTINATION_TYPE";
90	    break;
91	case CD_UNEXPECTED_BEHAVIOR:
92	    ret = 0;
93	    *msg_return = " ParseTable said: CD_UNEXPECTED_BEHAVIOR";
94	    break;
95	case CD_INVALID_SWITCH_OPERAND_SIZE:
96	    ret = 0;
97	    *msg_return = " ParseTable said: CD_INVALID_SWITCH_OPERAND_SIZE\n";
98	    break;
99    }
100    return ret;
101}
102