Chameleon

Chameleon Commit Details

Date:2010-01-17 14:27:43 (14 years 3 months ago)
Author:JrCs
Commit:18
Parents: 17
Message:New RestartFix option to patch FADT to fix restart
Changes:
M/branches/JrCs/i386/libsaio/acpi.h
M/branches/JrCs/i386/libsaio/dsdt_patcher.c
M/branches/JrCs/i386/boot2/boot.h

File differences

branches/JrCs/i386/libsaio/dsdt_patcher.c
99
1010
1111
12
1213
1314
1415
......
124125
125126
126127
128
127129
130
131
132
133
134
135
136
137
138
139
140
141
128142
129143
130144
......
139153
140154
141155
156
157
158
159
160
161
162
163
164
165
166
167
168
142169
143170
144171
#include "efi_tables.h"
#include "fake_efi.h"
#include "dsdt_patcher.h"
#include "platform.h"
#ifndef DEBUG_DSDT
#define DEBUG_DSDT 0
struct acpi_2_fadt *fadt_mod;
BOOL fadt_rev2_needed = NO;
BOOL fix_restart;
// Restart Fix
if (Platform.CPU.Vendor == 0x756E6547) {/* Intel */
fix_restart = YES;
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->bootConfig);
} else {
verbose ("Not an Intel platform: Restart Fix not applied !!!\n");
fix_restart = NO;
}
if (fix_restart)
fadt_rev2_needed = YES;
// Allocate new fadt table
if (fadt->Length < 0x84 && fadt_rev2_needed)
{
memcpy(fadt_mod, fadt, fadt->Length);
}
// Patch FADT to fix restart
if (fix_restart)
{
fadt_mod->Flags|= 0x400;
fadt_mod->Reset_SpaceID= 0x01; // System I/O
fadt_mod->Reset_BitWidth= 0x08; // 1 byte
fadt_mod->Reset_BitOffset= 0x00; // Offset 0
fadt_mod->Reset_AccessWidth= 0x01; // Byte access
fadt_mod->Reset_Address= 0x0cf9; // Address of the register
fadt_mod->Reset_Value= 0x06; // Value to write to reset the system
verbose("FADT: Restart Fix applied !\n");
}
// Patch DSDT Address
DBG("DSDT: Old @%x,%x, ",fadt_mod->DSDT,fadt_mod->X_DSDT);
branches/JrCs/i386/libsaio/acpi.h
7272
7373
7474
75
75
76
77
78
79
80
81
82
83
84
85
86
7687
7788
7889
uint32_t FIRMWARE_CTRL;
uint32_t DSDT;
/*We absolutely don't care about theese fields*/
uint8_t notimp1[88];
uint8_t notimp1[68];
//Reset Fix
uint32_t Flags;
uint8_t Reset_SpaceID;
uint8_t Reset_BitWidth;
uint8_t Reset_BitOffset;
uint8_t Reset_AccessWidth;
uint64_t Reset_Address;
uint8_t Reset_Value;
uint8_t Reserved[3];
uint64_t X_FIRMWARE_CTRL;
uint64_t X_DSDT;
/*We absolutely don't care about theese fields*/
branches/JrCs/i386/boot2/boot.h
5858
5959
6060
61
6162
6263
6364
#define kGUIKey "GUI"
#define kBootBannerKey "Boot Banner"
#define kWaitForKeypressKey "Wait"
#define kRestartFix "RestartFix" /* dsdt_patcher.c */
/*
* Flags to the booter or kernel

Archive Download the corresponding diff file

Revision: 18