[ros-diffs] [reactos] 01/02: [FREELDR] Improvements for the RamDisk support.

2019-10-08 Thread Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db15c921e8f92b7bad319df4962e255087a8ca94

commit db15c921e8f92b7bad319df4962e255087a8ca94
Author: Hermès Bélusca-Maïto 
AuthorDate: Fri Sep 13 19:04:06 2019 +0200
Commit: Hermès Bélusca-Maïto 
CommitDate: Wed Oct 9 03:26:41 2019 +0200

[FREELDR] Improvements for the RamDisk support.

- Implement support for the "RDIMAGELENGTH" and "RDIMAGEOFFSET" boot
  options. Fixes CORE-15432.

- Separate the initialization of the global gInitRamDiskBase /
  gInitRamDiskSize variables from the FreeLdr command-line, and the
  actual initialization of the internal variables of the RamDisk.
  The latter are initialized via calls to RamDiskInitialize().

- Implement 'SeekRelative' mode in RamDiskSeek().

- Make RamDiskLoadVirtualFile() internal function that gets called by
  RamDiskInitialize(), and we use the latter in the NT loader instead.
---
 boot/freeldr/freeldr/arch/arm/macharm.c |   4 +-
 boot/freeldr/freeldr/cmdline.c  |  10 +-
 boot/freeldr/freeldr/disk/ramdisk.c | 230 +---
 boot/freeldr/freeldr/include/ramdisk.h  |  26 ++--
 boot/freeldr/freeldr/ntldr/setupldr.c   |  14 +-
 boot/freeldr/freeldr/ntldr/winldr.c |  18 +--
 6 files changed, 182 insertions(+), 120 deletions(-)

diff --git a/boot/freeldr/freeldr/arch/arm/macharm.c 
b/boot/freeldr/freeldr/arch/arm/macharm.c
index d38a38924f7..cfca3b17169 100644
--- a/boot/freeldr/freeldr/arch/arm/macharm.c
+++ b/boot/freeldr/freeldr/arch/arm/macharm.c
@@ -120,8 +120,8 @@ ArmHwDetect(VOID)
 SecondLevelIcacheSize =
 SecondLevelIcacheFillSize = 0;
 
-/* Register RAMDISK Device */
-RamDiskInitialize();
+/* Initialize the RAMDISK Device */
+RamDiskInitialize(TRUE, NULL, NULL);
 
 /* Fill out the ARC disk block */
 AddReactOSArcDiskInfo("ramdisk(0)", 0xBADAB00F, 0xDEADBABE, TRUE);
diff --git a/boot/freeldr/freeldr/cmdline.c b/boot/freeldr/freeldr/cmdline.c
index b7ac90dd274..c41466e6163 100644
--- a/boot/freeldr/freeldr/cmdline.c
+++ b/boot/freeldr/freeldr/cmdline.c
@@ -91,7 +91,7 @@ CmdLineParse(IN PCSTR CmdLine)
 Setting = strstr(CmdLine, "rdbase=");
 if (Setting)
 {
-gRamDiskBase =
+gInitRamDiskBase =
 (PVOID)(ULONG_PTR)strtoull(Setting +
sizeof("rdbase=") - sizeof(ANSI_NULL),
NULL, 0);
@@ -101,9 +101,9 @@ CmdLineParse(IN PCSTR CmdLine)
 Setting = strstr(CmdLine, "rdsize=");
 if (Setting)
 {
-gRamDiskSize = strtoul(Setting +
-   sizeof("rdsize=") - sizeof(ANSI_NULL),
-   NULL, 0);
+gInitRamDiskSize = strtoul(Setting +
+   sizeof("rdsize=") - sizeof(ANSI_NULL),
+   NULL, 0);
 }
 
 /* Get ramdisk offset */
@@ -116,7 +116,7 @@ CmdLineParse(IN PCSTR CmdLine)
 }
 
 /* Fix it up */
-gRamDiskBase = (PVOID)((ULONG_PTR)gRamDiskBase + Offset);
+gInitRamDiskBase = (PVOID)((ULONG_PTR)gInitRamDiskBase + Offset);
 }
 
 PCSTR
diff --git a/boot/freeldr/freeldr/disk/ramdisk.c 
b/boot/freeldr/freeldr/disk/ramdisk.c
index 905c40941fa..78503649a49 100644
--- a/boot/freeldr/freeldr/disk/ramdisk.c
+++ b/boot/freeldr/freeldr/disk/ramdisk.c
@@ -1,51 +1,48 @@
 /*
- * PROJECT: ReactOS Boot Loader
- * LICENSE: BSD - See COPYING.ARM in the top level directory
- * FILE:boot/freeldr/freeldr/disk/ramdisk.c
- * PURPOSE: Implements routines to support booting from a RAM Disk
- * PROGRAMMERS: ReactOS Portable Systems Group
- *  Herv� Poussineau
+ * PROJECT: FreeLoader
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * PURPOSE: Implements routines to support booting from a RAM Disk.
+ * COPYRIGHT:   Copyright 2008 ReactOS Portable Systems Group
+ *  Copyright 2009 Hervé Poussineau
+ *  Copyright 2019 Hermes Belusca-Maito
  */
 
 /* INCLUDES 
***/
 
 #include 
 
-#include 
-
 /* GLOBALS 
/
 
-PVOID gRamDiskBase;
-ULONG gRamDiskSize;
-ULONG gRamDiskOffset;
+PVOID gInitRamDiskBase = NULL;
+ULONG gInitRamDiskSize = 0;
+
+static BOOLEAN   RamDiskDeviceRegistered = FALSE;
+static PVOID RamDiskBase;
+static ULONGLONG RamDiskFileSize;// FIXME: RAM disks currently limited to 
4GB.
+static ULONGLONG RamDiskImageLength; // Size of valid data in the Ramdisk 
(usually == RamDiskFileSize - RamDiskImageOffset)
+static ULONG RamDiskImageOffset; // Starting offset from the Ramdisk base.
+static ULONGLONG RamDiskOffset;  // Current position in the Ramdisk.
 
 /* FUNCTIONS 
**/
 
 static ARC_STATUS RamDiskClose(ULONG FileId)
 {
-//

[ros-diffs] [reactos] 02/02: [FREELDR] Advance the file pointers every time a read operation is performed, in accordance with the ARC specification.

2019-10-08 Thread Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7909284220c291465de9ef02a9bbddf903fafe7f

commit 7909284220c291465de9ef02a9bbddf903fafe7f
Author: Hermès Bélusca-Maïto 
AuthorDate: Wed Oct 9 02:26:29 2019 +0200
Commit: Hermès Bélusca-Maïto 
CommitDate: Wed Oct 9 03:26:48 2019 +0200

[FREELDR] Advance the file pointers every time a read operation is 
performed, in accordance with the ARC specification.
---
 boot/freeldr/freeldr/arch/i386/hwdisk.c |  5 ++--
 boot/freeldr/freeldr/disk/scsiport.c|  5 +++-
 boot/freeldr/freeldr/lib/fs/btrfs.c |  1 +
 boot/freeldr/freeldr/lib/fs/ext2.c  | 10 +++
 boot/freeldr/freeldr/lib/fs/fat.c   | 11 
 boot/freeldr/freeldr/lib/fs/iso.c   | 47 +++--
 boot/freeldr/freeldr/lib/fs/ntfs.c  |  1 +
 7 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/boot/freeldr/freeldr/arch/i386/hwdisk.c 
b/boot/freeldr/freeldr/arch/i386/hwdisk.c
index 1717bdbd2dd..7aec1c3db99 100644
--- a/boot/freeldr/freeldr/arch/i386/hwdisk.c
+++ b/boot/freeldr/freeldr/arch/i386/hwdisk.c
@@ -157,8 +157,8 @@ DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
 DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
 UCHAR* Ptr = (UCHAR*)Buffer;
 ULONG Length, TotalSectors, MaxSectors, ReadSectors;
-BOOLEAN ret;
 ULONGLONG SectorOffset;
+BOOLEAN ret;
 
 ASSERT(DiskReadBufferSize > 0);
 
@@ -197,7 +197,8 @@ DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
 TotalSectors -= ReadSectors;
 }
 
-*Count = (ULONG)(Ptr - (UCHAR*)Buffer);
+*Count = (ULONG)((ULONG_PTR)Ptr - (ULONG_PTR)Buffer);
+Context->SectorNumber = SectorOffset - Context->SectorOffset;
 
 return (!ret) ? EIO : ESUCCESS;
 }
diff --git a/boot/freeldr/freeldr/disk/scsiport.c 
b/boot/freeldr/freeldr/disk/scsiport.c
index a42cadc6164..c9cff4bfd60 100644
--- a/boot/freeldr/freeldr/disk/scsiport.c
+++ b/boot/freeldr/freeldr/disk/scsiport.c
@@ -318,6 +318,7 @@ static ARC_STATUS DiskRead(ULONG FileId, VOID* Buffer, 
ULONG N, ULONG* Count)
 Buffer = (PUCHAR)Buffer + FullSectors * Context->SectorSize;
 N -= FullSectors * Context->SectorSize;
 *Count += FullSectors * Context->SectorSize;
+Context->SectorNumber += FullSectors;
 Lba += FullSectors;
 }
 
@@ -364,6 +365,7 @@ static ARC_STATUS DiskRead(ULONG FileId, VOID* Buffer, 
ULONG N, ULONG* Count)
 }
 RtlCopyMemory(Buffer, Sector, N);
 *Count += N;
+/* Context->SectorNumber remains untouched (incomplete sector read) */
 ExFreePool(Sector);
 }
 
@@ -399,7 +401,8 @@ static ARC_STATUS DiskSeek(ULONG FileId, LARGE_INTEGER* 
Position, SEEKMODE SeekM
 return ESUCCESS;
 }
 
-static const DEVVTBL DiskVtbl = {
+static const DEVVTBL DiskVtbl =
+{
 DiskClose,
 DiskGetFileInformation,
 DiskOpen,
diff --git a/boot/freeldr/freeldr/lib/fs/btrfs.c 
b/boot/freeldr/freeldr/lib/fs/btrfs.c
index 16a861427c4..2f763f061f9 100644
--- a/boot/freeldr/freeldr/lib/fs/btrfs.c
+++ b/boot/freeldr/freeldr/lib/fs/btrfs.c
@@ -1201,6 +1201,7 @@ ARC_STATUS BtrFsRead(ULONG FileId, VOID *Buffer, ULONG 
Size, ULONG *BytesRead)
 return ENOENT;
 }
 
+phandle->position += rd;
 *BytesRead = rd;
 return ESUCCESS;
 }
diff --git a/boot/freeldr/freeldr/lib/fs/ext2.c 
b/boot/freeldr/freeldr/lib/fs/ext2.c
index 9d183488d68..6ab00f3d1ab 100644
--- a/boot/freeldr/freeldr/lib/fs/ext2.c
+++ b/boot/freeldr/freeldr/lib/fs/ext2.c
@@ -386,9 +386,8 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, 
ULONGLONG BytesToRead, ULO
 }
 
 //
-// If they are trying to read past the
-// end of the file then return success
-// with BytesRead == 0
+// If the user is trying to read past the end of
+// the file then return success with BytesRead == 0.
 //
 if (Ext2FileInfo->FilePointer >= Ext2FileInfo->FileSize)
 {
@@ -396,8 +395,8 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, 
ULONGLONG BytesToRead, ULO
 }
 
 //
-// If they are trying to read more than there is to read
-// then adjust the amount to read
+// If the user is trying to read more than there is to read
+// then adjust the amount to read.
 //
 if ((Ext2FileInfo->FilePointer + BytesToRead) > Ext2FileInfo->FileSize)
 {
@@ -418,6 +417,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, 
ULONGLONG BytesToRead, ULO
 {
 *BytesRead = BytesToRead;
 }
+// Ext2FileInfo->FilePointer += BytesToRead;
 
 return TRUE;
 }
diff --git a/boot/freeldr/freeldr/lib/fs/fat.c 
b/boot/freeldr/freeldr/lib/fs/fat.c
index 35233c414b5..4c3358b9f2b 100644
--- a/boot/freeldr/freeldr/lib/fs/fat.c
+++ b/boot/freeldr/freeldr/lib/fs/fat.c
@@ -1206,9 +1206,8 @@ BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG 
BytesToRead, ULONG* BytesR
 }
 
 //
-// If they are trying to read past the
-// end of the file 

[ros-diffs] [reactos] 01/01: [FREELDR] Xbox memory management improvements (#1961)

2019-10-08 Thread Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=034820ca552437db68079f5d23b078262183bece

commit 034820ca552437db68079f5d23b078262183bece
Author: Stanislav Motylkov 
AuthorDate: Wed Oct 9 03:35:07 2019 +0300
Commit: Hermès BÉLUSCA - MAÏTO 
CommitDate: Wed Oct 9 02:35:07 2019 +0200

[FREELDR] Xbox memory management improvements (#1961)

- Reuse the framebuffer address that was set up by the firmware.
- Get rid of XboxMemReserveMemory() and use ReserveMemory() instead.

CORE-16216
---
 boot/freeldr/freeldr/arch/i386/xboxmem.c  | 48 +--
 boot/freeldr/freeldr/arch/i386/xboxvideo.c| 15 ---
 boot/freeldr/freeldr/include/arch/i386/machxbox.h |  1 -
 3 files changed, 29 insertions(+), 35 deletions(-)

diff --git a/boot/freeldr/freeldr/arch/i386/xboxmem.c 
b/boot/freeldr/freeldr/arch/i386/xboxmem.c
index 2d6890ea78e..bf7721dc32c 100644
--- a/boot/freeldr/freeldr/arch/i386/xboxmem.c
+++ b/boot/freeldr/freeldr/arch/i386/xboxmem.c
@@ -26,6 +26,8 @@ DBG_DEFAULT_CHANNEL(MEMORY);
 
 static ULONG InstalledMemoryMb = 0;
 static ULONG AvailableMemoryMb = 0;
+extern PVOID FrameBuffer;
+extern ULONG FrameBufferSize;
 
 #define TEST_SIZE 0x200
 #define TEST_PATTERN1 0xAA
@@ -38,6 +40,14 @@ SetMemory(
 SIZE_T Size,
 TYPE_OF_MEMORY MemoryType);
 
+extern VOID
+ReserveMemory(
+PFREELDR_MEMORY_DESCRIPTOR MemoryMap,
+ULONG_PTR BaseAddress,
+SIZE_T Size,
+TYPE_OF_MEMORY MemoryType,
+PCHAR Usage);
+
 extern ULONG
 PcMemFinalizeMemoryMap(
 PFREELDR_MEMORY_DESCRIPTOR MemoryMap);
@@ -85,7 +95,6 @@ XboxMemInit(VOID)
 WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
 WRITE_PORT_ULONG((ULONG*) 0xcfc, InstalledMemoryMb * 1024 * 1024 - 1);
 
-/* 4 MB video framebuffer is reserved later using XboxMemReserveMemory() */
 AvailableMemoryMb = InstalledMemoryMb;
 }
 
@@ -105,37 +114,18 @@ XboxMemGetMemoryMap(ULONG *MemoryMapSize)
   AvailableMemoryMb * 1024 * 1024,
   LoaderFree);
 
-/* Video memory */
-SetMemory(XboxMemoryMap,
-  AvailableMemoryMb * 1024 * 1024,
-  (InstalledMemoryMb - AvailableMemoryMb) * 1024 * 1024,
-  LoaderFirmwarePermanent);
-
-*MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap);
-return XboxMemoryMap;
-}
-
-PVOID
-XboxMemReserveMemory(ULONG MbToReserve)
-{
-/* This function is used to reserve video framebuffer in XboxVideoInit() */
-
-if (InstalledMemoryMb == 0)
-{
-/* Hmm, seems we're not initialized yet */
-XboxMemInit();
-}
-
-if (MbToReserve > AvailableMemoryMb)
+if (FrameBufferSize != 0)
 {
-/* Can't satisfy the request */
-return NULL;
+/* Video memory */
+ReserveMemory(XboxMemoryMap,
+  (ULONG_PTR)FrameBuffer,
+  FrameBufferSize,
+  LoaderFirmwarePermanent,
+  "Video memory");
 }
 
-AvailableMemoryMb -= MbToReserve;
-
-/* Top of available memory points to the space just reserved */
-return (PVOID)(AvailableMemoryMb * 1024 * 1024);
+*MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap);
+return XboxMemoryMap;
 }
 
 /* EOF */
diff --git a/boot/freeldr/freeldr/arch/i386/xboxvideo.c 
b/boot/freeldr/freeldr/arch/i386/xboxvideo.c
index bcb70d0ce10..c664eef5d3c 100644
--- a/boot/freeldr/freeldr/arch/i386/xboxvideo.c
+++ b/boot/freeldr/freeldr/arch/i386/xboxvideo.c
@@ -24,7 +24,8 @@
 
 DBG_DEFAULT_CHANNEL(UI);
 
-static PVOID FrameBuffer;
+PVOID FrameBuffer;
+ULONG FrameBufferSize;
 static ULONG ScreenWidth;
 static ULONG ScreenHeight;
 static ULONG BytesPerPixel;
@@ -126,8 +127,15 @@ XboxVideoInit(VOID)
 {
   ULONG AvMode;
 
-  FrameBuffer = (PVOID)((ULONG) XboxMemReserveMemory(FB_SIZE_MB) | 0xf000);
+  /* Reuse framebuffer that was set up by firmware */
+  FrameBuffer = (PVOID)*((PULONG) 0xfd600800);
+  /* Verify that framebuffer address is page-aligned */
+  ASSERT((ULONG_PTR)FrameBuffer % PAGE_SIZE == 0);
 
+  /* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB 
of RAM) */
+  FrameBufferSize = 4 * 1024 * 1024;
+
+  /* FIXME: don't use SMBus, obtain current video resolution directly from 
NV2A */
   if (I2CTransmitByteGetReturn(0x10, 0x04, ))
 {
   if (1 == AvMode) /* HDTV */
@@ -157,9 +165,6 @@ XboxVideoInit(VOID)
   Delta = (ScreenWidth * BytesPerPixel + 3) & ~ 0x3;
 
   XboxVideoClearScreenColor(MAKE_COLOR(0, 0, 0), TRUE);
-
-  /* Tell the nVidia controller about the framebuffer */
-  *((PULONG) 0xfd600800) = (ULONG) FrameBuffer;
 }
 
 VIDEODISPLAYMODE
diff --git a/boot/freeldr/freeldr/include/arch/i386/machxbox.h 
b/boot/freeldr/freeldr/include/arch/i386/machxbox.h
index f481bbde8f9..393f3a900e2 100644
--- a/boot/freeldr/freeldr/include/arch/i386/machxbox.h
+++ b/boot/freeldr/freeldr/include/arch/i386/machxbox.h
@@ -63,7 +63,6 @@ VOID XboxVideoPrepareForReactOS(VOID);
 VOID 

[ros-diffs] [reactos] 01/01: [XBOXVMP] Fix broken pixels and general refactoring (#1896)

2019-10-08 Thread Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b3301df570948549b9c4cca2c969384c59a69209

commit b3301df570948549b9c4cca2c969384c59a69209
Author: Stanislav Motylkov 
AuthorDate: Tue Oct 8 18:08:44 2019 +0300
Commit: Hermès BÉLUSCA - MAÏTO 
CommitDate: Tue Oct 8 17:08:44 2019 +0200

[XBOXVMP] Fix broken pixels and general refactoring (#1896)

- Remove old hacky code based on MmHighestPhysicalPage.
- Split I2C SMBus code into a separate source file.

CORE-16216 CORE-16357
---
 win32ss/drivers/miniport/xboxvmp/CMakeLists.txt |  10 +-
 win32ss/drivers/miniport/xboxvmp/xboxi2c.c  | 123 +
 win32ss/drivers/miniport/xboxvmp/xboxvmp.c  | 233 +++-
 win32ss/drivers/miniport/xboxvmp/xboxvmp.h  |  36 +---
 4 files changed, 203 insertions(+), 199 deletions(-)

diff --git a/win32ss/drivers/miniport/xboxvmp/CMakeLists.txt 
b/win32ss/drivers/miniport/xboxvmp/CMakeLists.txt
index d5f9f1332af..59941c74349 100644
--- a/win32ss/drivers/miniport/xboxvmp/CMakeLists.txt
+++ b/win32ss/drivers/miniport/xboxvmp/CMakeLists.txt
@@ -1,5 +1,13 @@
 
-add_library(xboxvmp MODULE xboxvmp.c xboxvmp.rc)
+list(APPEND SOURCE
+xboxi2c.c
+xboxvmp.c
+xboxvmp.h)
+
+add_library(xboxvmp MODULE
+${SOURCE}
+xboxvmp.rc)
+
 set_module_type(xboxvmp kernelmodedriver)
 add_importlibs(xboxvmp ntoskrnl videoprt)
 add_cd_file(TARGET xboxvmp DESTINATION reactos/system32/drivers FOR all)
diff --git a/win32ss/drivers/miniport/xboxvmp/xboxi2c.c 
b/win32ss/drivers/miniport/xboxvmp/xboxi2c.c
new file mode 100644
index 000..fc283af7e98
--- /dev/null
+++ b/win32ss/drivers/miniport/xboxvmp/xboxi2c.c
@@ -0,0 +1,123 @@
+/*
+ * PROJECT: ReactOS Xbox miniport video driver
+ * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: I2C SMBus routines
+ * COPYRIGHT:   Copyright 2004 Gé van Geldorp
+ *  Copyright 2004 Filip Navara
+ *  Copyright 2019 Stanislav Motylkov (x86co...@gmail.com)
+ */
+
+/* INCLUDES 
***/
+
+#include "xboxvmp.h"
+
+#include 
+#include 
+
+/* PUBLIC AND PRIVATE FUNCTIONS 
***/
+
+static
+BOOLEAN
+ReadfromSMBus(
+UCHAR Address,
+UCHAR bRegister,
+UCHAR Size,
+ULONG *Data_to_smbus)
+{
+int nRetriesToLive = 50;
+
+while ((VideoPortReadPortUshort((PUSHORT) (I2C_IO_BASE + 0)) & 0x0800) != 
0)
+{
+; /* Franz's spin while bus busy with any master traffic */
+}
+
+while (nRetriesToLive-- != 0)
+{
+UCHAR b;
+int temp;
+
+VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 4), (Address << 1) | 
1);
+VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 8), bRegister);
+
+temp = VideoPortReadPortUshort((PUSHORT) (I2C_IO_BASE + 0));
+VideoPortWritePortUshort((PUSHORT) (I2C_IO_BASE + 0), temp); /* clear 
down all preexisting errors */
+
+switch (Size)
+{
+case 4:
+{
+VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0d); /* 
DWORD modus ? */
+break;
+}
+
+case 2:
+{
+VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0b); /* 
WORD modus */
+break;
+}
+
+default:
+{
+VideoPortWritePortUchar((PUCHAR) (I2C_IO_BASE + 2), 0x0a); /* 
BYTE */
+}
+}
+
+b = 0;
+
+while ((b & 0x36) == 0)
+{
+b = VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 0));
+}
+
+if ((b & 0x24) != 0)
+{
+ERR_(IHVVIDEO, "I2CTransmitByteGetReturn error %x\n", b);
+}
+
+if ((b & 0x10) == 0)
+{
+ERR_(IHVVIDEO, "I2CTransmitByteGetReturn no complete, retry\n");
+}
+else
+{
+switch (Size)
+{
+case 4:
+{
+VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 6));
+VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
+VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
+VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
+VideoPortReadPortUchar((PUCHAR) (I2C_IO_BASE + 9));
+break;
+}
+
+case 2:
+{
+*Data_to_smbus = VideoPortReadPortUshort((PUSHORT) 
(I2C_IO_BASE + 6));
+break;
+}
+
+default:
+{
+*Data_to_smbus = VideoPortReadPortUchar((PUCHAR) 
(I2C_IO_BASE + 6));
+}
+}
+
+return TRUE;
+}
+}
+
+return FALSE;
+}
+
+BOOLEAN
+I2CTransmitByteGetReturn(
+UCHAR bPicAddressI2cFormat,
+UCHAR bDataToWrite,
+ULONG *Return)
+{
+  

[ros-diffs] [reactos] 01/01: [CMDUTILS] Add italian translation for 'comp' utility. (#1931)

2019-10-08 Thread Carlo Bramini
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3377b901b2604863527fdff291eb133d7ded4a1f

commit 3377b901b2604863527fdff291eb133d7ded4a1f
Author: Carlo Bramini <30959007+carlo-bram...@users.noreply.github.com>
AuthorDate: Tue Oct 8 16:52:30 2019 +0200
Commit: Hermès BÉLUSCA - MAÏTO 
CommitDate: Tue Oct 8 16:52:30 2019 +0200

[CMDUTILS] Add italian translation for 'comp' utility. (#1931)
---
 base/applications/cmdutils/comp/comp.rc   |  3 +++
 base/applications/cmdutils/comp/lang/it-IT.rc | 23 +++
 2 files changed, 26 insertions(+)

diff --git a/base/applications/cmdutils/comp/comp.rc 
b/base/applications/cmdutils/comp/comp.rc
index d440990dee7..9e564212ef9 100644
--- a/base/applications/cmdutils/comp/comp.rc
+++ b/base/applications/cmdutils/comp/comp.rc
@@ -21,6 +21,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 #ifdef LANGUAGE_FR_FR
 #include "lang/fr-FR.rc"
 #endif
+#ifdef LANGUAGE_IT_IT
+#include "lang/it-IT.rc"
+#endif
 #ifdef LANGUAGE_PL_PL
 #include "lang/pl-PL.rc"
 #endif
diff --git a/base/applications/cmdutils/comp/lang/it-IT.rc 
b/base/applications/cmdutils/comp/lang/it-IT.rc
new file mode 100644
index 000..c7cd95ffb51
--- /dev/null
+++ b/base/applications/cmdutils/comp/lang/it-IT.rc
@@ -0,0 +1,23 @@
+LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
+
+STRINGTABLE
+BEGIN
+IDS_HELP "Confronta il contenuto di due file o gruppi di file.\n\n\
+COMP [/L] [/A] [file1] [file2]\n\n\
+  file1  Specifica la posizione ed il nome del primo file da 
confrontare.\n\
+  file2  Specifica la posizione ed il nome del secondo file da 
confrontare.\n\
+  /A Visualizza le differenze con caratteri ASCII (predefinito: 
esadecimale).\n\
+  /L Visualizza i numeri delle linee differenti.\n"
+IDS_INVALIDSWITCH "Parametro non valido - /%c\n"
+IDS_BADSYNTAX "Errore di sintassi sulla linea di comando\n"
+IDS_FILEERROR "Impossibile aprire/trovare il file: %s\n"
+IDS_COMPARING "Confronto %s con %s...\n"
+IDS_FILESIZEERROR "Impossibile determinare la dimensione del file: %s\n"
+IDS_SIZEDIFFERS "I file hanno dimensione differente.\n"
+IDS_READERROR "Errore di lettura dei file.\n"
+IDS_MISMATCHLINE "Errore di confronto alla LINEA %d\n"
+IDS_MISMATCHOFFSET "Errore di confronto all'OFFSET 0x%X\n"
+IDS_ASCIIDIFF "file%d = %c\n"
+IDS_HEXADECIMALDIFF "file%d = %X\n"
+IDS_MATCH "Confronto dei file OK\n"
+END



[ros-diffs] [reactos] 01/01: [FREELDR] Handle Btrfs sparse extents (#1959)

2019-10-08 Thread maharmstone
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=90ac794bf284f4c2b78b532dc02fcf9275783209

commit 90ac794bf284f4c2b78b532dc02fcf9275783209
Author: maharmstone 
AuthorDate: Tue Oct 8 15:50:58 2019 +0100
Commit: Hermès BÉLUSCA - MAÏTO 
CommitDate: Tue Oct 8 16:50:57 2019 +0200

[FREELDR] Handle Btrfs sparse extents (#1959)
---
 boot/freeldr/freeldr/lib/fs/btrfs.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/boot/freeldr/freeldr/lib/fs/btrfs.c 
b/boot/freeldr/freeldr/lib/fs/btrfs.c
index aa12d0e066c..16a861427c4 100644
--- a/boot/freeldr/freeldr/lib/fs/btrfs.c
+++ b/boot/freeldr/freeldr/lib/fs/btrfs.c
@@ -687,6 +687,13 @@ static u64 btrfs_read_extent_reg(struct btrfs_path *path, 
struct btrfs_file_exte
 if (size > dlen - offset)
 size = dlen - offset;
 
+/* Handle sparse extent */
+if (extent->disk_bytenr == 0 && extent->disk_num_bytes == 0)
+{
+RtlZeroMemory(out, size);
+return size;
+}
+
 physical = logical_physical(extent->disk_bytenr);
 if (physical == INVALID_ADDRESS)
 {