Changeset 20464 in vbox
- Timestamp:
- Jun 10, 2009 2:27:05 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp
r20413 r20464 40 40 41 41 #ifdef VBOX_WITH_DYNAMIC_DSDT 42 42 43 static int prepareDynamicDsdt(PPDMDEVINS pDevIns, 43 44 void* *ppPtr, 44 45 size_t *puDsdtLen) 45 46 { 46 //LogRel(("file is %s\n", g_abVboxDslSource)); 47 ACPI_STATUS Status = AdInitialize(); 48 if (ACPI_FAILURE (Status)) 49 { 50 AssertFailed(); 51 return VERR_INVALID_PARAMETER; 52 } 53 54 Status = CmDoCompile(); 55 AcpiTerminate(); 56 57 if (Gbl_ExceptionCount[ASL_ERROR] > 0) 58 { 59 AssertFailed(); 60 return VERR_INVALID_PARAMETER; 61 } 62 63 LogRel(("OK file is %s\n", g_abVboxDslSource)); 47 64 *ppPtr = NULL; 48 65 *puDsdtLen = 0; … … 55 72 return 0; 56 73 } 74 75 #else 76 static int patchAml(PPDMDEVINS pDevIns, uint8_t* pAml, size_t uAmlLen) 77 { 78 uint16_t cNumCpus; 79 int rc; 80 81 rc = CFGMR3QueryU16Def(pDevIns->pCfgHandle, "NumCPUs", &cNumCpus, 1); 82 83 if (RT_FAILURE(rc)) 84 return rc; 85 86 /** 87 * Now search AML for: 88 * AML_PROCESSOR_OP (UINT16) 0x5b83 89 * and replace whole block with 90 * AML_NOOP_OP (UINT16) 0xa3 91 * for VCPU not configured 92 */ 93 uint16_t cAcpiCpus = 0; 94 for (uint32_t i = 0; i < uAmlLen - 5; i++) 95 { 96 /* 97 * AML_PROCESSOR_OP 98 * 99 * DefProcessor := ProcessorOp PkgLength NameString ProcID 100 PblkAddr PblkLen ObjectList 101 * ProcessorOp := ExtOpPrefix 0x83 102 * ProcID := ByteData 103 * PblkAddr := DwordData 104 * PblkLen := ByteData 105 */ 106 if ((pAml[i] == 0x5b) && (pAml[i+1] == 0x83)) 107 { 108 if ((pAml[i+3] != 'C') || (pAml[i+4] != 'P')) 109 /* false alarm, not named starting CP */ 110 continue; 111 112 /* Maybe use ProcID instead? */ 113 cAcpiCpus++; 114 if (cAcpiCpus <= cNumCpus) 115 continue; 116 117 /* Will fill unwanted CPU block with NOOPs */ 118 /* 119 * See 18.2.4 Package Length Encoding in ACPI spec 120 * for full format 121 */ 122 uint32_t cBytes = pAml[i + 2]; 123 AssertReleaseMsg((cBytes >> 6) == 0, 124 ("So far, we only understand simple package length")); 125 126 /* including AML_PROCESSOR_OP itself */ 127 for (uint32_t j = 0; j < cBytes + 2; j++) 128 pAml[i+j] = 0xa3; 129 130 /* Can increase i by cBytes + 1, but not really worth it */ 131 } 132 } 133 134 135 /* now recompute checksum, whole file byte sum must be 0 */ 136 pAml[9] = 0; 137 signed char Sum; 138 for (uint32_t i = 0; i < uAmlLen; i++) 139 Sum = (signed char) (Sum + pAml[i]); 140 pAml[9] = (uint8_t) (0 - Sum); 141 142 return 0; 143 } 57 144 #endif 58 145 … … 63 150 return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen); 64 151 #else 65 *ppPtr = AmlCode; 152 int rc; 153 154 rc = patchAml(pDevIns, &AmlCode[0], sizeof(AmlCode)); 155 if (RT_FAILURE(rc)) 156 return rc; 157 158 *ppPtr = &AmlCode[0]; 66 159 *puDsdtLen = sizeof(AmlCode); 160 67 161 return 0; 68 162 #endif -
trunk/src/VBox/Devices/PC/vbox.dsl
r19646 r20464 126 126 // if by accident Windows guest seen enabled CPU object, just boot from latest 127 127 // known good configuration, as it remembers state, even if ACPI object gets disabled. 128 // WARNING: processor objects _MUST_ be named starting from "CP" 129 // and processor block should not be too long, otherwise 130 // patching in VBoxAcpi.cpp will fail 128 131 Scope (\_PR) 129 132 { … … 142 145 ) 143 146 { 144 Method (_STA) { Return(\_SB.UCP1) }145 147 } 146 148 Processor (CPU2, /* Name */ … … 150 152 ) 151 153 { 152 Method (_STA) { Return(\_SB.UCP2) }153 154 } 154 155 Processor (CPU3, /* Name */ … … 158 159 ) 159 160 { 160 Method (_STA) { Return(\_SB.UCP3) } 161 } 162 Processor (CPU4, /* Name */ 163 0x04, /* Id */ 164 0x0, /* Processor IO ports range start */ 165 0x0 /* Processor IO ports range length */ 166 ) 167 { 168 } 169 Processor (CPU5, /* Name */ 170 0x05, /* Id */ 171 0x0, /* Processor IO ports range start */ 172 0x0 /* Processor IO ports range length */ 173 ) 174 { 175 } 176 Processor (CPU6, /* Name */ 177 0x06, /* Id */ 178 0x0, /* Processor IO ports range start */ 179 0x0 /* Processor IO ports range length */ 180 ) 181 { 182 } 183 Processor (CPU7, /* Name */ 184 0x07, /* Id */ 185 0x0, /* Processor IO ports range start */ 186 0x0 /* Processor IO ports range length */ 187 ) 188 { 189 } 190 Processor (CPU8, /* Name */ 191 0x08, /* Id */ 192 0x0, /* Processor IO ports range start */ 193 0x0 /* Processor IO ports range length */ 194 ) 195 { 196 } 197 Processor (CPU9, /* Name */ 198 0x09, /* Id */ 199 0x0, /* Processor IO ports range start */ 200 0x0 /* Processor IO ports range length */ 201 ) 202 { 203 } 204 Processor (CPUA, /* Name */ 205 0x0A, /* Id */ 206 0x0, /* Processor IO ports range start */ 207 0x0 /* Processor IO ports range length */ 208 ) 209 { 210 } 211 Processor (CPUB, /* Name */ 212 0x0B, /* Id */ 213 0x0, /* Processor IO ports range start */ 214 0x0 /* Processor IO ports range length */ 215 ) 216 { 217 } 218 Processor (CPUC, /* Name */ 219 0x0C, /* Id */ 220 0x0, /* Processor IO ports range start */ 221 0x0 /* Processor IO ports range length */ 222 ) 223 { 224 } 225 Processor (CPUD, /* Name */ 226 0x0D, /* Id */ 227 0x0, /* Processor IO ports range start */ 228 0x0 /* Processor IO ports range length */ 229 ) 230 { 231 } 232 Processor (CPUE, /* Name */ 233 0x0E, /* Id */ 234 0x0, /* Processor IO ports range start */ 235 0x0 /* Processor IO ports range length */ 236 ) 237 { 238 } 239 Processor (CPUF, /* Name */ 240 0x0F, /* Id */ 241 0x0, /* Processor IO ports range start */ 242 0x0 /* Processor IO ports range length */ 243 ) 244 { 161 245 } 162 246 } … … 180 264 // @todo: maybe make it bitmask instead? 181 265 UCP0, 32, 182 UCP1, 32,183 UCP2, 32,184 UCP3, 32,185 266 MEMH, 32, 186 267 URTC, 32,
Note:
See TracChangeset
for help on using the changeset viewer.