00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
#include "ki.h"
00027 ULONG
ChangeColor;
00028
00029
00030
00031
00032
00033
VOID
00034
KiChangeColorPageTarget (
00035 IN PULONG SignalDone,
00036 IN PVOID NewColor,
00037 IN PVOID OldColor,
00038 IN PVOID PageFrame
00039 );
00040
00041
VOID
00042
KiSweepDcacheTarget (
00043 IN PULONG SignalDone,
00044 IN PVOID Parameter1,
00045 IN PVOID Parameter2,
00046 IN PVOID Parameter3
00047 );
00048
00049
VOID
00050
KiSweepIcacheTarget (
00051 IN PULONG SignalDone,
00052 IN PVOID Parameter1,
00053 IN PVOID Parameter2,
00054 IN PVOID Parameter3
00055 );
00056
00057
VOID
00058
KiSweepIcacheRangeTarget (
00059 IN PULONG SignalDone,
00060 IN PVOID BaseAddress,
00061 IN PVOID Length,
00062 IN PVOID Parameter3
00063 );
00064
00065
VOID
00066
KiFlushIoBuffersTarget (
00067 IN PULONG SignalDone,
00068 IN PVOID Mdl,
00069 IN PVOID ReadOperation,
00070 IN PVOID DmaOperation
00071 );
00072
00073
VOID
00074 KeChangeColorPage (
00075 IN PVOID NewColor,
00076 IN PVOID OldColor,
00077 IN ULONG PageFrame
00078 )
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 {
00103
00104 KIRQL OldIrql;
00105 KAFFINITY TargetProcessors;
00106
00107
ASSERT(KeGetCurrentIrql() <= KiSynchIrql);
00108
00109
ChangeColor += 1;
00110
00111
00112
00113
00114
00115
#if !defined(NT_UP)
00116
00117 OldIrql = KeRaiseIrqlToSynchLevel();
00118
00119
00120
00121
00122
00123
00124 TargetProcessors =
KeActiveProcessors & PCR->NotMember;
00125
if (TargetProcessors != 0) {
00126
KiIpiSendPacket(TargetProcessors,
00127
KiChangeColorPageTarget,
00128 (PVOID)NewColor,
00129 (PVOID)OldColor,
00130 (PVOID)PageFrame);
00131 }
00132
00133
#endif
00134
00135
00136
00137
00138
00139 HalChangeColorPage(NewColor, OldColor, PageFrame);
00140
00141
00142
00143
00144
00145
00146
#if !defined(NT_UP)
00147
00148
if (TargetProcessors != 0) {
00149
KiIpiStallOnPacketTargets();
00150 }
00151
00152
00153
00154
00155
00156
KeLowerIrql(OldIrql);
00157
00158
#endif
00159
00160
return;
00161 }
00162
00163
VOID
00164 KiChangeColorPageTarget (
00165 IN PULONG SignalDone,
00166 IN PVOID NewColor,
00167 IN PVOID OldColor,
00168 IN PVOID PageFrame
00169 )
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 {
00197
00198
00199
00200
00201
00202
00203
00204
#if !defined(NT_UP)
00205
00206 HalChangeColorPage(NewColor, OldColor, (ULONG)PageFrame);
00207
KiIpiSignalPacketDone(SignalDone);
00208
00209
#endif
00210
00211
return;
00212 }
00213
00214
VOID
00215 KeSweepDcache (
00216 IN BOOLEAN AllProcessors
00217 )
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 {
00239
00240 KIRQL OldIrql;
00241 KAFFINITY TargetProcessors;
00242
00243
ASSERT(KeGetCurrentIrql() <= KiSynchIrql);
00244
00245
00246
00247
00248
00249
#if !defined(NT_UP)
00250
00251 OldIrql = KeRaiseIrqlToSynchLevel();
00252
00253
00254
00255
00256
00257
00258 TargetProcessors =
KeActiveProcessors & PCR->NotMember;
00259
if (TargetProcessors != 0) {
00260
KiIpiSendPacket(TargetProcessors,
00261
KiSweepDcacheTarget,
00262
NULL,
00263
NULL,
00264
NULL);
00265 }
00266
00267
#endif
00268
00269
00270
00271
00272
00273 HalSweepDcache();
00274
00275
00276
00277
00278
00279
00280
#if !defined(NT_UP)
00281
00282
if (TargetProcessors != 0) {
00283
KiIpiStallOnPacketTargets();
00284 }
00285
00286
00287
00288
00289
00290
KeLowerIrql(OldIrql);
00291
00292
#endif
00293
00294
return;
00295 }
00296
00297
VOID
00298
KiSweepDcacheTarget (
00299 IN PULONG SignalDone,
00300 IN PVOID Parameter1,
00301 IN PVOID Parameter2,
00302 IN PVOID Parameter3
00303 )
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 {
00326
00327
00328
00329
00330
00331
00332
#if !defined(NT_UP)
00333
00334 HalSweepDcache();
00335
KiIpiSignalPacketDone(SignalDone);
00336
00337
#endif
00338
00339
return;
00340 }
00341
00342
VOID
00343 KeSweepIcache (
00344 IN BOOLEAN AllProcessors
00345 )
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366 {
00367
00368 KIRQL OldIrql;
00369 KAFFINITY TargetProcessors;
00370
00371
ASSERT(KeGetCurrentIrql() <= KiSynchIrql);
00372
00373
00374
00375
00376
00377
#if !defined(NT_UP)
00378
00379 OldIrql = KeRaiseIrqlToSynchLevel();
00380
00381
00382
00383
00384
00385
00386 TargetProcessors =
KeActiveProcessors & PCR->NotMember;
00387
if (TargetProcessors != 0) {
00388
KiIpiSendPacket(TargetProcessors,
00389
KiSweepIcacheTarget,
00390
NULL,
00391
NULL,
00392
NULL);
00393 }
00394
00395
#endif
00396
00397
00398
00399
00400
00401 HalSweepIcache();
00402 HalSweepDcache();
00403
00404
00405
00406
00407
00408
00409
#if !defined(NT_UP)
00410
00411
if (TargetProcessors != 0) {
00412
KiIpiStallOnPacketTargets();
00413 }
00414
00415
00416
00417
00418
00419
KeLowerIrql(OldIrql);
00420
00421
#endif
00422
00423
return;
00424 }
00425
00426
VOID
00427
KiSweepIcacheTarget (
00428 IN PULONG SignalDone,
00429 IN PVOID Parameter1,
00430 IN PVOID Parameter2,
00431 IN PVOID Parameter3
00432 )
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454 {
00455
00456
00457
00458
00459
00460
00461
00462
#if !defined(NT_UP)
00463
00464 HalSweepIcache();
00465 HalSweepDcache();
00466
KiIpiSignalPacketDone(SignalDone);
00467
00468
#endif
00469
00470
return;
00471 }
00472
00473
VOID
00474 KeSweepIcacheRange (
00475 IN BOOLEAN AllProcessors,
00476 IN PVOID BaseAddress,
00477 IN ULONG Length
00478 )
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506 {
00507
00508 ULONG
Offset;
00509 KIRQL OldIrql;
00510 KAFFINITY TargetProcessors;
00511
00512
ASSERT(KeGetCurrentIrql() <= KiSynchIrql);
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
if (Length > PCR->FirstLevelIcacheSize) {
00524 BaseAddress = (PVOID)0;
00525 Length = PCR->FirstLevelIcacheSize;
00526 }
00527
00528
00529
00530
00531
00532
#if !defined(NT_UP)
00533
00534 OldIrql = KeRaiseIrqlToSynchLevel();
00535
00536
00537
00538
00539
00540
00541 TargetProcessors =
KeActiveProcessors & PCR->NotMember;
00542
if (TargetProcessors != 0) {
00543
KiIpiSendPacket(TargetProcessors,
00544
KiSweepIcacheRangeTarget,
00545 (PVOID)BaseAddress,
00546 (PVOID)Length,
00547
NULL);
00548 }
00549
00550
#endif
00551
00552
00553
00554
00555
00556
00557
Offset = (ULONG)BaseAddress & PCR->IcacheAlignment;
00558 HalSweepIcacheRange((PVOID)((ULONG)BaseAddress & ~PCR->IcacheAlignment),
00559 (
Offset + Length + PCR->IcacheAlignment) & ~PCR->IcacheAlignment);
00560
00561
Offset = (ULONG)BaseAddress & PCR->DcacheAlignment;
00562 HalSweepDcacheRange((PVOID)((ULONG)BaseAddress & ~PCR->DcacheAlignment),
00563 (
Offset + Length + PCR->DcacheAlignment) & ~PCR->DcacheAlignment);
00564
00565
00566
00567
00568
00569
00570
#if !defined(NT_UP)
00571
00572
if (TargetProcessors != 0) {
00573
KiIpiStallOnPacketTargets();
00574 }
00575
00576
00577
00578
00579
00580
KeLowerIrql(OldIrql);
00581
00582
#endif
00583
00584
return;
00585 }
00586
00587
VOID
00588 KiSweepIcacheRangeTarget (
00589 IN PULONG SignalDone,
00590 IN PVOID BaseAddress,
00591 IN PVOID Length,
00592 IN PVOID Parameter3
00593 )
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621 {
00622
00623 ULONG
Offset;
00624
00625
00626
00627
00628
00629
#if !defined(NT_UP)
00630
00631
Offset = (ULONG)(BaseAddress) & PCR->IcacheAlignment;
00632 HalSweepIcacheRange((PVOID)((ULONG)(BaseAddress) & ~PCR->IcacheAlignment),
00633 (
Offset + (ULONG)Length + PCR->IcacheAlignment) & ~PCR->IcacheAlignment);
00634
00635
Offset = (ULONG)(BaseAddress) & PCR->DcacheAlignment;
00636 HalSweepDcacheRange((PVOID)((ULONG)(BaseAddress) & ~PCR->DcacheAlignment),
00637 (
Offset + (ULONG)Length + PCR->DcacheAlignment) & ~PCR->DcacheAlignment);
00638
00639
KiIpiSignalPacketDone(SignalDone);
00640
00641
#endif
00642
00643
return;
00644 }
00645
00646
VOID
00647 KeFlushIoBuffers (
00648 IN
PMDL Mdl,
00649 IN BOOLEAN ReadOperation,
00650 IN BOOLEAN DmaOperation
00651 )
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677 {
00678
00679 KIRQL OldIrql;
00680 KAFFINITY TargetProcessors;
00681
00682
ASSERT(KeGetCurrentIrql() <= KiSynchIrql);
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
if (DmaOperation !=
FALSE) {
00693
if (ReadOperation !=
FALSE) {
00694
if ((
KiDmaIoCoherency &
DMA_READ_ICACHE_INVALIDATE) != 0) {
00695
00696
ASSERT((
KiDmaIoCoherency &
DMA_READ_DCACHE_INVALIDATE) != 0);
00697
00698
return;
00699
00700 }
else if (((Mdl->MdlFlags &
MDL_IO_PAGE_READ) == 0) &&
00701 ((
KiDmaIoCoherency &
DMA_READ_DCACHE_INVALIDATE) != 0)) {
00702
return;
00703 }
00704
00705 }
else if ((
KiDmaIoCoherency &
DMA_WRITE_DCACHE_SNOOP) != 0) {
00706
return;
00707 }
00708
00709 }
else if ((Mdl->MdlFlags &
MDL_IO_PAGE_READ) == 0) {
00710
return;
00711 }
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721 OldIrql = KeRaiseIrqlToSynchLevel();
00722
00723
00724
00725
00726
00727
00728
#if !defined(NT_UP)
00729
00730 TargetProcessors =
KeActiveProcessors & PCR->NotMember;
00731
if (TargetProcessors != 0) {
00732
KiIpiSendPacket(TargetProcessors,
00733
KiFlushIoBuffersTarget,
00734 (PVOID)Mdl,
00735 (PVOID)((ULONG)ReadOperation),
00736 (PVOID)((ULONG)DmaOperation));
00737 }
00738
00739
#endif
00740
00741
00742
00743
00744
00745 HalFlushIoBuffers(Mdl, ReadOperation, DmaOperation);
00746
00747
00748
00749
00750
00751
00752
#if !defined(NT_UP)
00753
00754
if (TargetProcessors != 0) {
00755
KiIpiStallOnPacketTargets();
00756 }
00757
00758
#endif
00759
00760
00761
00762
00763
00764
KeLowerIrql(OldIrql);
00765
return;
00766 }
00767
00768
VOID
00769 KiFlushIoBuffersTarget (
00770 IN PULONG SignalDone,
00771 IN PVOID Mdl,
00772 IN PVOID ReadOperation,
00773 IN PVOID DmaOperation
00774 )
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803 {
00804
00805
00806
00807
00808
00809
#if !defined(NT_UP)
00810
00811 HalFlushIoBuffers((
PMDL)Mdl,
00812 (BOOLEAN)((ULONG)ReadOperation),
00813 (BOOLEAN)((ULONG)DmaOperation));
00814
00815
KiIpiSignalPacketDone(SignalDone);
00816
00817
#endif
00818
00819
return;
00820 }