Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #include "dm_services.h"
0027 
0028 #include "atom.h"
0029 
0030 #include "include/bios_parser_types.h"
0031 #include "bios_parser_helper.h"
0032 #include "command_table_helper.h"
0033 #include "command_table.h"
0034 #include "bios_parser_types_internal.h"
0035 
0036 uint8_t *bios_get_image(struct dc_bios *bp,
0037     uint32_t offset,
0038     uint32_t size)
0039 {
0040     if (bp->bios && offset + size < bp->bios_size)
0041         return bp->bios + offset;
0042     else
0043         return NULL;
0044 }
0045 
0046 #include "reg_helper.h"
0047 
0048 #define CTX \
0049     bios->ctx
0050 #define REG(reg)\
0051     (bios->regs->reg)
0052 
0053 #undef FN
0054 #define FN(reg_name, field_name) \
0055         ATOM_ ## field_name ## _SHIFT, ATOM_ ## field_name
0056 
0057 bool bios_is_accelerated_mode(
0058     struct dc_bios *bios)
0059 {
0060     uint32_t acc_mode;
0061     REG_GET(BIOS_SCRATCH_6, S6_ACC_MODE, &acc_mode);
0062     return (acc_mode == 1);
0063 }
0064 
0065 
0066 void bios_set_scratch_acc_mode_change(
0067     struct dc_bios *bios,
0068     uint32_t state)
0069 {
0070     REG_UPDATE(BIOS_SCRATCH_6, S6_ACC_MODE, state);
0071 }
0072 
0073 
0074 void bios_set_scratch_critical_state(
0075     struct dc_bios *bios,
0076     bool state)
0077 {
0078     uint32_t critial_state = state ? 1 : 0;
0079     REG_UPDATE(BIOS_SCRATCH_6, S6_CRITICAL_STATE, critial_state);
0080 }
0081 
0082 uint32_t bios_get_vga_enabled_displays(
0083     struct dc_bios *bios)
0084 {
0085     return REG_READ(BIOS_SCRATCH_3) & 0XFFFF;
0086 }
0087