ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2016
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
228 discussions
Start a n
N
ew thread
[hbelusca] 71507: [NTDLL] - In LdrpLoadImportModule, check for import module extension, and append it if not found. - Fix LdrpLoadImportModule prototype. CORE-11360
by hbelusca@svn.reactos.org
Author: hbelusca Date: Fri Jun 3 19:02:46 2016 New Revision: 71507 URL:
http://svn.reactos.org/svn/reactos?rev=71507&view=rev
Log: [NTDLL] - In LdrpLoadImportModule, check for import module extension, and append it if not found. - Fix LdrpLoadImportModule prototype. CORE-11360 Modified: trunk/reactos/dll/ntdll/include/ntdllp.h trunk/reactos/dll/ntdll/ldr/ldrpe.c Modified: trunk/reactos/dll/ntdll/include/ntdllp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/include/ntdllp.h…
============================================================================== --- trunk/reactos/dll/ntdll/include/ntdllp.h [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/include/ntdllp.h [iso-8859-1] Fri Jun 3 19:02:46 2016 @@ -155,7 +155,6 @@ NTAPI LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, IN LPSTR ImportName, - IN PVOID DllBase, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, OUT PBOOLEAN Existing); Modified: trunk/reactos/dll/ntdll/ldr/ldrpe.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrpe.c?rev=…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrpe.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrpe.c [iso-8859-1] Fri Jun 3 19:02:46 2016 @@ -297,7 +297,6 @@ /* Load the module for this entry */ Status = LdrpLoadImportModule(DllPath, BoundImportName, - LdrEntry->DllBase, &DllLdrEntry, &AlreadyLoaded); if (!NT_SUCCESS(Status)) @@ -371,7 +370,6 @@ /* Load the module */ Status = LdrpLoadImportModule(DllPath, ForwarderName, - LdrEntry->DllBase, &ForwarderLdrEntry, &AlreadyLoaded); if (NT_SUCCESS(Status)) @@ -558,7 +556,6 @@ /* Load the module associated to it */ Status = LdrpLoadImportModule(DllPath, ImportName, - LdrEntry->DllBase, &DllLdrEntry, &AlreadyLoaded); if (!NT_SUCCESS(Status)) @@ -818,28 +815,73 @@ return Status; } -/* FIXME: This function is missing SxS support and has wrong prototype */ +/* FIXME: This function is missing SxS support */ NTSTATUS NTAPI LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, IN LPSTR ImportName, - IN PVOID DllBase, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, OUT PBOOLEAN Existing) { ANSI_STRING AnsiString; PUNICODE_STRING ImpDescName; + const WCHAR *p; + BOOLEAN GotExtension; + WCHAR c; NTSTATUS Status; PPEB Peb = RtlGetCurrentPeb(); PTEB Teb = NtCurrentTeb(); - DPRINT("LdrpLoadImportModule('%s' %p %p %p '%S')\n", ImportName, DllBase, DataTableEntry, Existing, DllPath); + DPRINT("LdrpLoadImportModule('%S' '%s' %p %p)\n", DllPath, ImportName, DataTableEntry, Existing); /* Convert import descriptor name to unicode string */ ImpDescName = &Teb->StaticUnicodeString; RtlInitAnsiString(&AnsiString, ImportName); Status = RtlAnsiStringToUnicodeString(ImpDescName, &AnsiString, FALSE); if (!NT_SUCCESS(Status)) return Status; + + /* Find the extension, if present */ + p = ImpDescName->Buffer + ImpDescName->Length / sizeof(WCHAR) - 1; + GotExtension = FALSE; + while (p >= ImpDescName->Buffer) + { + c = *p--; + if (c == L'.') + { + GotExtension = TRUE; + break; + } + else if (c == L'\\') + { + break; + } + } + + /* If no extension was found, add the default extension */ + if (!GotExtension) + { + /* Check that we have space to add one */ + if ((ImpDescName->Length + LdrApiDefaultExtension.Length + sizeof(UNICODE_NULL)) >= + sizeof(Teb->StaticUnicodeBuffer)) + { + /* No space to add the extension */ + DbgPrintEx(DPFLTR_LDR_ID, + DPFLTR_ERROR_LEVEL, + "LDR: %s - Dll name missing extension; with extension " + "added the name is too long\n" + " ImpDescName: (@ %p) \"%wZ\"\n" + " ImpDescName->Length: %u\n", + __FUNCTION__, + ImpDescName, + ImpDescName, + ImpDescName->Length); + return STATUS_NAME_TOO_LONG; + } + + /* Add it. Needs to be null terminated, thus the length check above */ + (VOID)RtlAppendUnicodeStringToString(ImpDescName, + &LdrApiDefaultExtension); + } /* Check if it's loaded */ if (LdrpCheckForLoadedDll(DllPath,
8 years, 7 months
1
0
0
0
[apriyadarshi] 71506: AhciFindAdapter Completed - Added AhciZeroMemory - Added AhciAllocateResourceForAdapter - Added AhciPortInitialize Compile Status : OK
by apriyadarshi@svn.reactos.org
Author: apriyadarshi Date: Fri Jun 3 15:54:21 2016 New Revision: 71506 URL:
http://svn.reactos.org/svn/reactos?rev=71506&view=rev
Log: AhciFindAdapter Completed - Added AhciZeroMemory - Added AhciAllocateResourceForAdapter - Added AhciPortInitialize Compile Status : OK Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Fri Jun 3 15:54:21 2016 @@ -8,8 +8,135 @@ #include "storahci.h" BOOLEAN AhciAdapterReset( - __in PAHCI_ADAPTER_EXTENSION adapterExtension + __in PAHCI_ADAPTER_EXTENSION adapterExtension ); + +VOID AhciZeroMemory( + __in PCHAR buffer, + __in ULONG bufferSize +); + +/** + * @name AhciPortInitialize + * @implemented + * + * Initialize port by setting up PxCLB & PxFB Registers + * + * @param portExtension + * + * @return + * Return true if intialization was successful + */ +BOOLEAN AhciPortInitialize( + __in PAHCI_PORT_EXTENSION portExtension +) +{ + ULONG mappedLength; + PAHCI_MEMORY_REGISTERS abar; + PAHCI_ADAPTER_EXTENSION adapterExtension; + STOR_PHYSICAL_ADDRESS commandListPhysical, receivedFISPhysical; + + adapterExtension = portExtension->AdapterExtension; + abar = adapterExtension->ABAR_Address; + portExtension->Port = &abar->PortList[portExtension->PortNumber]; + + commandListPhysical = StorPortGetPhysicalAddress(adapterExtension, NULL, portExtension->CommandList, &mappedLength); + if (mappedLength == 0 || (commandListPhysical.LowPart % 1024) != 0) + return FALSE; + + receivedFISPhysical = StorPortGetPhysicalAddress(adapterExtension, NULL, portExtension->ReceivedFIS, &mappedLength); + if (mappedLength == 0 || (commandListPhysical.LowPart % 256) != 0) + return FALSE; + + // 10.1.2 For each implemented port, system software shall allocate memory for and program: + // ï· PxCLB and PxCLBU (if CAP.S64A is set to â1â) + // ï· PxFB and PxFBU (if CAP.S64A is set to â1â) + //Note: Assuming 32bit support only + StorPortWriteRegisterUlong(adapterExtension, &portExtension->Port->CLB, commandListPhysical.LowPart); + StorPortWriteRegisterUlong(adapterExtension, &portExtension->Port->FB, receivedFISPhysical.LowPart); + + return TRUE; +}// -- AhciPortInitialize(); + +/** + * @name AhciAllocateResourceForAdapter + * @implemented + * + * Allocate memory from poll for required pointers + * + * @param adapterExtension + * @param ConfigInfo + * + * @return + * return TRUE if allocation was successful + */ +BOOLEAN AhciAllocateResourceForAdapter( + __in PAHCI_ADAPTER_EXTENSION adapterExtension, + __in PPORT_CONFIGURATION_INFORMATION ConfigInfo +) +{ + PVOID portsExtension = NULL; + PCHAR nonCachedExtension; + ULONG portCount, portImplemented, status, index, NCS, AlignedNCS, nonCachedExtensionSize, currentCount; + + // 3.1.1 NCS = CAP[12:08] -> Align + NCS = (adapterExtension->CAP & 0xF00) >> 8; + AlignedNCS = ((NCS/8) + 1) * 8; + + // get port count -- Number of set bits in `adapterExtension->PortImplemented` + portCount = 0; + portImplemented = adapterExtension->PortImplemented; + while(portImplemented > 0) + { + portCount++; + portImplemented &= (portImplemented-1); + } + + nonCachedExtensionSize = sizeof(AHCI_COMMAND_HEADER) * AlignedNCS + //should be 1K aligned + sizeof(AHCI_RECEIVED_FIS); + //align nonCachedExtensionSize to 1K + nonCachedExtensionSize = (((nonCachedExtensionSize - 1) / 0x400) + 1) * 0x400; + nonCachedExtensionSize *= portCount; + + adapterExtension->NonCachedExtension = StorPortGetUncachedExtension(adapterExtension, ConfigInfo, nonCachedExtensionSize); + if (adapterExtension->NonCachedExtension == NULL) + return FALSE; + + nonCachedExtension = (PCHAR)adapterExtension->NonCachedExtension; + + AhciZeroMemory(nonCachedExtension, nonCachedExtensionSize); + + + // allocate memory for port extension + status = StorPortAllocatePool( + adapterExtension, + portCount * sizeof(AHCI_PORT_EXTENSION), + AHCI_POOL_TAG, + (PVOID*)&portsExtension); + + if (status != STOR_STATUS_SUCCESS) + return FALSE; + + AhciZeroMemory((PCHAR)portsExtension, portCount * sizeof(AHCI_PORT_EXTENSION)); + + nonCachedExtensionSize /= portCount; + currentCount = 0; + for (index = 0; index < 32; index++) + { + if ((adapterExtension->PortImplemented & (1<<index)) != 0) + { + adapterExtension->PortExtension[index] = (PAHCI_PORT_EXTENSION)((PCHAR)portsExtension + sizeof(AHCI_PORT_EXTENSION) * currentCount); + + adapterExtension->PortExtension[index]->PortNumber = index; + adapterExtension->PortExtension[index]->AdapterExtension = adapterExtension; + adapterExtension->PortExtension[index]->CommandList = (PAHCI_COMMAND_HEADER)(nonCachedExtension + (currentCount*nonCachedExtensionSize)); + adapterExtension->PortExtension[index]->ReceivedFIS = (PAHCI_RECEIVED_FIS)((PCHAR)adapterExtension->PortExtension[index]->CommandList + sizeof(AHCI_COMMAND_HEADER) * AlignedNCS); + currentCount++; + } + } + + return TRUE; +}// -- AhciAllocateResourceForAdapter(); /** * @name AhciFindAdapter @@ -53,6 +180,7 @@ ) { ULONG ghc; + ULONG index; ULONG portCount, portImplemented; ULONG pci_cfg_len; UCHAR pci_cfg_buf[0x30]; @@ -88,18 +216,17 @@ abar = NULL; if (ConfigInfo->NumberOfAccessRanges > 0) { - ULONG accessIndex; - for (accessIndex = 0; accessIndex < ConfigInfo->NumberOfAccessRanges; accessIndex++) + for (index = 0; index < ConfigInfo->NumberOfAccessRanges; index++) { - if ((*(ConfigInfo->AccessRanges))[accessIndex].RangeStart.QuadPart == adapterExtension->AhciBaseAddress) + if ((*(ConfigInfo->AccessRanges))[index].RangeStart.QuadPart == adapterExtension->AhciBaseAddress) { abar = (PAHCI_MEMORY_REGISTERS)StorPortGetDeviceBase( adapterExtension, ConfigInfo->AdapterInterfaceType, ConfigInfo->SystemIoBusNumber, - (*(ConfigInfo->AccessRanges))[accessIndex].RangeStart, - (*(ConfigInfo->AccessRanges))[accessIndex].RangeLength, - (BOOLEAN)!(*(ConfigInfo->AccessRanges))[accessIndex].RangeInMemory); + (*(ConfigInfo->AccessRanges))[index].RangeStart, + (*(ConfigInfo->AccessRanges))[index].RangeLength, + (BOOLEAN)!(*(ConfigInfo->AccessRanges))[index].RangeInMemory); break; } } @@ -115,6 +242,7 @@ // 10.1.2 // 1. Indicate that system software is AHCI aware by setting GHC.AE to â1â. + // 3.1.2 -- AE bit is read-write only if CAP.SAM is '0' ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); // AE := Highest Significant bit of GHC if ((ghc & (0x1<<31)) == 1)//Hmm, controller was already in power state @@ -134,15 +262,6 @@ if (adapterExtension->PortImplemented == 0) return SP_RETURN_ERROR; - // get port count -- Number of set bits in `adapterExtension->PortImplemented` - portCount = 0; - portImplemented = adapterExtension->PortImplemented; - while(portImplemented > 0) - { - portCount++; - portImplemented &= (portImplemented - 1);// i love playing with bits :D - } - ConfigInfo->MaximumTransferLength = 128 * 1024;//128 KB ConfigInfo->NumberOfPhysicalBreaks = 0x21; ConfigInfo->MaximumNumberOfTargets = 1; @@ -152,12 +271,20 @@ ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex; ConfigInfo->ScatterGather = TRUE; + // allocate necessary resource for each port + if (!AhciAllocateResourceForAdapter(adapterExtension, ConfigInfo)) + return SP_RETURN_ERROR; + + for (index = 0; index < 32; index++) + { + if ((adapterExtension->PortImplemented & (1<<index)) != 0) + AhciPortInitialize(adapterExtension->PortExtension[index]); + } + // Turn IE -- Interrupt Enabled ghc |= 0x2; StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); - - return SP_RETURN_FOUND; }// -- AhciFindAdapter(); @@ -184,8 +311,7 @@ DebugPrint("Storahci -> DriverEntry()\n"); // initialize the hardware data structure - for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++) - ((PUCHAR)&hwInitializationData)[i] = 0; + AhciZeroMemory((PCHAR)&hwInitializationData, sizeof(HW_INITIALIZATION_DATA)); // set size of hardware initialization structure hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); @@ -261,3 +387,21 @@ return TRUE; }// -- AhciAdapterReset(); + +/** + * @name AhciZeroMemory + * @implemented + * + * Clear buffer by filling zeros + * + * @param buffer + */ +VOID AhciZeroMemory( + __in PCHAR buffer, + __in ULONG bufferSize +) +{ + ULONG i; + for (i = 0; i < bufferSize; i++) + buffer[i] = 0; +}// -- AhciZeroMemory(); Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Fri Jun 3 15:54:21 2016 @@ -1,5 +1,130 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GNU GPLv2 only as published by the Free Software Foundation + * PURPOSE: To Implement AHCI Miniport driver targeting storport NT 5.2 + * PROGRAMMERS: Aman Priyadarshi (aman.eureka(a)gmail.com) + */ + #include "miniport.h" #include "storport.h" + +#define AHCI_POOL_TAG 'ahci' + +typedef struct _AHCI_FIS_DMA_SETUP +{ + ULONG ULONG0_1; // FIS_TYPE_DMA_SETUP + // Port multiplier + // Reserved + // Data transfer direction, 1 - device to host + // Interrupt bit + // Auto-activate. Specifies if DMA Activate FIS is needed + UCHAR Reserved[2]; // Reserved + ULONG DmaBufferLow; // DMA Buffer Identifier. Used to Identify DMA buffer in host memory. SATA Spec says host specific and not in Spec. Trying AHCI spec might work. + ULONG DmaBufferHigh; + ULONG Reserved2; //More reserved + ULONG DmaBufferOffset; //Byte offset into buffer. First 2 bits must be 0 + ULONG TranferCount; //Number of bytes to transfer. Bit 0 must be 0 + ULONG Reserved3; //Reserved +} AHCI_FIS_DMA_SETUP; + +typedef struct _AHCI_PIO_SETUP_FIS +{ + UCHAR FisType; //0x5F + UCHAR Reserved1 :5; + UCHAR D :1; // 1 is write (device to host) + UCHAR I :1; + UCHAR Reserved2 :1; + UCHAR Status; + UCHAR Error; + + UCHAR SectorNumber; + UCHAR CylLow; + UCHAR CylHigh; + UCHAR Dev_Head; + + UCHAR SectorNumb_Exp; + UCHAR CylLow_Exp; + UCHAR CylHigh_Exp; + UCHAR Reserved3; + + UCHAR SectorCount; + UCHAR SectorCount_Exp; + UCHAR Reserved4; + UCHAR E_Status; + + USHORT TransferCount; + UCHAR Reserved5[2]; + +} AHCI_PIO_SETUP_FIS; + +typedef struct _AHCI_D2H_REGISTER_FIS +{ + UCHAR FisType; // 0x34 + UCHAR Reserved1 :6; + UCHAR I:1; + UCHAR Reserved2 :1; + UCHAR Status; + UCHAR Error; + + UCHAR SectorNumber; + UCHAR CylLow; + UCHAR CylHigh; + UCHAR Dev_Head; + + UCHAR SectorNum_Exp; + UCHAR CylLow_Exp; + UCHAR CylHigh_Exp; + UCHAR Reserved; + + UCHAR SectorCount; + UCHAR SectorCount_Exp; + UCHAR Reserved3[2]; + + UCHAR Reserved4[4]; +} AHCI_D2H_REGISTER_FIS; + +typedef struct _AHCI_SET_DEVICE_BITS_FIS { + + UCHAR FisType; //0xA1 + + UCHAR PMPort: 4; + UCHAR Reserved1 :2; + UCHAR I :1; + UCHAR N :1; + + UCHAR Status_Lo :3; + UCHAR Reserved2 :1; + UCHAR Status_Hi :3; + UCHAR Reserved3 :1; + + UCHAR Error; + + UCHAR Reserved5[4]; +} AHCI_SET_DEVICE_BITS_FIS; + +// 4.2.2 +typedef struct _AHCI_COMMAND_HEADER +{ + ULONG HEADER_DESCRIPTION; // DW 0 + ULONG PRDBC; // DW 1 + ULONG CTBA0; // DW 2 + ULONG CTBA_U0; // DW 3 + ULONG Reserved[4]; // DW 4-7 +} AHCI_COMMAND_HEADER, *PAHCI_COMMAND_HEADER; + +// Received FIS +typedef struct _AHCI_RECEIVED_FIS +{ + AHCI_FIS_DMA_SETUP DmaSetupFIS; // 0x00 -- DMA Setup FIS + ULONG pad0; // 4 BYTE padding + AHCI_PIO_SETUP_FIS PioSetupFIS; // 0x20 -- PIO Setup FIS + ULONG pad1[3]; // 12 BYTE padding + AHCI_D2H_REGISTER_FIS RegisterFIS; // 0x40 -- Register â Device to Host FIS + ULONG pad2; // 4 BYTE padding + AHCI_SET_DEVICE_BITS_FIS SetDeviceFIS; // 0x58 -- Set Device Bit FIS + ULONG UnknowFIS[16]; // 0x60 -- Unknown FIS + ULONG Reserved[24]; // 0xA0 -- Reserved +} AHCI_RECEIVED_FIS, *PAHCI_RECEIVED_FIS; typedef struct _AHCI_PORT { @@ -22,7 +147,7 @@ ULONG FBS; // 0x40, FIS-based switch control ULONG RSV1[11]; // 0x44 ~ 0x6F, Reserved ULONG Vendor[4]; // 0x70 ~ 0x7F, vendor specific -} AHCI_PORT; +} AHCI_PORT, *PAHCI_PORT; typedef struct _AHCI_MEMORY_REGISTERS { @@ -49,6 +174,17 @@ } AHCI_MEMORY_REGISTERS, *PAHCI_MEMORY_REGISTERS; +struct _AHCI_ADAPTER_EXTENSION; + +typedef struct _AHCI_PORT_EXTENSION +{ + ULONG PortNumber; + struct _AHCI_ADAPTER_EXTENSION* AdapterExtension; + PAHCI_COMMAND_HEADER CommandList; + PAHCI_RECEIVED_FIS ReceivedFIS; + PAHCI_PORT Port; +} AHCI_PORT_EXTENSION, *PAHCI_PORT_EXTENSION; + typedef struct _AHCI_ADAPTER_EXTENSION { ULONG AdapterNumber; @@ -65,7 +201,11 @@ ULONG Version; ULONG CAP; ULONG CAP2; + + PVOID NonCachedExtension; + PAHCI_MEMORY_REGISTERS ABAR_Address; + PAHCI_PORT_EXTENSION PortExtension[32]; } AHCI_ADAPTER_EXTENSION, *PAHCI_ADAPTER_EXTENSION; typedef struct _AHCI_SRB_EXTENSION
8 years, 7 months
1
0
0
0
[rnaumann] 71505: [DEVMGMT]Remove a self assignment. CORE-11183
by rnaumann@svn.reactos.org
Author: rnaumann Date: Fri Jun 3 08:47:03 2016 New Revision: 71505 URL:
http://svn.reactos.org/svn/reactos?rev=71505&view=rev
Log: [DEVMGMT]Remove a self assignment. CORE-11183 Modified: trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp Modified: trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/M…
============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp [iso-8859-1] Fri Jun 3 08:47:03 2016 @@ -543,7 +543,6 @@ lpttt->lpszText = MAKEINTRESOURCEW(IDS_TOOLTIP_UNINSTALL); break; } - idButton = idButton; break; } }
8 years, 7 months
1
0
0
0
[hbelusca] 71504: [WIN32K][BUILDNO] Add the compiler ID and version to the ROS version desktop watermark. Idea of encoded & learn_more, thanks :) [BOOTDATA] Enable the ROS version desktop watermark...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jun 2 22:28:36 2016 New Revision: 71504 URL:
http://svn.reactos.org/svn/reactos?rev=71504&view=rev
Log: [WIN32K][BUILDNO] Add the compiler ID and version to the ROS version desktop watermark. Idea of encoded & learn_more, thanks :) [BOOTDATA] Enable the ROS version desktop watermark on our daily builds. CORE-11349 Modified: trunk/reactos/boot/bootdata/hivesft.inf trunk/reactos/sdk/include/reactos/buildno.h.cmake trunk/reactos/win32ss/user/ntuser/desktop.c Modified: trunk/reactos/boot/bootdata/hivesft.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Thu Jun 2 22:28:36 2016 @@ -1388,6 +1388,7 @@ HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","AppInit_DLLs",0x00000000,"" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","DesktopHeapLogging",0x00010001,0x1 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","DeviceNotSelectedTimeout",0x00000000,"15" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","DisplayVersion",0x00010001,0x1 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","GDIProcessHandleQuota",0x00010001,0x2710 HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","Spooler",0x00000000,"yes" HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows","swapdisk",0x00000000,"" Modified: trunk/reactos/sdk/include/reactos/buildno.h.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/buildn…
============================================================================== --- trunk/reactos/sdk/include/reactos/buildno.h.cmake [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/buildno.h.cmake [iso-8859-1] Thu Jun 2 22:28:36 2016 @@ -14,5 +14,8 @@ #define REACTOS_DLL_VERSION_RC "@DLL_VERSION_STR@\0" #define REACTOS_DLL_VERSION_STR "@DLL_VERSION_STR@" +#define REACTOS_COMPILER_NAME "@CMAKE_C_COMPILER_ID@" +#define REACTOS_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@" + #endif /* EOF */ Modified: trunk/reactos/win32ss/user/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/deskto…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Thu Jun 2 22:28:36 2016 @@ -343,9 +343,11 @@ /* String for Safe Mode */ Status = RtlStringCchPrintfW(pwszzVersion, cchDest, - L"ReactOS Version %S %S (NT %u.%u Build %u%s)\n", + L"ReactOS Version %S %S.%S_%S (NT %u.%u Build %u%s)\n", KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR, // Same as the "BuildLab" string in the registry + REACTOS_COMPILER_NAME, + REACTOS_COMPILER_VERSION, SharedUserData->NtMajorVersion, SharedUserData->NtMinorVersion, (VerInfo.dwBuildNumber & 0xFFFF), @@ -384,10 +386,12 @@ Status = RtlStringCchPrintfW(pwszzVersion, cchDest, L"ReactOS Version %S\n" - L"Build %S\n" + L"Build %S.%S_%S\n" L"Reporting NT %u.%u (Build %u%s)\n", KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR, // Same as the "BuildLab" string in the registry + REACTOS_COMPILER_NAME, + REACTOS_COMPILER_VERSION, SharedUserData->NtMajorVersion, SharedUserData->NtMinorVersion, (VerInfo.dwBuildNumber & 0xFFFF), @@ -416,9 +420,11 @@ /* Fall-back string */ Status = RtlStringCchPrintfW(pwszzVersion, cchDest, - L"ReactOS Version %S %S\n", + L"ReactOS Version %S %S.%S_%S\n", KERNEL_VERSION_STR, - KERNEL_VERSION_BUILD_STR); + KERNEL_VERSION_BUILD_STR, // Same as the "BuildLab" string in the registry + REACTOS_COMPILER_NAME, + REACTOS_COMPILER_VERSION); if (!NT_SUCCESS(Status)) { /* General failure, NULL-terminate the string */
8 years, 7 months
1
0
0
0
[hbelusca] 71503: [SNDREC32]: Use a sunken edge for the waveform viewer.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Jun 2 21:38:47 2016 New Revision: 71503 URL:
http://svn.reactos.org/svn/reactos?rev=71503&view=rev
Log: [SNDREC32]: Use a sunken edge for the waveform viewer. Modified: trunk/reactos/base/applications/sndrec32/sndrec32.cpp Modified: trunk/reactos/base/applications/sndrec32/sndrec32.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndrec32…
============================================================================== --- trunk/reactos/base/applications/sndrec32/sndrec32.cpp [iso-8859-1] (original) +++ trunk/reactos/base/applications/sndrec32/sndrec32.cpp [iso-8859-1] Thu Jun 2 21:38:47 2016 @@ -317,17 +317,18 @@ hInst = hInstance; - hWnd = CreateWindow(TEXT("sndrec32_wave"), - TEXT(""), - WS_DLGFRAME | WS_VISIBLE | WS_CHILD, - WAVEBAR_X, - WAVEBAR_Y, - WAVEBAR_CX, - WAVEBAR_CY, - f, - (HMENU)8, - hInstance, - 0); + hWnd = CreateWindowEx(WS_EX_STATICEDGE, + TEXT("sndrec32_wave"), + TEXT(""), + WS_VISIBLE | WS_CHILD, + WAVEBAR_X, + WAVEBAR_Y, + WAVEBAR_CX, + WAVEBAR_CY, + f, + (HMENU)8, + hInstance, + 0); if (!hWnd ) { @@ -363,6 +364,7 @@ case WM_CREATE: GetClientRect(hWnd, &cli); break; + case WM_PAINT: /* Initialize hdc objects */ hdc = BeginPaint(hWnd, &ps); @@ -420,6 +422,7 @@ case WM_USER: break; + default: return DefWindowProc(hWnd, message, wParam, lParam); }
8 years, 7 months
1
0
0
0
[spetreolle] 71502: [HIVES] Fix paths passed to the hive maker.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Thu Jun 2 20:21:46 2016 New Revision: 71502 URL:
http://svn.reactos.org/svn/reactos?rev=71502&view=rev
Log: [HIVES] Fix paths passed to the hive maker. Modified: trunk/reactos/sdk/cmake/CMakeMacros.cmake Modified: trunk/reactos/sdk/cmake/CMakeMacros.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/cmake/CMakeMacros.cmak…
============================================================================== --- trunk/reactos/sdk/cmake/CMakeMacros.cmake [iso-8859-1] (original) +++ trunk/reactos/sdk/cmake/CMakeMacros.cmake [iso-8859-1] Thu Jun 2 20:21:46 2016 @@ -764,7 +764,7 @@ ${CMAKE_BINARY_DIR}/boot/bootdata/security ${CMAKE_BINARY_DIR}/boot/bootdata/software ${CMAKE_BINARY_DIR}/boot/bootdata/system - COMMAND native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/ ${_livecd_inf_files} + COMMAND native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata ${_livecd_inf_files} DEPENDS native-mkhive ${_livecd_inf_files}) add_custom_target(livecd_hives @@ -787,7 +787,7 @@ # BCD Hive add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/boot/bootdata/BCD - COMMAND native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata/ ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf + COMMAND native-mkhive ${CMAKE_BINARY_DIR}/boot/bootdata ${CMAKE_BINARY_DIR}/boot/bootdata/hivebcd_utf16.inf DEPENDS native-mkhive ${CMAKE_SOURCE_DIR}/boot/bootdata/hivebcd.inf) add_custom_target(bcd_hive
8 years, 7 months
1
0
0
0
[mjansen] 71501: [APPHELP_APITEST][APPHELP] Add new tests showing that SdbWriteStringTag and SdbEndWriteListTag are incorrect, fix SdbEndWriteListTag CORE-10367 SdbWriteStringTag requires the datab...
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Jun 2 18:59:04 2016 New Revision: 71501 URL:
http://svn.reactos.org/svn/reactos?rev=71501&view=rev
Log: [APPHELP_APITEST][APPHELP] Add new tests showing that SdbWriteStringTag and SdbEndWriteListTag are incorrect, fix SdbEndWriteListTag CORE-10367 SdbWriteStringTag requires the database to keep track of written strings, and append a stringtable to a database. Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c trunk/reactos/dll/appcompat/apphelp/sdbpapi.h trunk/reactos/dll/appcompat/apphelp/sdbwrite.c trunk/rostests/apitests/apphelp/db.c Modified: trunk/reactos/dll/appcompat/apphelp/sdbapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdba…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbapi.c [iso-8859-1] Thu Jun 2 18:59:04 2016 @@ -259,12 +259,17 @@ DWORD SdbpStrlen(PCWSTR string) { - return (lstrlenW(string) + 1) * sizeof(WCHAR); + return lstrlenW(string); +} + +DWORD SdbpStrsize(PCWSTR string) +{ + return (SdbpStrlen(string) + 1) * sizeof(WCHAR); } PWSTR SdbpStrDup(LPCWSTR string) { - PWSTR ret = SdbpAlloc(SdbpStrlen(string)); + PWSTR ret = SdbpAlloc(SdbpStrsize(string)); lstrcpyW(ret, string); return ret; } Modified: trunk/reactos/dll/appcompat/apphelp/sdbpapi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbp…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbpapi.h [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbpapi.h [iso-8859-1] Thu Jun 2 18:59:04 2016 @@ -65,7 +65,8 @@ PDB WINAPI SdbpCreate(LPCWSTR path, PATH_TYPE type, BOOL write); void WINAPI SdbpFlush(PDB db); -DWORD SdbpStrlen(LPCWSTR string); +DWORD SdbpStrlen(PCWSTR string); +DWORD SdbpStrsize(PCWSTR string); #ifdef __cplusplus Modified: trunk/reactos/dll/appcompat/apphelp/sdbwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/sdbw…
============================================================================== --- trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] (original) +++ trunk/reactos/dll/appcompat/apphelp/sdbwrite.c [iso-8859-1] Thu Jun 2 18:59:04 2016 @@ -36,6 +36,10 @@ #include "sdbtagid.h" #endif + +BOOL WINAPI SdbWriteStringRefTag(PDB db, TAG tag, TAGID tagid); +TAGID WINAPI SdbBeginWriteListTag(PDB db, TAG tag); +BOOL WINAPI SdbEndWriteListTag(PDB db, TAGID tagid); static void WINAPI SdbpWrite(PDB db, const void* data, DWORD size) @@ -51,6 +55,23 @@ db->write_iter += size; } +static BOOL WINAPI SdbpGetOrAddStringRef(PDB db, LPCWSTR string, TAGID* tagid) +{ + /* TODO: + - Insert or find in stringtable + - return TAGID + */ + + return FALSE; +} + +static void WINAPI SdbpWriteStringtable(PDB db) +{ + TAGID table = SdbBeginWriteListTag(db, TAG_STRINGTABLE); + /* TODO: Write out all strings*/ + SdbEndWriteListTag(db, table); +} + /** * Creates new shim database file * @@ -90,6 +111,7 @@ */ void WINAPI SdbCloseDatabaseWrite(PDB db) { + SdbpWriteStringtable(db); SdbpFlush(db); SdbCloseDatabase(db); } @@ -181,10 +203,19 @@ { DWORD size; + if (SdbpCheckTagType(tag, TAG_TYPE_STRINGREF)) + { + TAGID tagid = 0; + if (!SdbpGetOrAddStringRef(db, string, &tagid)) + return FALSE; + + return SdbWriteStringRefTag(db, tag, tagid); + } + if (!SdbpCheckTagType(tag, TAG_TYPE_STRING)) return FALSE; - size = SdbpStrlen(string); + size = SdbpStrsize(string); SdbpWrite(db, &tag, sizeof(TAG)); SdbpWrite(db, &size, sizeof(size)); SdbpWrite(db, string, size); @@ -297,7 +328,7 @@ return FALSE; /* Write size of list to list tag header */ - *(DWORD*)&db->data[tagid + sizeof(TAG)] = db->write_iter - tagid - sizeof(TAG); - return TRUE; -} - + *(DWORD*)&db->data[tagid + sizeof(TAG)] = db->write_iter - tagid - sizeof(TAG) - sizeof(TAGID); + return TRUE; +} + Modified: trunk/rostests/apitests/apphelp/db.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/apphelp/db.c?rev…
============================================================================== --- trunk/rostests/apitests/apphelp/db.c [iso-8859-1] (original) +++ trunk/rostests/apitests/apphelp/db.c [iso-8859-1] Thu Jun 2 18:59:04 2016 @@ -312,6 +312,91 @@ } DeleteFileW(path1); } + +/* + - Show that a stringtable is automatically generated, + - validate multiple lists (for the length) +*/ +static void test_write_ex(void) +{ + WCHAR path1[] = {'t','e','s','t','.','s','d','b',0}; + WCHAR test1[] = {'T','E','S','T',0}; + WCHAR test2[] = {'t','e','s','t',0}; + PDB pdb; + TAGID tagdb, tagstr; + TAG tag; + DWORD size; + BOOL ret; + + /* Write a small database */ + pdb = pSdbCreateDatabase(path1, DOS_PATH); + ok(pdb != NULL, "Expected a valid database\n"); + if (!pdb) + return; + tagdb = pSdbBeginWriteListTag(pdb, TAG_DATABASE); + ok(tagdb == 12, "Expected tag to be 12, was %u\n", tagdb); + ret = pSdbWriteStringTag(pdb, TAG_NAME, test1); + ok(ret, "Expected SdbWriteStringTag to succeed\n"); + ret = pSdbEndWriteListTag(pdb, tagdb); + ok(ret, "Expected SdbEndWriteListTag to succeed\n"); + + tagdb = pSdbBeginWriteListTag(pdb, TAG_DATABASE); + ok(tagdb == 24, "Expected tag to be 24, was %u\n", tagdb); + ret = pSdbWriteStringTag(pdb, TAG_NAME, test2); + ok(ret, "Expected SdbWriteStringTag to succeed\n"); + ret = pSdbEndWriteListTag(pdb, tagdb); + ok(ret, "Expected SdbEndWriteListTag to succeed\n"); + + pSdbCloseDatabaseWrite(pdb); + + /* Now validate it's contents */ + pdb = pSdbOpenDatabase(path1, DOS_PATH); + ok(pdb != NULL, "Expected a valid database\n"); + if (!pdb) + return; + tagdb = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_DATABASE); + ok(tagdb == 12, "Expected tag to be 12, was %u\n", tagdb); + size = pSdbGetTagDataSize(pdb, tagdb); + ok(size == 6, "Expected size to be 6, was %u\n", size); + tagstr = pSdbFindFirstTag(pdb, tagdb, TAG_NAME); + ok(tagstr == 18, "Expected string tag to be 18, was %u\n", tagstr); + tag = pSdbGetTagFromTagID(pdb, tagstr); + ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag); + size = pSdbGetTagDataSize(pdb, tagstr); + ok(size == 4, "Expected size to be 4, was 0x%x\n", size); + + tagdb = pSdbFindNextTag(pdb, TAGID_ROOT, tagdb); + ok(tagdb == 24, "Expected tag to be 24, was %u\n", tagdb); + size = pSdbGetTagDataSize(pdb, tagdb); + ok(size == 6, "Expected size to be 6, was %u\n", size); + tagstr = pSdbFindFirstTag(pdb, tagdb, TAG_NAME); + ok(tagstr == 30, "Expected string tag to be 30, was %u\n", tagstr); + tag = pSdbGetTagFromTagID(pdb, tagstr); + ok(tag == TAG_NAME, "Expected tag to be TAG_NAME, was 0x%x\n", (DWORD)tag); + size = pSdbGetTagDataSize(pdb, tagstr); + ok(size == 4, "Expected size to be 4, was %u\n", size); + + tagdb = pSdbFindFirstTag(pdb, TAGID_ROOT, TAG_STRINGTABLE); + ok(tagdb == 36, "Expected tag to be 36, was %u\n", tagdb); + size = pSdbGetTagDataSize(pdb, tagdb); + ok(size == 32, "Expected size to be 32, was %u\n", size); + tagstr = pSdbGetFirstChild(pdb, tagdb); + ok(tagstr == 42, "Expected string tag to be 42, was %u\n", tagstr); + tag = pSdbGetTagFromTagID(pdb, tagstr); + ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_STRINGTABLE_ITEM, was 0x%x\n", (DWORD)tag); + size = pSdbGetTagDataSize(pdb, tagstr); + ok(size == 10, "Expected size to be 10, was %u\n", size); + + tagstr = pSdbGetNextChild(pdb, tagdb, tagstr); + ok(tagstr == 58, "Expected string tag to be 58, was %u\n", tagstr); + tag = pSdbGetTagFromTagID(pdb, tagstr); + ok(tag == TAG_STRINGTABLE_ITEM, "Expected tag to be TAG_STRINGTABLE_ITEM, was 0x%x\n", (DWORD)tag); + size = pSdbGetTagDataSize(pdb, tagstr); + ok(size == 10, "Expected size to be 10, was %u\n", size); + + pSdbCloseDatabase(pdb); +} + static void match_str_attr_imp(PDB pdb, TAGID parent, TAG find, const char* compare) { @@ -790,5 +875,6 @@ pSdbGUIDToString = (void *) GetProcAddress(hdll, "SdbGUIDToString"); test_Sdb(); + test_write_ex(); test_CheckDatabaseManually(); }
8 years, 7 months
1
0
0
0
[apriyadarshi] 71500: Required changes to meet community coding style.
by apriyadarshi@svn.reactos.org
Author: apriyadarshi Date: Thu Jun 2 14:43:56 2016 New Revision: 71500 URL:
http://svn.reactos.org/svn/reactos?rev=71500&view=rev
Log: Required changes to meet community coding style. Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/sources branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/sources URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/sources [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/sources [iso-8859-1] Thu Jun 2 14:43:56 2016 @@ -2,7 +2,7 @@ TARGETTYPE = MINIPORT TARGETLIBS=$(DDK_LIB_PATH)\storport.lib - + INCLUDES = %BUILD%\inc LIBS = %BUILD%\lib SOURCES = storahci.c Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Thu Jun 2 14:43:56 2016 @@ -1,231 +1,263 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GNU GPLv2 only as published by the Free Software Foundation + * PURPOSE: To Implement AHCI Miniport driver targeting storport NT 5.2 + * PROGRAMMERS: Aman Priyadarshi (aman.eureka(a)gmail.com) + */ + #include "storahci.h" BOOLEAN AhciAdapterReset( - __in PAHCI_ADAPTER_EXTENSION adapterExtension + __in PAHCI_ADAPTER_EXTENSION adapterExtension ); +/** + * @name AhciFindAdapter + * @implemented + * + * The HwStorFindAdapter routine uses the supplied configuration to determine whether a specific + * HBA is supported and, if it is, to return configuration information about that adapter. + * + * 10.1 Platform Communication + *
http://www.intel.in/content/dam/www/public/us/en/documents/technical-specif…
+ + * @param DeviceExtension + * @param HwContext + * @param BusInformation + * @param ArgumentString + * @param ConfigInfo + * @param Reserved3 + * + * @return + * SP_RETURN_FOUND + * Indicates that a supported HBA was found and that the HBA-relevant configuration information was successfully determined and set in the PORT_CONFIGURATION_INFORMATION structure. + * + * SP_RETURN_ERROR + * Indicates that an HBA was found but there was an error obtaining the configuration information. If possible, such an error should be logged with StorPortLogError. + * + * SP_RETURN_BAD_CONFIG + * Indicates that the supplied configuration information was invalid for the adapter. + * + * SP_RETURN_NOT_FOUND + * Indicates that no supported HBA was found for the supplied configuration information. + * + * @remarks Called by Storport. + */ ULONG AhciFindAdapter( - IN PVOID DeviceExtension, - __in PVOID HwContext, - __in PVOID BusInformation, - __in IN PVOID ArgumentString, - __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, - __in PBOOLEAN Reserved3 + IN PVOID DeviceExtension, + __in PVOID HwContext, + __in PVOID BusInformation, + __in IN PVOID ArgumentString, + __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, + __in PBOOLEAN Reserved3 ) { - /* Description : - * The HwStorFindAdapter routine uses the supplied configuration to determine whether a specific - * HBA is supported and, if it is, to return configuration information about that adapter. - * - * Refernce: - * 10.1 Platform Communication - *
http://www.intel.in/content/dam/www/public/us/en/documents/technical-specif…
- * - * Return Value: - * SP_RETURN_FOUND - * Indicates that a supported HBA was found and that the HBA-relevant configuration information was successfully determined and set in the PORT_CONFIGURATION_INFORMATION structure. - * - * SP_RETURN_ERROR - * Indicates that an HBA was found but there was an error obtaining the configuration information. If possible, such an error should be logged with StorPortLogError. - * - * SP_RETURN_BAD_CONFIG - * Indicates that the supplied configuration information was invalid for the adapter. - * - * SP_RETURN_NOT_FOUND - * Indicates that no supported HBA was found for the supplied configuration information. - */ - - ULONG ghc; - ULONG portCount, portImplemented; - ULONG pci_cfg_len; - UCHAR pci_cfg_buf[0x30]; - - PAHCI_MEMORY_REGISTERS abar; - PPCI_COMMON_CONFIG pciConfigData; - PAHCI_ADAPTER_EXTENSION adapterExtension; - - adapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension; - adapterExtension->SlotNumber = ConfigInfo->SlotNumber; - adapterExtension->SystemIoBusNumber = ConfigInfo->SystemIoBusNumber; - - // get PCI configuration header - pci_cfg_len = StorPortGetBusData( - adapterExtension, - PCIConfiguration, - adapterExtension->SystemIoBusNumber, - adapterExtension->SlotNumber, - (PVOID)pci_cfg_buf, - (ULONG)0x30); - - if (pci_cfg_len != 0x30) - return SP_RETURN_ERROR;//Not a valid device at the given bus number - - pciConfigData = (PPCI_COMMON_CONFIG)pci_cfg_buf; - adapterExtension->VendorID = pciConfigData->VendorID; - adapterExtension->DeviceID = pciConfigData->DeviceID; - adapterExtension->RevisionID = pciConfigData->RevisionID; - // The last PCI base address register (BAR[5], header offset 0x24) points to the AHCI base memory, itâs called ABAR (AHCI Base Memory Register). - adapterExtension->AhciBaseAddress = pciConfigData->u.type0.BaseAddresses[5] & (0xFFFFFFF0); - - // 2.1.11 - abar = NULL; - if (ConfigInfo->NumberOfAccessRanges > 0) - { - ULONG accessIndex; - for (accessIndex = 0; accessIndex < ConfigInfo->NumberOfAccessRanges; accessIndex++) - { - if ((*(ConfigInfo->AccessRanges))[accessIndex].RangeStart.QuadPart == adapterExtension->AhciBaseAddress) - { - abar = (PAHCI_MEMORY_REGISTERS)StorPortGetDeviceBase( - adapterExtension, - ConfigInfo->AdapterInterfaceType, - ConfigInfo->SystemIoBusNumber, - (*(ConfigInfo->AccessRanges))[accessIndex].RangeStart, - (*(ConfigInfo->AccessRanges))[accessIndex].RangeLength, - (BOOLEAN)!(*(ConfigInfo->AccessRanges))[accessIndex].RangeInMemory); - break; - } - } - } - - if (abar == NULL) - return SP_RETURN_ERROR; // corrupted information supplied - - adapterExtension->ABAR_Address = abar; - adapterExtension->CAP = StorPortReadRegisterUlong(adapterExtension, &abar->CAP); - adapterExtension->CAP2 = StorPortReadRegisterUlong(adapterExtension, &abar->CAP2); - adapterExtension->Version = StorPortReadRegisterUlong(adapterExtension, &abar->VS); - - // 10.1.2 - // 1. Indicate that system software is AHCI aware by setting GHC.AE to â1â. - ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); - // AE := Highest Significant bit of GHC - if ((ghc & (0x1<<31)) == 1)//Hmm, controller was already in power state - { - // reset controller to have it in know state - DebugPrint("AhciFindAdapter -> AE Already set, Reset()\n"); - if (!AhciAdapterReset(adapterExtension)) - return SP_RETURN_ERROR;// reset failed - } - - ghc = 0x1<<31;// only AE=1 - StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); - - adapterExtension->IS = abar->IS; - adapterExtension->PortImplemented = StorPortReadRegisterUlong(adapterExtension, &abar->PI); - - if (adapterExtension->PortImplemented == 0) - return SP_RETURN_ERROR; - - // get port count -- Number of set bits in `adapterExtension->PortImplemented` - portCount = 0; - portImplemented = adapterExtension->PortImplemented; - while(portImplemented > 0) - { - portCount++; - portImplemented &= (portImplemented - 1);// i love playing with bits :D - } - - ConfigInfo->MaximumTransferLength = 128 * 1024;//128 KB - ConfigInfo->NumberOfPhysicalBreaks = 0x21; - ConfigInfo->MaximumNumberOfTargets = 1; - ConfigInfo->MaximumNumberOfLogicalUnits = 1; - ConfigInfo->ResetTargetSupported = TRUE; - ConfigInfo->NumberOfBuses = 32; - ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex; - ConfigInfo->ScatterGather = TRUE; - - // Turn IE -- Interrupt Enabled - ghc |= 0x2; - StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); - - - - return SP_RETURN_FOUND; -}// -- AhciFindAdapter(); - + ULONG ghc; + ULONG portCount, portImplemented; + ULONG pci_cfg_len; + UCHAR pci_cfg_buf[0x30]; + + PAHCI_MEMORY_REGISTERS abar; + PPCI_COMMON_CONFIG pciConfigData; + PAHCI_ADAPTER_EXTENSION adapterExtension; + + adapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension; + adapterExtension->SlotNumber = ConfigInfo->SlotNumber; + adapterExtension->SystemIoBusNumber = ConfigInfo->SystemIoBusNumber; + + // get PCI configuration header + pci_cfg_len = StorPortGetBusData( + adapterExtension, + PCIConfiguration, + adapterExtension->SystemIoBusNumber, + adapterExtension->SlotNumber, + (PVOID)pci_cfg_buf, + (ULONG)0x30); + + if (pci_cfg_len != 0x30) + return SP_RETURN_ERROR;//Not a valid device at the given bus number + + pciConfigData = (PPCI_COMMON_CONFIG)pci_cfg_buf; + adapterExtension->VendorID = pciConfigData->VendorID; + adapterExtension->DeviceID = pciConfigData->DeviceID; + adapterExtension->RevisionID = pciConfigData->RevisionID; + // The last PCI base address register (BAR[5], header offset 0x24) points to the AHCI base memory, itâs called ABAR (AHCI Base Memory Register). + adapterExtension->AhciBaseAddress = pciConfigData->u.type0.BaseAddresses[5] & (0xFFFFFFF0); + + // 2.1.11 + abar = NULL; + if (ConfigInfo->NumberOfAccessRanges > 0) + { + ULONG accessIndex; + for (accessIndex = 0; accessIndex < ConfigInfo->NumberOfAccessRanges; accessIndex++) + { + if ((*(ConfigInfo->AccessRanges))[accessIndex].RangeStart.QuadPart == adapterExtension->AhciBaseAddress) + { + abar = (PAHCI_MEMORY_REGISTERS)StorPortGetDeviceBase( + adapterExtension, + ConfigInfo->AdapterInterfaceType, + ConfigInfo->SystemIoBusNumber, + (*(ConfigInfo->AccessRanges))[accessIndex].RangeStart, + (*(ConfigInfo->AccessRanges))[accessIndex].RangeLength, + (BOOLEAN)!(*(ConfigInfo->AccessRanges))[accessIndex].RangeInMemory); + break; + } + } + } + + if (abar == NULL) + return SP_RETURN_ERROR; // corrupted information supplied + + adapterExtension->ABAR_Address = abar; + adapterExtension->CAP = StorPortReadRegisterUlong(adapterExtension, &abar->CAP); + adapterExtension->CAP2 = StorPortReadRegisterUlong(adapterExtension, &abar->CAP2); + adapterExtension->Version = StorPortReadRegisterUlong(adapterExtension, &abar->VS); + + // 10.1.2 + // 1. Indicate that system software is AHCI aware by setting GHC.AE to â1â. + ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); + // AE := Highest Significant bit of GHC + if ((ghc & (0x1<<31)) == 1)//Hmm, controller was already in power state + { + // reset controller to have it in know state + DebugPrint("AhciFindAdapter -> AE Already set, Reset()\n"); + if (!AhciAdapterReset(adapterExtension)) + return SP_RETURN_ERROR;// reset failed + } + + ghc = 0x1<<31;// only AE=1 + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + adapterExtension->IS = abar->IS; + adapterExtension->PortImplemented = StorPortReadRegisterUlong(adapterExtension, &abar->PI); + + if (adapterExtension->PortImplemented == 0) + return SP_RETURN_ERROR; + + // get port count -- Number of set bits in `adapterExtension->PortImplemented` + portCount = 0; + portImplemented = adapterExtension->PortImplemented; + while(portImplemented > 0) + { + portCount++; + portImplemented &= (portImplemented - 1);// i love playing with bits :D + } + + ConfigInfo->MaximumTransferLength = 128 * 1024;//128 KB + ConfigInfo->NumberOfPhysicalBreaks = 0x21; + ConfigInfo->MaximumNumberOfTargets = 1; + ConfigInfo->MaximumNumberOfLogicalUnits = 1; + ConfigInfo->ResetTargetSupported = TRUE; + ConfigInfo->NumberOfBuses = 32; + ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex; + ConfigInfo->ScatterGather = TRUE; + + // Turn IE -- Interrupt Enabled + ghc |= 0x2; + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + + + return SP_RETURN_FOUND; +}// -- AhciFindAdapter(); + +/** + * @name DriverEntry + * @implemented + * + * Initial Entrypoint for storahci miniport driver + * + * @param DriverObject + * @param RegistryPath + * + * @return + * NT_STATUS in case of driver loaded successfully. + */ ULONG DriverEntry( - IN PVOID DriverObject, - IN PVOID RegistryPath + IN PVOID DriverObject, + IN PVOID RegistryPath ) { - /* - * Description : - * Initial Entrypoint for storahci miniport driver - */ - - HW_INITIALIZATION_DATA hwInitializationData; - ULONG i, status; - - DebugPrint("Storahci -> DriverEntry()\n"); - - // initialize the hardware data structure - for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++) - ((PUCHAR)&hwInitializationData)[i] = 0; - - // set size of hardware initialization structure - hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); - - // identity required miniport entry point routines - hwInitializationData.HwFindAdapter = AhciFindAdapter; - - // adapter specific information - hwInitializationData.NeedPhysicalAddresses = TRUE; - hwInitializationData.TaggedQueuing = TRUE; - hwInitializationData.AutoRequestSense = TRUE; - hwInitializationData.MultipleRequestPerLu = TRUE; - - hwInitializationData.NumberOfAccessRanges = 6; - hwInitializationData.AdapterInterfaceType = PCIBus; - hwInitializationData.MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS; - - // set required extension sizes - hwInitializationData.SrbExtensionSize = sizeof(AHCI_SRB_EXTENSION); - hwInitializationData.DeviceExtensionSize = sizeof(AHCI_ADAPTER_EXTENSION); + HW_INITIALIZATION_DATA hwInitializationData; + ULONG i, status; + + DebugPrint("Storahci -> DriverEntry()\n"); + + // initialize the hardware data structure + for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++) + ((PUCHAR)&hwInitializationData)[i] = 0; + + // set size of hardware initialization structure + hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); + + // identity required miniport entry point routines + hwInitializationData.HwFindAdapter = AhciFindAdapter; + + // adapter specific information + hwInitializationData.NeedPhysicalAddresses = TRUE; + hwInitializationData.TaggedQueuing = TRUE; + hwInitializationData.AutoRequestSense = TRUE; + hwInitializationData.MultipleRequestPerLu = TRUE; + + hwInitializationData.NumberOfAccessRanges = 6; + hwInitializationData.AdapterInterfaceType = PCIBus; + hwInitializationData.MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS; + + // set required extension sizes + hwInitializationData.SrbExtensionSize = sizeof(AHCI_SRB_EXTENSION); + hwInitializationData.DeviceExtensionSize = sizeof(AHCI_ADAPTER_EXTENSION); - // register our hw init data - status = StorPortInitialize( - DriverObject, - RegistryPath, - &hwInitializationData, - NULL); + // register our hw init data + status = StorPortInitialize( + DriverObject, + RegistryPath, + &hwInitializationData, + NULL); return status; }// -- DriverEntry(); +/** + * @name AhciAdapterReset + * @implemented + * + * 10.4.3 HBA Reset + * If the HBA becomes unusable for multiple ports, and a software reset or port reset does not correct the + * problem, software may reset the entire HBA by setting GHC.HR to â1â. When software sets the GHC.HR + * bit to â1â, the HBA shall perform an internal reset action. The bit shall be cleared to â0â by the HBA when + * the reset is complete. A software write of â0â to GHC.HR shall have no effect. To perform the HBA reset, + * software sets GHC.HR to â1â and may poll until this bit is read to be â0â, at which point software knows that + * the HBA reset has completed. + * If the HBA has not cleared GHC.HR to â0â within 1 second of software setting GHC.HR to â1â, the HBA is in + * a hung or locked state. + * + * @param adapterExtension + * + * @return + * TRUE in case AHCI Controller RESTARTED successfully. i.e GHC.HR == 0 + */ BOOLEAN AhciAdapterReset( - PAHCI_ADAPTER_EXTENSION adapterExtension + PAHCI_ADAPTER_EXTENSION adapterExtension ) { - /* - * 10.4.3 HBA Reset - * If the HBA becomes unusable for multiple ports, and a software reset or port reset does not correct the - * problem, software may reset the entire HBA by setting GHC.HR to â1â. When software sets the GHC.HR - * bit to â1â, the HBA shall perform an internal reset action. The bit shall be cleared to â0â by the HBA when - * the reset is complete. A software write of â0â to GHC.HR shall have no effect. To perform the HBA reset, - * software sets GHC.HR to â1â and may poll until this bit is read to be â0â, at which point software knows that - * the HBA reset has completed. - * If the HBA has not cleared GHC.HR to â0â within 1 second of software setting GHC.HR to â1â, the HBA is in - * a hung or locked state. - */ - ULONG ghc, ticks; - PAHCI_MEMORY_REGISTERS abar = NULL; - - abar = adapterExtension->ABAR_Address; - - if (abar == NULL) // basic sanity - return FALSE; - - // HR -- Very first bit (lowest significant) - ghc = 1; - StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); - - for (ticks = 0; (ticks < 50) && - (StorPortReadRegisterUlong(adapterExtension, &abar->GHC) == 1); - StorPortStallExecution(20000), ticks++); - - if (ticks == 50)//1 second - return FALSE; - - return TRUE; + ULONG ghc, ticks; + PAHCI_MEMORY_REGISTERS abar = NULL; + + abar = adapterExtension->ABAR_Address; + + if (abar == NULL) // basic sanity + return FALSE; + + // HR -- Very first bit (lowest significant) + ghc = 1; + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + for (ticks = 0; (ticks < 50) && + (StorPortReadRegisterUlong(adapterExtension, &abar->GHC) == 1); + StorPortStallExecution(20000), ticks++); + + if (ticks == 50)//1 second + return FALSE; + + return TRUE; }// -- AhciAdapterReset(); Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Thu Jun 2 14:43:56 2016 @@ -3,72 +3,72 @@ typedef struct _AHCI_PORT { - ULONG CLB; // 0x00, command list base address, 1K-byte aligned - ULONG CLBU; // 0x04, command list base address upper 32 bits - ULONG FB; // 0x08, FIS base address, 256-byte aligned - ULONG FBU; // 0x0C, FIS base address upper 32 bits - ULONG IS; // 0x10, interrupt status - ULONG IE; // 0x14, interrupt enable - ULONG CMD; // 0x18, command and status - ULONG RSV0; // 0x1C, Reserved - ULONG TFD; // 0x20, task file data - ULONG SIG; // 0x24, signature - ULONG SSTS; // 0x28, SATA status (SCR0:SStatus) - ULONG SCTL; // 0x2C, SATA control (SCR2:SControl) - ULONG SERR; // 0x30, SATA error (SCR1:SError) - ULONG SACT; // 0x34, SATA active (SCR3:SActive) - ULONG CI; // 0x38, command issue - ULONG SNTF; // 0x3C, SATA notification (SCR4:SNotification) - ULONG FBS; // 0x40, FIS-based switch control - ULONG RSV1[11]; // 0x44 ~ 0x6F, Reserved - ULONG Vendor[4]; // 0x70 ~ 0x7F, vendor specific + ULONG CLB; // 0x00, command list base address, 1K-byte aligned + ULONG CLBU; // 0x04, command list base address upper 32 bits + ULONG FB; // 0x08, FIS base address, 256-byte aligned + ULONG FBU; // 0x0C, FIS base address upper 32 bits + ULONG IS; // 0x10, interrupt status + ULONG IE; // 0x14, interrupt enable + ULONG CMD; // 0x18, command and status + ULONG RSV0; // 0x1C, Reserved + ULONG TFD; // 0x20, task file data + ULONG SIG; // 0x24, signature + ULONG SSTS; // 0x28, SATA status (SCR0:SStatus) + ULONG SCTL; // 0x2C, SATA control (SCR2:SControl) + ULONG SERR; // 0x30, SATA error (SCR1:SError) + ULONG SACT; // 0x34, SATA active (SCR3:SActive) + ULONG CI; // 0x38, command issue + ULONG SNTF; // 0x3C, SATA notification (SCR4:SNotification) + ULONG FBS; // 0x40, FIS-based switch control + ULONG RSV1[11]; // 0x44 ~ 0x6F, Reserved + ULONG Vendor[4]; // 0x70 ~ 0x7F, vendor specific } AHCI_PORT; typedef struct _AHCI_MEMORY_REGISTERS { - // 0x00 - 0x2B, Generic Host Control - ULONG CAP; // 0x00, Host capability - ULONG GHC; // 0x04, Global host control - ULONG IS; // 0x08, Interrupt status - ULONG PI; // 0x0C, Port implemented - ULONG VS; // 0x10, Version - ULONG CCC_CTL; // 0x14, Command completion coalescing control - ULONG CCC_PTS; // 0x18, Command completion coalescing ports - ULONG EM_LOC; // 0x1C, Enclosure management location - ULONG EM_CTL; // 0x20, Enclosure management control - ULONG CAP2; // 0x24, Host capabilities extended - ULONG BOHC; // 0x28, BIOS/OS handoff control and status + // 0x00 - 0x2B, Generic Host Control + ULONG CAP; // 0x00, Host capability + ULONG GHC; // 0x04, Global host control + ULONG IS; // 0x08, Interrupt status + ULONG PI; // 0x0C, Port implemented + ULONG VS; // 0x10, Version + ULONG CCC_CTL; // 0x14, Command completion coalescing control + ULONG CCC_PTS; // 0x18, Command completion coalescing ports + ULONG EM_LOC; // 0x1C, Enclosure management location + ULONG EM_CTL; // 0x20, Enclosure management control + ULONG CAP2; // 0x24, Host capabilities extended + ULONG BOHC; // 0x28, BIOS/OS handoff control and status - // 0x2C - 0x9F, Reserved - ULONG Reserved[0xA0-0x2C]; + // 0x2C - 0x9F, Reserved + ULONG Reserved[0xA0-0x2C]; - // 0xA0 - 0xFF, Vendor specific registers - ULONG VendorSpecific[0x100-0xA0]; + // 0xA0 - 0xFF, Vendor specific registers + ULONG VendorSpecific[0x100-0xA0]; - AHCI_PORT PortList[32];//1~32 + AHCI_PORT PortList[32];//1~32 } AHCI_MEMORY_REGISTERS, *PAHCI_MEMORY_REGISTERS; typedef struct _AHCI_ADAPTER_EXTENSION { - ULONG AdapterNumber; - ULONG SystemIoBusNumber; - ULONG SlotNumber; - ULONG AhciBaseAddress; - ULONG IS; // Interrupt status - ULONG PortImplemented; + ULONG AdapterNumber; + ULONG SystemIoBusNumber; + ULONG SlotNumber; + ULONG AhciBaseAddress; + ULONG IS; // Interrupt status + ULONG PortImplemented; - USHORT VendorID; - USHORT DeviceID; - USHORT RevisionID; + USHORT VendorID; + USHORT DeviceID; + USHORT RevisionID; - ULONG Version; - ULONG CAP; - ULONG CAP2; - PAHCI_MEMORY_REGISTERS ABAR_Address; + ULONG Version; + ULONG CAP; + ULONG CAP2; + PAHCI_MEMORY_REGISTERS ABAR_Address; } AHCI_ADAPTER_EXTENSION, *PAHCI_ADAPTER_EXTENSION; typedef struct _AHCI_SRB_EXTENSION { - ULONG AdapterNumber; -} AHCI_SRB_EXTENSION; + ULONG AdapterNumber; +} AHCI_SRB_EXTENSION;
8 years, 7 months
1
0
0
0
[apriyadarshi] 71499: == Storahci driver - Added DriverEntry - Added AhciFindAdapter : Need to add code for port initialization. - Compile : OK - Test : NOT TESTED
by apriyadarshi@svn.reactos.org
Author: apriyadarshi Date: Thu Jun 2 14:13:06 2016 New Revision: 71499 URL:
http://svn.reactos.org/svn/reactos?rev=71499&view=rev
Log: == Storahci driver - Added DriverEntry - Added AhciFindAdapter : Need to add code for port initialization. - Compile : OK - Test : NOT TESTED Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/ branches/GSoC_2016/AHCI/drivers/storage/storahci/makefile (with props) branches/GSoC_2016/AHCI/drivers/storage/storahci/sources (with props) branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c (with props) branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h (with props) Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/makefile URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/makefile (added) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/makefile [iso-8859-1] Thu Jun 2 14:13:06 2016 @@ -0,0 +1,3 @@ + +MINIMUM_NT_TARGET_VERSION=0x502 +!INCLUDE $(NTMAKEENV)\makefile.def Propchange: branches/GSoC_2016/AHCI/drivers/storage/storahci/makefile ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/sources URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/sources (added) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/sources [iso-8859-1] Thu Jun 2 14:13:06 2016 @@ -0,0 +1,8 @@ +TARGETNAME = storahci +TARGETTYPE = MINIPORT + +TARGETLIBS=$(DDK_LIB_PATH)\storport.lib + +INCLUDES = %BUILD%\inc +LIBS = %BUILD%\lib +SOURCES = storahci.c Propchange: branches/GSoC_2016/AHCI/drivers/storage/storahci/sources ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c (added) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Thu Jun 2 14:13:06 2016 @@ -0,0 +1,231 @@ +#include "storahci.h" + +BOOLEAN AhciAdapterReset( + __in PAHCI_ADAPTER_EXTENSION adapterExtension +); + +ULONG AhciFindAdapter( + IN PVOID DeviceExtension, + __in PVOID HwContext, + __in PVOID BusInformation, + __in IN PVOID ArgumentString, + __inout PPORT_CONFIGURATION_INFORMATION ConfigInfo, + __in PBOOLEAN Reserved3 +) +{ + /* Description : + * The HwStorFindAdapter routine uses the supplied configuration to determine whether a specific + * HBA is supported and, if it is, to return configuration information about that adapter. + * + * Refernce: + * 10.1 Platform Communication + *
http://www.intel.in/content/dam/www/public/us/en/documents/technical-specif…
+ * + * Return Value: + * SP_RETURN_FOUND + * Indicates that a supported HBA was found and that the HBA-relevant configuration information was successfully determined and set in the PORT_CONFIGURATION_INFORMATION structure. + * + * SP_RETURN_ERROR + * Indicates that an HBA was found but there was an error obtaining the configuration information. If possible, such an error should be logged with StorPortLogError. + * + * SP_RETURN_BAD_CONFIG + * Indicates that the supplied configuration information was invalid for the adapter. + * + * SP_RETURN_NOT_FOUND + * Indicates that no supported HBA was found for the supplied configuration information. + */ + + ULONG ghc; + ULONG portCount, portImplemented; + ULONG pci_cfg_len; + UCHAR pci_cfg_buf[0x30]; + + PAHCI_MEMORY_REGISTERS abar; + PPCI_COMMON_CONFIG pciConfigData; + PAHCI_ADAPTER_EXTENSION adapterExtension; + + adapterExtension = (PAHCI_ADAPTER_EXTENSION)DeviceExtension; + adapterExtension->SlotNumber = ConfigInfo->SlotNumber; + adapterExtension->SystemIoBusNumber = ConfigInfo->SystemIoBusNumber; + + // get PCI configuration header + pci_cfg_len = StorPortGetBusData( + adapterExtension, + PCIConfiguration, + adapterExtension->SystemIoBusNumber, + adapterExtension->SlotNumber, + (PVOID)pci_cfg_buf, + (ULONG)0x30); + + if (pci_cfg_len != 0x30) + return SP_RETURN_ERROR;//Not a valid device at the given bus number + + pciConfigData = (PPCI_COMMON_CONFIG)pci_cfg_buf; + adapterExtension->VendorID = pciConfigData->VendorID; + adapterExtension->DeviceID = pciConfigData->DeviceID; + adapterExtension->RevisionID = pciConfigData->RevisionID; + // The last PCI base address register (BAR[5], header offset 0x24) points to the AHCI base memory, itâs called ABAR (AHCI Base Memory Register). + adapterExtension->AhciBaseAddress = pciConfigData->u.type0.BaseAddresses[5] & (0xFFFFFFF0); + + // 2.1.11 + abar = NULL; + if (ConfigInfo->NumberOfAccessRanges > 0) + { + ULONG accessIndex; + for (accessIndex = 0; accessIndex < ConfigInfo->NumberOfAccessRanges; accessIndex++) + { + if ((*(ConfigInfo->AccessRanges))[accessIndex].RangeStart.QuadPart == adapterExtension->AhciBaseAddress) + { + abar = (PAHCI_MEMORY_REGISTERS)StorPortGetDeviceBase( + adapterExtension, + ConfigInfo->AdapterInterfaceType, + ConfigInfo->SystemIoBusNumber, + (*(ConfigInfo->AccessRanges))[accessIndex].RangeStart, + (*(ConfigInfo->AccessRanges))[accessIndex].RangeLength, + (BOOLEAN)!(*(ConfigInfo->AccessRanges))[accessIndex].RangeInMemory); + break; + } + } + } + + if (abar == NULL) + return SP_RETURN_ERROR; // corrupted information supplied + + adapterExtension->ABAR_Address = abar; + adapterExtension->CAP = StorPortReadRegisterUlong(adapterExtension, &abar->CAP); + adapterExtension->CAP2 = StorPortReadRegisterUlong(adapterExtension, &abar->CAP2); + adapterExtension->Version = StorPortReadRegisterUlong(adapterExtension, &abar->VS); + + // 10.1.2 + // 1. Indicate that system software is AHCI aware by setting GHC.AE to â1â. + ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); + // AE := Highest Significant bit of GHC + if ((ghc & (0x1<<31)) == 1)//Hmm, controller was already in power state + { + // reset controller to have it in know state + DebugPrint("AhciFindAdapter -> AE Already set, Reset()\n"); + if (!AhciAdapterReset(adapterExtension)) + return SP_RETURN_ERROR;// reset failed + } + + ghc = 0x1<<31;// only AE=1 + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + adapterExtension->IS = abar->IS; + adapterExtension->PortImplemented = StorPortReadRegisterUlong(adapterExtension, &abar->PI); + + if (adapterExtension->PortImplemented == 0) + return SP_RETURN_ERROR; + + // get port count -- Number of set bits in `adapterExtension->PortImplemented` + portCount = 0; + portImplemented = adapterExtension->PortImplemented; + while(portImplemented > 0) + { + portCount++; + portImplemented &= (portImplemented - 1);// i love playing with bits :D + } + + ConfigInfo->MaximumTransferLength = 128 * 1024;//128 KB + ConfigInfo->NumberOfPhysicalBreaks = 0x21; + ConfigInfo->MaximumNumberOfTargets = 1; + ConfigInfo->MaximumNumberOfLogicalUnits = 1; + ConfigInfo->ResetTargetSupported = TRUE; + ConfigInfo->NumberOfBuses = 32; + ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex; + ConfigInfo->ScatterGather = TRUE; + + // Turn IE -- Interrupt Enabled + ghc |= 0x2; + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + + + return SP_RETURN_FOUND; +}// -- AhciFindAdapter(); + +ULONG DriverEntry( + IN PVOID DriverObject, + IN PVOID RegistryPath +) +{ + /* + * Description : + * Initial Entrypoint for storahci miniport driver + */ + + HW_INITIALIZATION_DATA hwInitializationData; + ULONG i, status; + + DebugPrint("Storahci -> DriverEntry()\n"); + + // initialize the hardware data structure + for (i = 0; i < sizeof(HW_INITIALIZATION_DATA); i++) + ((PUCHAR)&hwInitializationData)[i] = 0; + + // set size of hardware initialization structure + hwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA); + + // identity required miniport entry point routines + hwInitializationData.HwFindAdapter = AhciFindAdapter; + + // adapter specific information + hwInitializationData.NeedPhysicalAddresses = TRUE; + hwInitializationData.TaggedQueuing = TRUE; + hwInitializationData.AutoRequestSense = TRUE; + hwInitializationData.MultipleRequestPerLu = TRUE; + + hwInitializationData.NumberOfAccessRanges = 6; + hwInitializationData.AdapterInterfaceType = PCIBus; + hwInitializationData.MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS; + + // set required extension sizes + hwInitializationData.SrbExtensionSize = sizeof(AHCI_SRB_EXTENSION); + hwInitializationData.DeviceExtensionSize = sizeof(AHCI_ADAPTER_EXTENSION); + + // register our hw init data + status = StorPortInitialize( + DriverObject, + RegistryPath, + &hwInitializationData, + NULL); + + return status; +}// -- DriverEntry(); + +BOOLEAN AhciAdapterReset( + PAHCI_ADAPTER_EXTENSION adapterExtension +) +{ + /* + * 10.4.3 HBA Reset + * If the HBA becomes unusable for multiple ports, and a software reset or port reset does not correct the + * problem, software may reset the entire HBA by setting GHC.HR to â1â. When software sets the GHC.HR + * bit to â1â, the HBA shall perform an internal reset action. The bit shall be cleared to â0â by the HBA when + * the reset is complete. A software write of â0â to GHC.HR shall have no effect. To perform the HBA reset, + * software sets GHC.HR to â1â and may poll until this bit is read to be â0â, at which point software knows that + * the HBA reset has completed. + * If the HBA has not cleared GHC.HR to â0â within 1 second of software setting GHC.HR to â1â, the HBA is in + * a hung or locked state. + */ + ULONG ghc, ticks; + PAHCI_MEMORY_REGISTERS abar = NULL; + + abar = adapterExtension->ABAR_Address; + + if (abar == NULL) // basic sanity + return FALSE; + + // HR -- Very first bit (lowest significant) + ghc = 1; + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + + for (ticks = 0; (ticks < 50) && + (StorPortReadRegisterUlong(adapterExtension, &abar->GHC) == 1); + StorPortStallExecution(20000), ticks++); + + if (ticks == 50)//1 second + return FALSE; + + return TRUE; +}// -- AhciAdapterReset(); Propchange: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h (added) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Thu Jun 2 14:13:06 2016 @@ -0,0 +1,74 @@ +#include "miniport.h" +#include "storport.h" + +typedef struct _AHCI_PORT +{ + ULONG CLB; // 0x00, command list base address, 1K-byte aligned + ULONG CLBU; // 0x04, command list base address upper 32 bits + ULONG FB; // 0x08, FIS base address, 256-byte aligned + ULONG FBU; // 0x0C, FIS base address upper 32 bits + ULONG IS; // 0x10, interrupt status + ULONG IE; // 0x14, interrupt enable + ULONG CMD; // 0x18, command and status + ULONG RSV0; // 0x1C, Reserved + ULONG TFD; // 0x20, task file data + ULONG SIG; // 0x24, signature + ULONG SSTS; // 0x28, SATA status (SCR0:SStatus) + ULONG SCTL; // 0x2C, SATA control (SCR2:SControl) + ULONG SERR; // 0x30, SATA error (SCR1:SError) + ULONG SACT; // 0x34, SATA active (SCR3:SActive) + ULONG CI; // 0x38, command issue + ULONG SNTF; // 0x3C, SATA notification (SCR4:SNotification) + ULONG FBS; // 0x40, FIS-based switch control + ULONG RSV1[11]; // 0x44 ~ 0x6F, Reserved + ULONG Vendor[4]; // 0x70 ~ 0x7F, vendor specific +} AHCI_PORT; + +typedef struct _AHCI_MEMORY_REGISTERS +{ + // 0x00 - 0x2B, Generic Host Control + ULONG CAP; // 0x00, Host capability + ULONG GHC; // 0x04, Global host control + ULONG IS; // 0x08, Interrupt status + ULONG PI; // 0x0C, Port implemented + ULONG VS; // 0x10, Version + ULONG CCC_CTL; // 0x14, Command completion coalescing control + ULONG CCC_PTS; // 0x18, Command completion coalescing ports + ULONG EM_LOC; // 0x1C, Enclosure management location + ULONG EM_CTL; // 0x20, Enclosure management control + ULONG CAP2; // 0x24, Host capabilities extended + ULONG BOHC; // 0x28, BIOS/OS handoff control and status + + // 0x2C - 0x9F, Reserved + ULONG Reserved[0xA0-0x2C]; + + // 0xA0 - 0xFF, Vendor specific registers + ULONG VendorSpecific[0x100-0xA0]; + + AHCI_PORT PortList[32];//1~32 + +} AHCI_MEMORY_REGISTERS, *PAHCI_MEMORY_REGISTERS; + +typedef struct _AHCI_ADAPTER_EXTENSION +{ + ULONG AdapterNumber; + ULONG SystemIoBusNumber; + ULONG SlotNumber; + ULONG AhciBaseAddress; + ULONG IS; // Interrupt status + ULONG PortImplemented; + + USHORT VendorID; + USHORT DeviceID; + USHORT RevisionID; + + ULONG Version; + ULONG CAP; + ULONG CAP2; + PAHCI_MEMORY_REGISTERS ABAR_Address; +} AHCI_ADAPTER_EXTENSION, *PAHCI_ADAPTER_EXTENSION; + +typedef struct _AHCI_SRB_EXTENSION +{ + ULONG AdapterNumber; +} AHCI_SRB_EXTENSION; Propchange: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h ------------------------------------------------------------------------------ svn:eol-style = native
8 years, 7 months
1
0
0
0
[tfaber] 71498: [BROWSEUI] - Avoid a double free in CComCatCachedCategory::CacheDSA. CComHeapPtr already takes care of this.
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 2 12:19:56 2016 New Revision: 71498 URL:
http://svn.reactos.org/svn/reactos?rev=71498&view=rev
Log: [BROWSEUI] - Avoid a double free in CComCatCachedCategory::CacheDSA. CComHeapPtr already takes care of this. Modified: trunk/reactos/dll/win32/browseui/comcat.cpp Modified: trunk/reactos/dll/win32/browseui/comcat.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/comcat.…
============================================================================== --- trunk/reactos/dll/win32/browseui/comcat.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/comcat.cpp [iso-8859-1] Thu Jun 2 12:19:56 2016 @@ -161,7 +161,6 @@ SHSetValue(HKEY_CURRENT_USER, bufKey, IMPLEMENTING, REG_BINARY, buffer, bufferSize); guidArray = NULL; - CoTaskMemFree(buffer); return S_OK; }
8 years, 7 months
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Results per page:
10
25
50
100
200