-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] The ultimate ros amd64 bringup #361
Changes from 24 commits
91c8699
ff1eaad
15a08e8
cce3d16
286b2fb
12002d4
546c05b
1bc15af
1f6d61b
9e097de
aedb9f6
d139743
25064d0
75e11df
13ef07a
03920b1
235566d
1e326fb
c4fbc15
29db059
c24203c
c9d1f6a
e503f53
9335f8f
4b4a334
945d807
a26ae1d
bd078ab
7749bdc
177b3e7
52721c2
fbec870
d5bdd7e
4351118
5b1588c
1dc22b6
8366b2c
29d20df
10e086b
3252ac3
66eb02c
c93d924
c3380ef
c249c15
8b48097
e7e7e40
a9fc91d
6e0a3be
f062e2d
21177bb
ebe9bc4
c8bd63f
4c80d83
96f3020
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,8 +152,8 @@ HalpInitDma(VOID) | |
* Check if Extended DMA is available. We're just going to do a random | ||
* read and write. | ||
*/ | ||
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2), 0x2A); | ||
if (READ_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2)) == 0x2A) | ||
WRITE_PORT_UCHAR((PUCHAR)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2), 0x2A); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a little confused as to why these seem to have no base address, just the FIELD_OFFSET... but you didn't change that. The casts seem fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dunno, maybe the base address is 0? |
||
if (READ_PORT_UCHAR((PUCHAR)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2)) == 0x2A) | ||
{ | ||
DPRINT1("Machine supports EISA DMA. Bus type: %lu\n", HalpBusType); | ||
HalpEisaDma = TRUE; | ||
|
@@ -479,11 +479,11 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject, | |
|
||
if (Controller == 1) | ||
{ | ||
AdapterBaseVa = (PVOID)FIELD_OFFSET(EISA_CONTROL, DmaController1); | ||
AdapterBaseVa = (PVOID)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaController1); | ||
} | ||
else | ||
{ | ||
AdapterBaseVa = (PVOID)FIELD_OFFSET(EISA_CONTROL, DmaController2); | ||
AdapterBaseVa = (PVOID)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaController2); | ||
} | ||
|
||
AdapterObject->AdapterNumber = Controller; | ||
|
@@ -517,12 +517,12 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject, | |
|
||
if (Controller == 1) | ||
{ | ||
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode1), | ||
WRITE_PORT_UCHAR((PUCHAR)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode1), | ||
ExtendedMode.Byte); | ||
} | ||
else | ||
{ | ||
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode2), | ||
WRITE_PORT_UCHAR((PUCHAR)(ULONG_PTR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode2), | ||
ExtendedMode.Byte); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ HalpReboot(VOID) | |
PHARDWARE_PTE Pte; | ||
|
||
/* Get a PTE in the HAL reserved region */ | ||
ZeroPageMapping = (PVOID)(0xFFC00000 + PAGE_SIZE); | ||
ZeroPageMapping = UlongToPtr(0xFFC00000 + PAGE_SIZE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to create a define for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact the code is shitty and not portable, so I replaced it with a call to HalpMapPhysicalMemory64 |
||
Pte = GetPteAddress(ZeroPageMapping); | ||
|
||
/* Make it valid and map it to the first physical page */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,8 +20,8 @@ | |
#define MI_PAGED_POOL_START (PVOID)0xFFFFF8A000000000ULL // 128 GB paged pool [MiVaPagedPool] | ||
//#define MI_PAGED_POOL_END 0xFFFFF8BFFFFFFFFFULL | ||
//#define MI_SESSION_SPACE_START 0xFFFFF90000000000ULL // 512 GB session space [MiVaSessionSpace] | ||
#define MI_SESSION_VIEW_END 0xFFFFF97FFF000000ULL | ||
#define MI_SESSION_SPACE_END 0xFFFFF97FFFFFFFFFULL | ||
//#define MI_SESSION_VIEW_END 0xFFFFF97FFF000000ULL | ||
#define MI_SESSION_SPACE_END 0xFFFFF98000000000ULL | ||
#define MI_SYSTEM_CACHE_START 0xFFFFF98000000000ULL // 1 TB system cache (on Vista+ this is dynamic VA space) [MiVaSystemCache,MiVaSpecialPoolPaged,MiVaSpecialPoolNonPaged] | ||
#define MI_SYSTEM_CACHE_END 0xFFFFFA7FFFFFFFFFULL | ||
#define MI_PFN_DATABASE 0xFFFFFA8000000000ULL // up to 5.5 TB PFN database followed by non paged pool [MiVaPfnDatabase/MiVaNonPagedPool] | ||
|
@@ -54,11 +54,11 @@ | |
#define MI_MIN_INIT_PAGED_POOLSIZE (32 * _1MB) | ||
#define MI_MAX_INIT_NONPAGED_POOL_SIZE (128ULL * 1024 * 1024 * 1024) | ||
#define MI_MAX_NONPAGED_POOL_SIZE (128ULL * 1024 * 1024 * 1024) | ||
#define MI_SYSTEM_VIEW_SIZE (16 * _1MB) | ||
#define MI_SESSION_VIEW_SIZE (20 * _1MB) | ||
#define MI_SESSION_POOL_SIZE (16 * _1MB) | ||
#define MI_SESSION_IMAGE_SIZE (8 * _1MB) | ||
#define MI_SESSION_WORKING_SET_SIZE (4 * _1MB) | ||
#define MI_SYSTEM_VIEW_SIZE (104 * _1MB) | ||
#define MI_SESSION_VIEW_SIZE (104 * _1MB) | ||
#define MI_SESSION_POOL_SIZE (64 * _1MB) | ||
#define MI_SESSION_IMAGE_SIZE (16 * _1MB) | ||
#define MI_SESSION_WORKING_SET_SIZE (16 * _1MB) | ||
#define MI_SESSION_SIZE (MI_SESSION_VIEW_SIZE + \ | ||
MI_SESSION_POOL_SIZE + \ | ||
MI_SESSION_IMAGE_SIZE + \ | ||
|
@@ -258,8 +258,6 @@ MI_MAKE_SUBSECTION_PTE( | |
_Out_ PMMPTE NewPte, | ||
_In_ PVOID Segment) | ||
{ | ||
ULONG_PTR Offset; | ||
|
||
/* Mark this as a prototype */ | ||
NewPte->u.Long = 0; | ||
NewPte->u.Subsect.Prototype = 1; | ||
|
@@ -286,9 +284,10 @@ FORCEINLINE | |
BOOLEAN | ||
MI_IS_MAPPED_PTE(PMMPTE PointerPte) | ||
{ | ||
/// FIXME | ||
__debugbreak(); | ||
return ((PointerPte->u.Long & 0xFFFFFC01) != 0); | ||
return ((PointerPte->u.Hard.Valid != 0) || | ||
(PointerPte->u.Proto.Prototype != 0) || | ||
(PointerPte->u.Trans.Transition != 0) || | ||
(PointerPte->u.Hard.PageFrameNumber != 0)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Heh. An old WC of mine says:
Same thing I suppose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should technically be the same. If there is a reason for your variant, I can change it. |
||
} | ||
|
||
VOID | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,16 @@ | |
#define NDEBUG | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://jira.reactos.org/browse/CORE-10146 contains some info about that resource list parsing problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I added another hack to make it work a bit better, but it's still a bug. We need to figure out why these conflicts exist and fix it. |
||
#include <debug.h> | ||
|
||
static | ||
ULONG | ||
IopGetDescriptorSize( | ||
PCM_FULL_RESOURCE_DESCRIPTOR ResourceDescriptor) | ||
{ | ||
ULONG Count = ResourceDescriptor->PartialResourceList.Count; | ||
return FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, | ||
PartialResourceList.PartialDescriptors[Count]); | ||
} | ||
|
||
static | ||
BOOLEAN | ||
IopCheckDescriptorForConflict(PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) | ||
|
@@ -195,6 +205,9 @@ IopFindInterruptResource( | |
} | ||
} | ||
|
||
DPRINT1("Failed to satisfy interrupt requirement with IRQ 0x%x-0x%x\n", | ||
IoDesc->u.Interrupt.MinimumVector, | ||
IoDesc->u.Interrupt.MaximumVector); | ||
return FALSE; | ||
} | ||
|
||
|
@@ -542,12 +555,17 @@ IopCheckResourceDescriptor( | |
IN BOOLEAN Silent, | ||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) | ||
{ | ||
ULONG i, ii; | ||
ULONG i, ii, DescriptorSize; | ||
BOOLEAN Result = FALSE; | ||
PCM_FULL_RESOURCE_DESCRIPTOR FullDesc; | ||
|
||
FullDesc = &ResourceList->List[0]; | ||
for (i = 0; i < ResourceList->Count; i++) | ||
{ | ||
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList->List[i].PartialResourceList; | ||
PCM_PARTIAL_RESOURCE_LIST ResList = &FullDesc->PartialResourceList; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this correctly broke boot on x86 last I tried. https://jira.reactos.org/browse/CORE-10146 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still does. Or rather, after hacking hal it boots, but the i8042prt driver doesn't load due to resource conflict. Any help figuring out why that is / fixing it is welcome. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed a while ago that our acpi.sys doesn't correctly translate the resource info from the ACPI tables either, and suspected that could be part of the problem. I have a patch somewhere that's a start on testing/fixing this, but it's unfinished, as other priorities came up. That was what I'd planned as the next step, though I don't know if it will even fix anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tkreuzer : about which hack hal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vgalnt Believe me, when I think some debug print information helps, I either add that, or manually step though the code in WinDbg. The info is all there, it just needs someone to correctly interprete it. |
||
DescriptorSize = IopGetDescriptorSize(FullDesc); | ||
FullDesc = (PCM_FULL_RESOURCE_DESCRIPTOR)((PUCHAR)FullDesc + DescriptorSize); | ||
|
||
for (ii = 0; ii < ResList->Count; ii++) | ||
{ | ||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc2 = &ResList->PartialDescriptors[ii]; | ||
|
@@ -606,6 +624,14 @@ IopCheckResourceDescriptor( | |
break; | ||
|
||
case CmResourceTypeInterrupt: | ||
if (ResDesc->u.Interrupt.Vector == 0xA) | ||
{ | ||
//__debugbreak(); | ||
DPRINT("Got Interrupt IRQ (0x%x 0x%x vs. 0x%x 0x%x)\n", | ||
ResDesc->u.Interrupt.Vector, ResDesc->u.Interrupt.Level, | ||
ResDesc2->u.Interrupt.Vector, ResDesc2->u.Interrupt.Level); | ||
} | ||
|
||
if (ResDesc->u.Interrupt.Vector == ResDesc2->u.Interrupt.Vector) | ||
{ | ||
if (!Silent) | ||
|
@@ -767,7 +793,7 @@ IopUpdateResourceMap(IN PDEVICE_NODE DeviceNode, PWCHAR Level1Key, PWCHAR Level2 | |
HANDLE PnpMgrLevel1, PnpMgrLevel2, ResourceMapKey; | ||
UNICODE_STRING KeyName; | ||
OBJECT_ATTRIBUTES ObjectAttributes; | ||
|
||
//__debugbreak(); | ||
RtlInitUnicodeString(&KeyName, | ||
L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP"); | ||
InitializeObjectAttributes(&ObjectAttributes, | ||
|
@@ -1097,6 +1123,7 @@ IopAssignDeviceResources( | |
Status = IopDetectResourceConflict(DeviceNode->ResourceList, FALSE, NULL); | ||
if (!NT_SUCCESS(Status)) | ||
{ | ||
//__debugbreak(); | ||
DPRINT1("Boot resources for %wZ cause a resource conflict!\n", &DeviceNode->InstancePath); | ||
ExFreePool(DeviceNode->ResourceList); | ||
DeviceNode->ResourceList = NULL; | ||
|
@@ -1173,12 +1200,17 @@ IopCheckForResourceConflict( | |
IN BOOLEAN Silent, | ||
OUT OPTIONAL PCM_PARTIAL_RESOURCE_DESCRIPTOR ConflictingDescriptor) | ||
{ | ||
ULONG i, ii; | ||
ULONG i, ii, DescriptorSize; | ||
BOOLEAN Result = FALSE; | ||
PCM_FULL_RESOURCE_DESCRIPTOR FullDesc; | ||
|
||
FullDesc = &ResourceList1->List[0]; | ||
for (i = 0; i < ResourceList1->Count; i++) | ||
{ | ||
PCM_PARTIAL_RESOURCE_LIST ResList = &ResourceList1->List[i].PartialResourceList; | ||
PCM_PARTIAL_RESOURCE_LIST ResList = &FullDesc->PartialResourceList; | ||
DescriptorSize = IopGetDescriptorSize(FullDesc); | ||
FullDesc = (PCM_FULL_RESOURCE_DESCRIPTOR)((PUCHAR)FullDesc + DescriptorSize); | ||
|
||
for (ii = 0; ii < ResList->Count; ii++) | ||
{ | ||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResDesc = &ResList->PartialDescriptors[ii]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRIMARY_VECTOR_BASE is the processor's view of the IRQ vector (int 0x30), whereas an IO_RESOURCE_REQUIREMENTS list always refers to raw resources (IRQ 0). So this translation doesn't belong here. Since ROS doesn't have translators & arbiters, I'm not exactly sure where it does belong though :\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any plans to implement resource translators/arbiters in the near future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to my knowledge. Regardless, 'here' is not the answer to where it belongs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a hack that I applied, which ensures that at least HAL is loaded properly and doesn't have any resource conflicts. I have doubts that what you claim about untranslated resources is true, since you can see in the registry on Windows that e.g. "HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\Hardware Abstraction Layer\ACPI x64 platform.Raw" contains all vectors starting from 0 and ".Translated" contains the same vectors.