1209ff23fSmrg/*
2209ff23fSmrg * Copyright 2007  Luc Verhaegen <lverhaegen@novell.com>
3209ff23fSmrg * Copyright 2007  Matthias Hopf <mhopf@novell.com>
4209ff23fSmrg * Copyright 2007  Egbert Eich   <eich@novell.com>
5209ff23fSmrg * Copyright 2007  Advanced Micro Devices, Inc.
6209ff23fSmrg *
7209ff23fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
8209ff23fSmrg * copy of this software and associated documentation files (the "Software"),
9209ff23fSmrg * to deal in the Software without restriction, including without limitation
10209ff23fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11209ff23fSmrg * and/or sell copies of the Software, and to permit persons to whom the
12209ff23fSmrg * Software is furnished to do so, subject to the following conditions:
13209ff23fSmrg *
14209ff23fSmrg * The above copyright notice and this permission notice shall be included in
15209ff23fSmrg * all copies or substantial portions of the Software.
16209ff23fSmrg *
17209ff23fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18209ff23fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19209ff23fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20209ff23fSmrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21209ff23fSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22209ff23fSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23209ff23fSmrg * OTHER DEALINGS IN THE SOFTWARE.
24209ff23fSmrg */
25209ff23fSmrg
26209ff23fSmrg#ifdef HAVE_CONFIG_H
27209ff23fSmrg# include "config.h"
28209ff23fSmrg#endif
29209ff23fSmrg
30209ff23fSmrg#include "radeon_atomwrapper.h"
31209ff23fSmrg
32209ff23fSmrg#define INT32 INT32
33209ff23fSmrg#include "CD_Common_Types.h"
34b7e1c893Smrg#include "atombios.h"
35209ff23fSmrg#include "CD_Definitions.h"
36209ff23fSmrg
37209ff23fSmrg
38209ff23fSmrgint
39209ff23fSmrgParseTableWrapper(void *pspace, int index, void *handle, void *BIOSBase,
40209ff23fSmrg		  char **msg_return)
41209ff23fSmrg{
42209ff23fSmrg    DEVICE_DATA deviceData;
43209ff23fSmrg    int ret = 0;
44209ff23fSmrg
45209ff23fSmrg    /* FILL OUT PARAMETER SPACE */
46209ff23fSmrg    deviceData.pParameterSpace = (UINT32*) pspace;
47209ff23fSmrg    deviceData.CAIL = handle;
48209ff23fSmrg    deviceData.pBIOS_Image = BIOSBase;
49209ff23fSmrg    deviceData.format = TABLE_FORMAT_BIOS;
50209ff23fSmrg
51209ff23fSmrg    switch (ParseTable(&deviceData, index)) { /* IndexInMasterTable */
52209ff23fSmrg	case CD_SUCCESS:
53209ff23fSmrg	    ret = 1;
54209ff23fSmrg	    *msg_return = "ParseTable said: CD_SUCCESS";
55209ff23fSmrg	    break;
56209ff23fSmrg	case CD_CALL_TABLE:
57209ff23fSmrg	    ret = 1;
58209ff23fSmrg	    *msg_return = "ParseTable said: CD_CALL_TABLE";
59209ff23fSmrg	    break;
60209ff23fSmrg	case CD_COMPLETED:
61209ff23fSmrg	    ret = 1;
62209ff23fSmrg	    *msg_return = "ParseTable said: CD_COMPLETED";
63209ff23fSmrg	    break;
64209ff23fSmrg	case CD_GENERAL_ERROR:
65209ff23fSmrg	    ret = 0;
66209ff23fSmrg	    *msg_return = " ParseTable said: CD_GENERAL_ERROR";
67209ff23fSmrg	    break;
68209ff23fSmrg	case CD_INVALID_OPCODE:
69209ff23fSmrg	    ret = 0;
70209ff23fSmrg	    *msg_return = " ParseTable said: CD_INVALID_OPCODE";
71209ff23fSmrg	    break;
72209ff23fSmrg	case CD_NOT_IMPLEMENTED:
73209ff23fSmrg	    ret = 0;
74209ff23fSmrg	    *msg_return = " ParseTable said: CD_NOT_IMPLEMENTED";
75209ff23fSmrg	    break;
76209ff23fSmrg	case CD_EXEC_TABLE_NOT_FOUND:
77209ff23fSmrg	    ret = 0;
78209ff23fSmrg	    *msg_return = " ParseTable said: CD_EXEC_TABLE_NOT_FOUND";
79209ff23fSmrg	    break;
80209ff23fSmrg	case CD_EXEC_PARAMETER_ERROR:
81209ff23fSmrg	    ret = 0;
82209ff23fSmrg	    *msg_return = " ParseTable said: CD_EXEC_PARAMETER_ERROR";
83209ff23fSmrg	    break;
84209ff23fSmrg	case CD_EXEC_PARSER_ERROR:
85209ff23fSmrg	    ret = 0;
86209ff23fSmrg	    *msg_return = " ParseTable said: CD_EXEC_PARSER_ERROR";
87209ff23fSmrg	    break;
88209ff23fSmrg	case CD_INVALID_DESTINATION_TYPE:
89209ff23fSmrg	    ret = 0;
90209ff23fSmrg	    *msg_return = " ParseTable said: CD_INVALID_DESTINATION_TYPE";
91209ff23fSmrg	    break;
92209ff23fSmrg	case CD_UNEXPECTED_BEHAVIOR:
93209ff23fSmrg	    ret = 0;
94209ff23fSmrg	    *msg_return = " ParseTable said: CD_UNEXPECTED_BEHAVIOR";
95209ff23fSmrg	    break;
96209ff23fSmrg	case CD_INVALID_SWITCH_OPERAND_SIZE:
97209ff23fSmrg	    ret = 0;
98209ff23fSmrg	    *msg_return = " ParseTable said: CD_INVALID_SWITCH_OPERAND_SIZE\n";
99209ff23fSmrg	    break;
100209ff23fSmrg    }
101209ff23fSmrg    return ret;
102209ff23fSmrg}
103