test: config/ia64/initia64.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# initia64.c File Reference

`#include "cmp.h"`
`#include "stdio.h"`

Go to the source code of this file.

## Defines

#define | TITLE_INDEX_VALUE 0
#define | BIOS_DATE_LENGTH 9
#define | MAXIMUM_BIOS_VERSION_LENGTH 128
#define | SYSTEM_BIOS_START 0xF0000
#define | SYSTEM_BIOS_LENGTH 0x10000
#define | INT10_VECTOR 0x10
#define | VIDEO_BIOS_START 0xC0000
#define | VIDEO_BIOS_LENGTH 0x8000
#define | VERSION_DATA_LENGTH PAGE_SIZE
#define | CPUID_PROCESSOR_NAME_STRING_SZ 48
#define | CPUID_EXTFN_BASE 0x80000000
#define | CPUID_EXTFN_PROCESSOR_NAME 0x80000002

## Functions

BOOLEAN | CmpGetBiosVersion (PCHAR SearchArea, ULONG SearchLength, PCHAR VersionString)
BOOLEAN | CmpGetBiosDate (PCHAR SearchArea, ULONG SearchLength, PCHAR DateString)
ULONG | Ke386CyrixId (VOID)
NTSTATUS | CmpInitializeMachineDependentConfiguration (IN PLOADER_PARAMETER_BLOCK LoaderBlock)

## Variables

PCHAR | SearchStrings []
PCHAR | BiosBegin
PCHAR | Start
PCHAR | End
UCHAR | CmpID1 []
UCHAR | CmpID2 []
WCHAR | CmpVendorID []
WCHAR | CmpProcessorNameString []
WCHAR | CmpFeatureBits []
WCHAR | CmpMHz []
WCHAR | CmpUpdateSignature []
UCHAR | CmpCyrixID []
UCHAR | CmpIntelID []
UCHAR | CmpAmdID []
ULONG | CmpConfigurationAreaSize
PCM_FULL_RESOURCE_DESCRIPTOR | CmpConfigurationData

## Define Documentation

#define BIOS_DATE_LENGTH 9

| Definition at line 59 of file config/ia64/initia64.c.

#define CPUID_EXTFN_BASE 0x80000000

| Definition at line 73 of file config/ia64/initia64.c.

#define CPUID_EXTFN_PROCESSOR_NAME 0x80000002

| Definition at line 74 of file config/ia64/initia64.c.

#define CPUID_PROCESSOR_NAME_STRING_SZ 48

| Definition at line 72 of file config/ia64/initia64.c.

#define INT10_VECTOR 0x10

| Definition at line 63 of file config/ia64/initia64.c.

#define MAXIMUM_BIOS_VERSION_LENGTH 128

| Definition at line 60 of file config/ia64/initia64.c.

#define SYSTEM_BIOS_LENGTH 0x10000

| Definition at line 62 of file config/ia64/initia64.c.

#define SYSTEM_BIOS_START 0xF0000

| Definition at line 61 of file config/ia64/initia64.c.

#define TITLE_INDEX_VALUE 0

| Definition at line 38 of file config/ia64/initia64.c.

#define VERSION_DATA_LENGTH PAGE_SIZE

| Definition at line 66 of file config/ia64/initia64.c.

#define VIDEO_BIOS_LENGTH 0x8000

| Definition at line 65 of file config/ia64/initia64.c.

#define VIDEO_BIOS_START 0xC0000

| Definition at line 64 of file config/ia64/initia64.c.

## Function Documentation

BOOLEAN CmpGetBiosDate | ( | PCHAR | SearchArea,
|  | ULONG | SearchLength,
|  | PCHAR | DateString
| ) |

Definition at line 108 of file config/ia64/initia64.c.

References BIOS_DATE_LENGTH, CHAR, End, FALSE, NULL, Start, String, TRUE, and USHORT.

Referenced by CmpInitializeMachineDependentConfiguration().

    00116                    :
    00117
    00118     This routine finds the most recent date in the computer/video
    00119     card's ROM.  When GetRomDate encounters a datae, it checks the
    00120     previously found date to see if the new date is more recent.
    00121
    00122 Arguments:
    00123
    00124     SearchArea - the area to search for a date.
    00125
    00126     SearchLength - Length of search.
    00127
    00128     DateString - Supplies a pointer to a fixed length memory to receive
    00129                  the date string.
    00130
    00131 Return Value:
    00132
    00133     NT_SUCCESS if a date is found.
    00134
    00135 --*/
    00136
    00137 {
    00138     BOOLEAN FoundFlag = TRUE;        // Set to TRUE if the item was found
    00139     CHAR PrevDate[BIOS_DATE_LENGTH]; // Date currently being examined
    00140     CHAR CurrDate[BIOS_DATE_LENGTH]; // Date currently being examined
    00141     PCHAR String;
    00142     USHORT i;                        // Looping variable
    00143     USHORT Length;                   // Number of characters to move
    00144     PCHAR Start = SearchArea + 2;
    00145     PCHAR End = SearchArea + SearchLength - 5;
    00146
    00147     //
    00148     // Clear out the previous date
    00149     //
    00150
    00151     RtlZeroMemory(PrevDate, BIOS_DATE_LENGTH);
    00152
    00153     while (FoundFlag) {
    00154
    00155         String = NULL;
    00156
    00157         //
    00158         // Search for '/' with a digit on either side and another
    00159         // '/' 3 character away.
    00160         //
    00161
    00162         while (Start < End) {
    00163             if (*Start == '/' && *(Start+3) == '/' &&
    00164                 (*(Start+1) <= '9' && *(Start+1) >= '0') &&
    00165                 (*(Start-1) <= '9' && *(Start-1) >= '0') &&
    00166                 (*(Start+5) <= '9' && *(Start+5) >= '0') &&
    00167                 (*(Start+4) <= '9' && *(Start+4) >= '0') &&
    00168                 (*(Start+2) <= '9' && *(Start+2) >= '0')) {
    00169
    00170                 String = Start;
    00171                 break;
    00172             } else {
    00173                 Start++;
    00174             }
    00175         }
    00176
    00177         if (String) {
    00178             Start = String + 3;
    00179             String -= 2;                 // Move String to the beginning of
    00180                                          //   date.
    00181             //
    00182             // Copy the year into CurrDate
    00183             //
    00184
    00185             CurrDate[0] = String[6];
    00186             CurrDate[1] = String[7];
    00187             CurrDate[2] = '/';           // The 1st "/" for YY/MM/DD
    00188
    00189             //
    00190             // Copy the month & day into CurrDate
    00191             //   (Process properly if this is a one digit month)
    00192             //
    00193
    00194             if (*String > '9' || *String < '0') {
    00195                 CurrDate[3] = '0';
    00196                 String++;
    00197                 i = 4;
    00198                 Length = 4;
    00199             } else {
    00200                 i = 3;
    00201                 Length = 5;
    00202             }
    00203
    00204             RtlMoveMemory(&CurrDate[i], String, Length);
    00205
    00206             //
    00207             // Compare the dates, to see which is more recent
    00208             //
    00209
    00210             if (memcmp (PrevDate, CurrDate, BIOS_DATE_LENGTH - 1) < 0) {
    00211                 RtlMoveMemory(PrevDate, CurrDate, BIOS_DATE_LENGTH - 1);
    00212             }
    00213         } else {
    00214             FoundFlag = FALSE;
    00215         }
    00216     }
    00217
    00218     //
    00219     // If we did not find a date
    00220     //
    00221
    00222     if (PrevDate[0] == '\0') {
    00223         DateString[0] = '\0';
    00224         return (FALSE);
    00225     }
    00226
    00227     //
    00228     // Put the date from chPrevDate's YY/MM/DD format
    00229     //   into pchDateString's MM/DD/YY format
    00230
    00231     DateString[5] = '/';
    00232     DateString[6] = PrevDate[0];
    00233     DateString[7] = PrevDate[1];
    00234     RtlMoveMemory(DateString, &PrevDate[3], 5);
    00235     DateString[8] = '\0';
    00236
    00237     return (TRUE);
    00238 }

BOOLEAN CmpGetBiosVersion | ( | PCHAR | SearchArea,
|  | ULONG | SearchLength,
|  | PCHAR | VersionString
| ) |

| Referenced by CmpInitializeMachineDependentConfiguration().

NTSTATUS CmpInitializeMachineDependentConfiguration | ( | IN PLOADER_PARAMETER_BLOCK | LoaderBlock | ) |

Definition at line 364 of file config/ia64/initia64.c.

References Buffer, CentralProcessor, CmClassName, CmpAmdID, CmpConfigurationAreaSize, CmpConfigurationData, CmpCyrixID, CmpFeatureBits, CmpGetBiosDate(), CmpGetBiosVersion(), CmpID1, CmpID2, CmpInitializeRegistryNode(), CmpMHz, CmpProcessorNameString, CmpUpdateSignature, CmpVendorID, CmRegistryMachineHardwareDescriptionSystemName, CPUID(), CPUID_EXTFN_BASE, CPUID_EXTFN_PROCESSOR_NAME, CPUID_PROCESSOR_NAME_STRING_SZ, ExAllocatePool, ExFreePool(), FloatingPointProcessor, INT10_VECTOR, Ke386CyrixId(), KeI386NpxPresent, KeNumberProcessors, KeRevertToUserAffinityThread(), KeSetSystemAffinityThread(), KeyName, KiProcessorBlock, L, MAXIMUM_BIOS_VERSION_LENGTH, NT_SUCCESS, NtClose(), NtCreateKey(), NtOpenKey(), NtSetValueKey(), NTSTATUS(), NULL, NUMBER_TYPES, ObjectAttributes, PAGE_SIZE, PagedPool, ProcessorClass, RtlAnsiStringToUnicodeString(), RtlFreeUnicodeString(), RtlInitAnsiString(), RtlInitUnicodeString(), sprintf(), Status, strlen(), SYSTEM_BIOS_LENGTH, SYSTEM_BIOS_START, TITLE_INDEX_VALUE, TRUE, USHORT, ValueName, VERSION_DATA_LENGTH, VIDEO_BIOS_LENGTH, and VIDEO_BIOS_START.

    00369                    :
    00370
    00371     This routine creates x86 specific entries in the registry.
    00372
    00373 Arguments:
    00374
    00375     LoaderBlock - supplies a pointer to the LoaderBlock passed in from the
    00376                   OS Loader.
    00377
    00378 Returns:
    00379
    00380     NTSTATUS code for sucess or reason of failure.
    00381
    00382 --*/
    00383 {
    00384     NTSTATUS Status;
    00385     ULONG VideoBiosStart;
    00386     UNICODE_STRING KeyName;
    00387     UNICODE_STRING ValueName;
    00388     UNICODE_STRING ValueData;
    00389     ANSI_STRING AnsiString;
    00390     OBJECT_ATTRIBUTES ObjectAttributes;
    00391     ULONG Disposition;
    00392     HANDLE ParentHandle;
    00393     HANDLE BaseHandle, NpxHandle;
    00394     HANDLE CurrentControlSet;
    00395     CONFIGURATION_COMPONENT_DATA CurrentEntry;
    00396     PUCHAR VendorID;
    00397     UCHAR  Buffer[MAXIMUM_BIOS_VERSION_LENGTH];
    00398     PKPRCB Prcb;
    00399     ULONG  i, Junk;
    00400     ULONG VersionsLength = 0, Length;
    00401     PCHAR VersionStrings, VersionPointer;
    00402     UNICODE_STRING SectionName;
    00403     ULONG ViewSize;
    00404     LARGE_INTEGER ViewBase;
    00405     PVOID BaseAddress;
    00406     HANDLE SectionHandle;
    00407     USHORT DeviceIndexTable[NUMBER_TYPES];
    00408     ULONG CpuIdFunction;
    00409     ULONG MaxExtFn;
    00410     PULONG NameString = NULL;
    00411     struct {
    00412         union {
    00413             UCHAR   Bytes[CPUID_PROCESSOR_NAME_STRING_SZ];
    00414             ULONG   DWords[1];
    00415         } u;
    00416     } ProcessorNameString;
    00417
    00418     for (i = 0; i < NUMBER_TYPES; i++) {
    00419         DeviceIndexTable[i] = 0;
    00420     }
    00421
    00422     InitializeObjectAttributes( &ObjectAttributes,
    00423                                 &CmRegistryMachineHardwareDescriptionSystemName,
    00424                                 OBJ_CASE_INSENSITIVE,
    00425                                 NULL,
    00426                                 NULL
    00427                               );
    00428
    00429     Status = NtOpenKey( &ParentHandle,
    00430                         KEY_READ,
    00431                         &ObjectAttributes
    00432                       );
    00433
    00434     if (!NT_SUCCESS(Status)) {
    00435         // Something is really wrong...
    00436         return Status;
    00437     }
    00438
    00439
    00440     //
    00441     // On an ARC machine the processor(s) are included in the hardware
    00442     // configuration passed in from bootup.  Since there's no standard
    00443     // way to get all the ARC information for each processor in an MP
    00444     // machine via pc-ROMs the information will be added here (if it's
    00445     // not already present).
    00446     //
    00447
    00448     RtlInitUnicodeString( &KeyName,
    00449                           L"CentralProcessor"
    00450                         );
    00451
    00452     InitializeObjectAttributes(
    00453         &ObjectAttributes,
    00454         &KeyName,
    00455         0,
    00456         ParentHandle,
    00457         NULL
    00458         );
    00459
    00460     ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE;
    00461
    00462     Status = NtCreateKey(
    00463                 &BaseHandle,
    00464                 KEY_READ | KEY_WRITE,
    00465                 &ObjectAttributes,
    00466                 TITLE_INDEX_VALUE,
    00467                 &CmClassName[ProcessorClass],
    00468                 0,
    00469                 &Disposition
    00470                 );
    00471
    00472     NtClose (BaseHandle);
    00473
    00474     if (Disposition == REG_CREATED_NEW_KEY) {
    00475
    00476         //
    00477         // The ARC rom didn't add the processor(s) into the registry.
    00478         // Do it now.
    00479         //
    00480
    00481         CmpConfigurationData = (PCM_FULL_RESOURCE_DESCRIPTOR)ExAllocatePool(
    00482                                             PagedPool,
    00483                                             CmpConfigurationAreaSize
    00484                                             );
    00485
    00486         if (CmpConfigurationData == NULL) {
    00487             // bail out
    00488             NtClose (ParentHandle);
    00489             return(STATUS_INSUFFICIENT_RESOURCES);
    00490         }
    00491
    00492         for (i=0; i < (ULONG)KeNumberProcessors; i++) {
    00493             Prcb = KiProcessorBlock[i];
    00494
    00495             RtlZeroMemory (&CurrentEntry, sizeof CurrentEntry);
    00496             CurrentEntry.ComponentEntry.Class = ProcessorClass;
    00497             CurrentEntry.ComponentEntry.Type = CentralProcessor;
    00498             CurrentEntry.ComponentEntry.Key = i;
    00499             CurrentEntry.ComponentEntry.AffinityMask = 1 << i;
    00500
    00501             CurrentEntry.ComponentEntry.Identifier = Buffer;
    00502 #ifndef _IA64_
    00503             if (Prcb->CpuID == 0) {
    00504
    00505                 //
    00506                 // Old style stepping format
    00507                 //
    00508
    00509                 sprintf (Buffer, CmpID1,
    00510                     Prcb->CpuType,
    00511                     (Prcb->CpuStep >> 8) + 'A',
    00512                     Prcb->CpuStep & 0xff
    00513                     );
    00514
    00515             } else {
    00516
    00517                 //
    00518                 // New style stepping format
    00519                 //
    00520
    00521                 sprintf (Buffer, CmpID2,
    00522                     Prcb->CpuType,
    00523                     (Prcb->CpuStep >> 8),
    00524                     Prcb->CpuStep & 0xff
    00525                     );
    00526             }
    00527 #endif _IA64_
    00528
    00529             CurrentEntry.ComponentEntry.IdentifierLength =
    00530                 strlen (Buffer) + 1;
    00531
    00532             Status = CmpInitializeRegistryNode(
    00533                 &CurrentEntry,
    00534                 ParentHandle,
    00535                 &BaseHandle,
    00536                 -1,
    00537                 (ULONG)-1,
    00538                 DeviceIndexTable
    00539                 );
    00540
    00541             if (!NT_SUCCESS(Status)) {
    00542                 return(Status);
    00543             }
    00544
    00545
    00546 #ifndef _IA64_
    00547             if (KeI386NpxPresent) {
    00548                 RtlZeroMemory (&CurrentEntry, sizeof CurrentEntry);
    00549                 CurrentEntry.ComponentEntry.Class = ProcessorClass;
    00550                 CurrentEntry.ComponentEntry.Type = FloatingPointProcessor;
    00551                 CurrentEntry.ComponentEntry.Key = i;
    00552                 CurrentEntry.ComponentEntry.AffinityMask = 1 << i;
    00553
    00554                 CurrentEntry.ComponentEntry.Identifier = Buffer;
    00555
    00556                 if (Prcb->CpuType == 3) {
    00557
    00558                     //
    00559                     // 386 processors have 387's installed, else
    00560                     // use processor identifier as the NPX identifier
    00561                     //
    00562
    00563                     strcpy (Buffer, "80387");
    00564                 }
    00565
    00566                 CurrentEntry.ComponentEntry.IdentifierLength =
    00567                     strlen (Buffer) + 1;
    00568
    00569                 Status = CmpInitializeRegistryNode(
    00570                     &CurrentEntry,
    00571                     ParentHandle,
    00572                     &NpxHandle,
    00573                     -1,
    00574                     (ULONG)-1,
    00575                     DeviceIndexTable
    00576                     );
    00577
    00578                 if (!NT_SUCCESS(Status)) {
    00579                     NtClose(BaseHandle);
    00580                     return(Status);
    00581                 }
    00582
    00583                 NtClose(NpxHandle);
    00584             }
    00585
    00586             //
    00587             // If processor supports Cpu Indentification then
    00588             // go obtain that information for the registry
    00589             //
    00590
    00591             VendorID = Prcb->CpuID ? Prcb->VendorString : NULL;
    00592
    00593             //
    00594             // Move to target processor and get other related
    00595             // processor information for the registery
    00596             //
    00597
    00598             KeSetSystemAffinityThread(Prcb->SetMember);
    00599
    00600             if (!Prcb->CpuID) {
    00601
    00602                 //
    00603                 // Test for Cyrix processor
    00604                 //
    00605
    00606                 if (Ke386CyrixId ()) {
    00607                     VendorID = CmpCyrixID;
    00608                 }
    00609             } else {
    00610
    00611                 //
    00612                 // If this processor has extended CPUID functions, get
    00613                 // the ProcessorNameString.  This is currently only
    00614                 // true for AMD processors.  Intel should be adding
    00615                 // this support shortly.  On AMD processors that don't
    00616                 // support extended functions, the CPUID instruction
    00617                 // returns 0 for function 0x80000000.
    00618                 //
    00619
    00620                 if (strcmp(VendorID, CmpAmdID) == 0) {
    00621
    00622                     CPUID(CPUID_EXTFN_BASE, &MaxExtFn, &Junk, &Junk, &Junk);
    00623
    00624                     if (MaxExtFn >= (CPUID_EXTFN_PROCESSOR_NAME + 2)) {
    00625
    00626                         //
    00627                         // This processor supports extended CPUID functions
    00628                         // up to and (at least) including processor name string.
    00629                         //
    00630                         // Each CPUID call for the processor name string will
    00631                         // return 16 bytes, 48 bytes in all, zero terminated.
    00632                         //
    00633
    00634                         NameString = &ProcessorNameString.u.DWords[0];
    00635
    00636                         for (CpuIdFunction = CPUID_EXTFN_PROCESSOR_NAME;
    00637                              CpuIdFunction <= (CPUID_EXTFN_PROCESSOR_NAME+2);
    00638                              CpuIdFunction++) {
    00639
    00640                             CPUID(CpuIdFunction,
    00641                                   NameString,
    00642                                   NameString + 1,
    00643                                   NameString + 2,
    00644                                   NameString + 3);
    00645                             NameString += 4;
    00646                         }
    00647
    00648                         //
    00649                         // Enforce 0 byte terminator.
    00650                         //
    00651
    00652                         ProcessorNameString.u.Bytes[CPUID_PROCESSOR_NAME_STRING_SZ-1] = 0;
    00653                     }
    00654                 }
    00655             }
    00656
    00657             //
    00658             // Restore thread's affinity to all processors
    00659             //
    00660
    00661             KeRevertToUserAffinityThread();
    00662
    00663             if (NameString) {
    00664
    00665                 //
    00666                 // Add Processor Name String to the registery
    00667                 //
    00668
    00669                 RtlInitUnicodeString(
    00670                     &ValueName,
    00671                     CmpProcessorNameString
    00672                     );
    00673
    00674                 RtlInitAnsiString(
    00675                     &AnsiString,
    00676                     ProcessorNameString.u.Bytes
    00677                     );
    00678
    00679                 RtlAnsiStringToUnicodeString(
    00680                     &ValueData,
    00681                     &AnsiString,
    00682                     TRUE
    00683                     );
    00684
    00685                 Status = NtSetValueKey(
    00686                             BaseHandle,
    00687                             &ValueName,
    00688                             TITLE_INDEX_VALUE,
    00689                             REG_SZ,
    00690                             ValueData.Buffer,
    00691                             ValueData.Length + sizeof( UNICODE_NULL )
    00692                             );
    00693
    00694                 RtlFreeUnicodeString(&ValueData);
    00695             }
    00696
    00697             if (VendorID) {
    00698
    00699                 //
    00700                 // Add Vendor Indentifier to the registery
    00701                 //
    00702
    00703                 RtlInitUnicodeString(
    00704                     &ValueName,
    00705                     CmpVendorID
    00706                     );
    00707
    00708                 RtlInitAnsiString(
    00709                     &AnsiString,
    00710                     VendorID
    00711                     );
    00712
    00713                 RtlAnsiStringToUnicodeString(
    00714                     &ValueData,
    00715                     &AnsiString,
    00716                     TRUE
    00717                     );
    00718
    00719                 Status = NtSetValueKey(
    00720                             BaseHandle,
    00721                             &ValueName,
    00722                             TITLE_INDEX_VALUE,
    00723                             REG_SZ,
    00724                             ValueData.Buffer,
    00725                             ValueData.Length + sizeof( UNICODE_NULL )
    00726                             );
    00727
    00728                 RtlFreeUnicodeString(&ValueData);
    00729             }
    00730
    00731             if (Prcb->FeatureBits) {
    00732                 //
    00733                 // Add processor feature bits to the registery
    00734                 //
    00735
    00736                 RtlInitUnicodeString(
    00737                     &ValueName,
    00738                     CmpFeatureBits
    00739                     );
    00740
    00741                 Status = NtSetValueKey(
    00742                             BaseHandle,
    00743                             &ValueName,
    00744                             TITLE_INDEX_VALUE,
    00745                             REG_DWORD,
    00746                             &Prcb->FeatureBits,
    00747                             sizeof (Prcb->FeatureBits)
    00748                             );
    00749             }
    00750
    00751             if (Prcb->MHz) {
    00752                 //
    00753                 // Add processor MHz to the registery
    00754                 //
    00755
    00756                 RtlInitUnicodeString(
    00757                     &ValueName,
    00758                     CmpMHz
    00759                     );
    00760
    00761                 Status = NtSetValueKey(
    00762                             BaseHandle,
    00763                             &ValueName,
    00764                             TITLE_INDEX_VALUE,
    00765                             REG_DWORD,
    00766                             &Prcb->MHz,
    00767                             sizeof (Prcb->MHz)
    00768                             );
    00769             }
    00770
    00771             if (Prcb->UpdateSignature.QuadPart) {
    00772                 //
    00773                 // Add processor MHz to the registery
    00774                 //
    00775
    00776                 RtlInitUnicodeString(
    00777                     &ValueName,
    00778                     CmpUpdateSignature
    00779                     );
    00780
    00781                 Status = NtSetValueKey(
    00782                             BaseHandle,
    00783                             &ValueName,
    00784                             TITLE_INDEX_VALUE,
    00785                             REG_BINARY,
    00786                             &Prcb->UpdateSignature,
    00787                             sizeof (Prcb->UpdateSignature)
    00788                             );
    00789             }
    00790
    00791             NtClose(BaseHandle);
    00792 #endif _IA64_
    00793         }
    00794
    00795         ExFreePool((PVOID)CmpConfigurationData);
    00796     }
    00797
    00798 #ifndef _IA64_
    00799     //
    00800     // Next we try to collect System BIOS date and version strings.
    00801     // BUGBUG This code should be moved to ntdetect.com after product 1.
    00802     //
    00803
    00804     //
    00805     // Open a physical memory section to map in physical memory.
    00806     //
    00807
    00808     RtlInitUnicodeString(
    00809         &SectionName,
    00810         L"\\Device\\PhysicalMemory"
    00811         );
    00812
    00813     InitializeObjectAttributes(
    00814         &ObjectAttributes,
    00815         &SectionName,
    00816         OBJ_CASE_INSENSITIVE,
    00817         (HANDLE) NULL,
    00818         (PSECURITY_DESCRIPTOR) NULL
    00819         );
    00820
    00821     Status = ZwOpenSection(
    00822         &SectionHandle,
    00823         SECTION_ALL_ACCESS,
    00824         &ObjectAttributes
    00825         );
    00826
    00827     if (!NT_SUCCESS(Status)) {
    00828
    00829         //
    00830         // If fail, forget the bios data and version
    00831         //
    00832
    00833         goto AllDone;
    00834     }
    00835
    00836     //
    00837     // Examine the first page of physical memory for int 10 segment
    00838     // address.
    00839     //
    00840
    00841     BaseAddress = 0;
    00842     ViewSize = 0x1000;
    00843     ViewBase.LowPart = 0;
    00844     ViewBase.HighPart = 0;
    00845
    00846     Status =ZwMapViewOfSection(
    00847         SectionHandle,
    00848         NtCurrentProcess(),
    00849         &BaseAddress,
    00850         0,
    00851         ViewSize,
    00852         &ViewBase,
    00853         &ViewSize,
    00854         ViewUnmap,
    00855         MEM_DOS_LIM,
    00856         PAGE_READWRITE
    00857         );
    00858
    00859     if (!NT_SUCCESS(Status)) {
    00860         VideoBiosStart = VIDEO_BIOS_START;
    00861     } else {
    00862         VideoBiosStart = (*((PULONG)BaseAddress + INT10_VECTOR) & 0xFFFF0000) >> 12;
    00863         VideoBiosStart += (*((PULONG)BaseAddress + INT10_VECTOR) & 0x0000FFFF);
    00864         VideoBiosStart &= 0xffff8000;
    00865         if (VideoBiosStart < VIDEO_BIOS_START) {
    00866             VideoBiosStart = VIDEO_BIOS_START;
    00867         }
    00868         Status = ZwUnmapViewOfSection(
    00869             NtCurrentProcess(),
    00870             BaseAddress
    00871             );
    00872     }
    00873
    00874     VersionStrings = ExAllocatePool(PagedPool, VERSION_DATA_LENGTH);
    00875     BaseAddress = 0;
    00876     ViewSize = SYSTEM_BIOS_LENGTH;
    00877     ViewBase.LowPart = SYSTEM_BIOS_START;
    00878     ViewBase.HighPart = 0;
    00879
    00880     Status =ZwMapViewOfSection(
    00881         SectionHandle,
    00882         NtCurrentProcess(),
    00883         &BaseAddress,
    00884         0,
    00885         ViewSize,
    00886         &ViewBase,
    00887         &ViewSize,
    00888         ViewUnmap,
    00889         MEM_DOS_LIM,
    00890         PAGE_READWRITE
    00891         );
    00892
    00893     if (NT_SUCCESS(Status)) {
    00894         if (CmpGetBiosDate(BaseAddress, SYSTEM_BIOS_LENGTH, Buffer)) {
    00895
    00896             //
    00897             // Convert ascii date string to unicode string and
    00898             // store it in registry.
    00899             //
    00900
    00901             RtlInitUnicodeString(
    00902                 &ValueName,
    00903                 L"SystemBiosDate"
    00904                 );
    00905
    00906             RtlInitAnsiString(
    00907                 &AnsiString,
    00908                 Buffer
    00909                 );
    00910
    00911             RtlAnsiStringToUnicodeString(
    00912                 &ValueData,
    00913                 &AnsiString,
    00914                 TRUE
    00915                 );
    00916
    00917             Status = NtSetValueKey(
    00918                         ParentHandle,
    00919                         &ValueName,
    00920                         TITLE_INDEX_VALUE,
    00921                         REG_SZ,
    00922                         ValueData.Buffer,
    00923                         ValueData.Length + sizeof( UNICODE_NULL )
    00924                         );
    00925
    00926             RtlFreeUnicodeString(&ValueData);
    00927         }
    00928
    00929         if (VersionStrings && CmpGetBiosVersion(BaseAddress, SYSTEM_BIOS_LENGTH, Buffer)) {
    00930             VersionPointer = VersionStrings;
    00931             do {
    00932
    00933                 //
    00934                 // Try to detect ALL the possible BIOS version strings.
    00935                 // Convert them to unicode strings and copy them to our
    00936                 // VersionStrings buffer.
    00937                 //
    00938
    00939                 RtlInitAnsiString(
    00940                     &AnsiString,
    00941                     Buffer
    00942                     );
    00943
    00944                 RtlAnsiStringToUnicodeString(
    00945                     &ValueData,
    00946                     &AnsiString,
    00947                     TRUE
    00948                     );
    00949
    00950                 Length = ValueData.Length + sizeof(UNICODE_NULL);
    00951                 RtlMoveMemory(VersionPointer,
    00952                               ValueData.Buffer,
    00953                               Length
    00954                               );
    00955                 VersionsLength += Length;
    00956                 RtlFreeUnicodeString(&ValueData);
    00957                 if (VersionsLength + (MAXIMUM_BIOS_VERSION_LENGTH +
    00958                     sizeof(UNICODE_NULL)) * 2 > PAGE_SIZE) {
    00959                     break;
    00960                 }
    00961                 VersionPointer += Length;
    00962             } while (CmpGetBiosVersion(NULL, 0, Buffer));
    00963
    00964             if (VersionsLength != 0) {
    00965
    00966                 //
    00967                 // Append a UNICODE_NULL to the end of VersionStrings
    00968                 //
    00969
    00970                 *(PWSTR)VersionPointer = UNICODE_NULL;
    00971                 VersionsLength += sizeof(UNICODE_NULL);
    00972
    00973                 //
    00974                 // If any version string is found, we set up a ValueName and
    00975                 // initialize its value to the string(s) we found.
    00976                 //
    00977
    00978                 RtlInitUnicodeString(
    00979                     &ValueName,
    00980                     L"SystemBiosVersion"
    00981                     );
    00982
    00983                 Status = NtSetValueKey(
    00984                             ParentHandle,
    00985                             &ValueName,
    00986                             TITLE_INDEX_VALUE,
    00987                             REG_MULTI_SZ,
    00988                             VersionStrings,
    00989                             VersionsLength
    00990                             );
    00991             }
    00992         }
    00993         ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
    00994     }
    00995
    00996     //
    00997     // Next we try to collect Video BIOS date and version strings.
    00998     //
    00999
    01000     BaseAddress = 0;
    01001     ViewSize = VIDEO_BIOS_LENGTH;
    01002     ViewBase.LowPart = VideoBiosStart;
    01003     ViewBase.HighPart = 0;
    01004
    01005     Status =ZwMapViewOfSection(
    01006         SectionHandle,
    01007         NtCurrentProcess(),
    01008         &BaseAddress,
    01009         0,
    01010         ViewSize,
    01011         &ViewBase,
    01012         &ViewSize,
    01013         ViewUnmap,
    01014         MEM_DOS_LIM,
    01015         PAGE_READWRITE
    01016         );
    01017
    01018     if (NT_SUCCESS(Status)) {
    01019         if (CmpGetBiosDate(BaseAddress, VIDEO_BIOS_LENGTH, Buffer)) {
    01020
    01021             RtlInitUnicodeString(
    01022                 &ValueName,
    01023                 L"VideoBiosDate"
    01024                 );
    01025
    01026             RtlInitAnsiString(
    01027                 &AnsiString,
    01028                 Buffer
    01029                 );
    01030
    01031             RtlAnsiStringToUnicodeString(
    01032                 &ValueData,
    01033                 &AnsiString,
    01034                 TRUE
    01035                 );
    01036
    01037             Status = NtSetValueKey(
    01038                         ParentHandle,
    01039                         &ValueName,
    01040                         TITLE_INDEX_VALUE,
    01041                         REG_SZ,
    01042                         ValueData.Buffer,
    01043                         ValueData.Length + sizeof( UNICODE_NULL )
    01044                         );
    01045
    01046             RtlFreeUnicodeString(&ValueData);
    01047         }
    01048
    01049         if (VersionStrings && CmpGetBiosVersion(BaseAddress, VIDEO_BIOS_LENGTH, Buffer)) {
    01050             VersionPointer = VersionStrings;
    01051             do {
    01052
    01053                 //
    01054                 // Try to detect ALL the possible BIOS version strings.
    01055                 // Convert them to unicode strings and copy them to our
    01056                 // VersionStrings buffer.
    01057                 //
    01058
    01059                 RtlInitAnsiString(
    01060                     &AnsiString,
    01061                     Buffer
    01062                     );
    01063
    01064                 RtlAnsiStringToUnicodeString(
    01065                     &ValueData,
    01066                     &AnsiString,
    01067                     TRUE
    01068                     );
    01069
    01070                 Length = ValueData.Length + sizeof(UNICODE_NULL);
    01071                 RtlMoveMemory(VersionPointer,
    01072                               ValueData.Buffer,
    01073                               Length
    01074                               );
    01075                 VersionsLength += Length;
    01076                 RtlFreeUnicodeString(&ValueData);
    01077                 if (VersionsLength + (MAXIMUM_BIOS_VERSION_LENGTH +
    01078                     sizeof(UNICODE_NULL)) * 2 > PAGE_SIZE) {
    01079                     break;
    01080                 }
    01081                 VersionPointer += Length;
    01082             } while (CmpGetBiosVersion(NULL, 0, Buffer));
    01083
    01084             if (VersionsLength != 0) {
    01085
    01086                 //
    01087                 // Append a UNICODE_NULL to the end of VersionStrings
    01088                 //
    01089
    01090                 *(PWSTR)VersionPointer = UNICODE_NULL;
    01091                 VersionsLength += sizeof(UNICODE_NULL);
    01092
    01093                 RtlInitUnicodeString(
    01094                     &ValueName,
    01095                     L"VideoBiosVersion"
    01096                     );
    01097
    01098                 Status = NtSetValueKey(
    01099                             ParentHandle,
    01100                             &ValueName,
    01101                             TITLE_INDEX_VALUE,
    01102                             REG_MULTI_SZ,
    01103                             VersionStrings,
    01104                             VersionsLength
    01105                             );
    01106             }
    01107         }
    01108         ZwUnmapViewOfSection(NtCurrentProcess(), BaseAddress);
    01109     }
    01110     ZwClose(SectionHandle);
    01111     if (VersionStrings) {
    01112         ExFreePool((PVOID)VersionStrings);
    01113     }
    01114
    01115 AllDone:
    01116
    01117 #endif _IA64_
    01118
    01119     NtClose (ParentHandle);
    01120
    01121     //
    01122     // Add any other x86 specific code here...
    01123     //
    01124
    01125     return STATUS_SUCCESS;
    01126 }
    }

ULONG Ke386CyrixId | ( | VOID |  | ) |

## Variable Documentation

PCHAR BiosBegin

| Definition at line 41 of file config/ia64/initia64.c.

UCHAR CmpAmdID[]

| Definition at line 53 of file config/ia64/initia64.c.

ULONG CmpConfigurationAreaSize

| Definition at line 77 of file config/ia64/initia64.c.

PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData

| Definition at line 78 of file config/ia64/initia64.c.

UCHAR CmpCyrixID[]

| Definition at line 51 of file config/ia64/initia64.c.

WCHAR CmpFeatureBits[]

| Definition at line 48 of file config/ia64/initia64.c.

UCHAR CmpID1[]

| Definition at line 44 of file config/ia64/initia64.c.

UCHAR CmpID2[]

| Definition at line 45 of file config/ia64/initia64.c.

UCHAR CmpIntelID[]

| Definition at line 52 of file config/ia64/initia64.c.

WCHAR CmpMHz[]

| Definition at line 49 of file config/ia64/initia64.c.

WCHAR CmpProcessorNameString[]

| Definition at line 47 of file config/ia64/initia64.c.

WCHAR CmpUpdateSignature[]

| Definition at line 50 of file config/ia64/initia64.c.

WCHAR CmpVendorID[]

| Definition at line 46 of file config/ia64/initia64.c.

PCHAR End

| Definition at line 43 of file config/ia64/initia64.c.

PCHAR SearchStrings[]

| Definition at line 40 of file config/ia64/initia64.c.

PCHAR Start

| Definition at line 42 of file config/ia64/initia64.c.