0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
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