radeon_atomwrapper.c revision b7e1c893
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 "atombios.h"
35#include "CD_Definitions.h"
36
37
38int
39ParseTableWrapper(void *pspace, int index, void *handle, void *BIOSBase,
40		  char **msg_return)
41{
42    DEVICE_DATA deviceData;
43    int ret = 0;
44
45    /* FILL OUT PARAMETER SPACE */
46    deviceData.pParameterSpace = (UINT32*) pspace;
47    deviceData.CAIL = handle;
48    deviceData.pBIOS_Image = BIOSBase;
49    deviceData.format = TABLE_FORMAT_BIOS;
50
51    switch (ParseTable(&deviceData, index)) { /* IndexInMasterTable */
52	case CD_SUCCESS:
53	    ret = 1;
54	    *msg_return = "ParseTable said: CD_SUCCESS";
55	    break;
56	case CD_CALL_TABLE:
57	    ret = 1;
58	    *msg_return = "ParseTable said: CD_CALL_TABLE";
59	    break;
60	case CD_COMPLETED:
61	    ret = 1;
62	    *msg_return = "ParseTable said: CD_COMPLETED";
63	    break;
64	case CD_GENERAL_ERROR:
65	    ret = 0;
66	    *msg_return = " ParseTable said: CD_GENERAL_ERROR";
67	    break;
68	case CD_INVALID_OPCODE:
69	    ret = 0;
70	    *msg_return = " ParseTable said: CD_INVALID_OPCODE";
71	    break;
72	case CD_NOT_IMPLEMENTED:
73	    ret = 0;
74	    *msg_return = " ParseTable said: CD_NOT_IMPLEMENTED";
75	    break;
76	case CD_EXEC_TABLE_NOT_FOUND:
77	    ret = 0;
78	    *msg_return = " ParseTable said: CD_EXEC_TABLE_NOT_FOUND";
79	    break;
80	case CD_EXEC_PARAMETER_ERROR:
81	    ret = 0;
82	    *msg_return = " ParseTable said: CD_EXEC_PARAMETER_ERROR";
83	    break;
84	case CD_EXEC_PARSER_ERROR:
85	    ret = 0;
86	    *msg_return = " ParseTable said: CD_EXEC_PARSER_ERROR";
87	    break;
88	case CD_INVALID_DESTINATION_TYPE:
89	    ret = 0;
90	    *msg_return = " ParseTable said: CD_INVALID_DESTINATION_TYPE";
91	    break;
92	case CD_UNEXPECTED_BEHAVIOR:
93	    ret = 0;
94	    *msg_return = " ParseTable said: CD_UNEXPECTED_BEHAVIOR";
95	    break;
96	case CD_INVALID_SWITCH_OPERAND_SIZE:
97	    ret = 0;
98	    *msg_return = " ParseTable said: CD_INVALID_SWITCH_OPERAND_SIZE\n";
99	    break;
100    }
101    return ret;
102}
103