1 /**************************************************************************/ /*!
3 @Title Physmem (PMR) abstraction
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Part of the memory management. This module is responsible for
6 the "PMR" abstraction. A PMR (Physical Memory Resource)
7 represents some unit of physical memory which is
8 allocated/freed/mapped/unmapped as an indivisible unit
9 (higher software levels provide an abstraction above that
10 to deal with dividing this down into smaller manageable units).
11 Importantly, this module knows nothing of virtual memory, or
12 of MMUs etc., with one excuseable exception. We have the
13 concept of a "page size", which really means nothing in
14 physical memory, but represents a "contiguity quantum" such
15 that the higher level modules which map this memory are able
16 to verify that it matches the needs of the page size for the
17 virtual realm into which it is being mapped.
18 @License Dual MIT/GPLv2
20 The contents of this file are subject to the MIT license as set out below.
22 Permission is hereby granted, free of charge, to any person obtaining a copy
23 of this software and associated documentation files (the "Software"), to deal
24 in the Software without restriction, including without limitation the rights
25 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26 copies of the Software, and to permit persons to whom the Software is
27 furnished to do so, subject to the following conditions:
29 The above copyright notice and this permission notice shall be included in
30 all copies or substantial portions of the Software.
32 Alternatively, the contents of this file may be used under the terms of
33 the GNU General Public License Version 2 ("GPL") in which case the provisions
34 of GPL are applicable instead of those above.
36 If you wish to allow use of your version of this file only under the terms of
37 GPL, and not to allow others to use your version of this file under the terms
38 of the MIT license, indicate your decision by deleting the provisions above
39 and replace them with the notice and other provisions required by GPL as set
40 out in the file called "GPL-COPYING" included in this distribution. If you do
41 not delete the provisions above, a recipient may use your version of this file
42 under the terms of either the MIT license or GPL.
44 This License is also included in this distribution in the file called
47 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
48 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
49 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
50 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
51 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
52 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
53 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 */ /***************************************************************************/
56 #ifndef _SRVSRV_PMR_H_
57 #define _SRVSRV_PMR_H_
60 #include "img_types.h"
61 #include "pdumpdefs.h"
62 #include "pvrsrv_error.h"
63 #include "pvrsrv_memallocflags.h"
64 #include "devicemem_typedefs.h" /* Required for export DEVMEM_EXPORTCOOKIE */
66 /* services/include */
69 /* services/server/include/ */
72 /* A typical symbolic address for physical memory may look like:
73 :MEMORYSPACE:SUBSYS_NNNNNN_0X1234567890_XYZ. That example is quite
74 extreme, they are likely shorter than that. We'll make the define
75 here plentiful, however, note that this is _advisory_ not
76 _mandatory_ - in other words, it's the allocator's responsibility
77 to choose the amount of memory to set aside, and it's up to us to
78 honour the size passed in by the caller. i.e. this define is for
81 #define PMR_MAX_SYMBOLIC_ADDRESS_LENGTH_DEFAULT (60)
82 #define PMR_MAX_MEMSPACE_NAME_LENGTH_DEFAULT (20)
83 #define PMR_MAX_MEMSPNAME_SYMB_ADDR_LENGTH_DEFAULT (PMR_MAX_SYMBOLIC_ADDRESS_LENGTH_DEFAULT + PMR_MAX_MEMSPACE_NAME_LENGTH_DEFAULT)
84 #define PMR_MAX_PARAMSTREAM_FILENAME_LENGTH_DEFAULT (100)
85 #define PMR_MAX_TRANSLATION_STACK_ALLOC (32)
87 typedef IMG_UINT64 PMR_BASE_T;
88 typedef IMG_UINT64 PMR_SIZE_T;
89 #define PMR_SIZE_FMTSPEC "0x%010llX"
90 #define PMR_VALUE32_FMTSPEC "0x%08X"
91 #define PMR_VALUE64_FMTSPEC "0x%016llX"
92 typedef IMG_UINT32 PMR_LOG2ALIGN_T;
93 typedef IMG_UINT64 PMR_PASSWORD_T;
95 typedef struct _PMR_ PMR;
96 typedef struct _PMR_EXPORT_ PMR_EXPORT;
98 typedef struct _PMR_PAGELIST_ PMR_PAGELIST;
100 struct _PVRSRV_DEVICE_NODE_;
105 * Not to be called directly, only via implementations of PMR
106 * factories, e.g. in physmem_osmem.c, deviceclass.c, etc.
108 * Creates a PMR object, with callbacks and private data as per the
109 * FuncTab/PrivData args.
111 * Note that at creation time the PMR must set in stone the "logical
112 * size" and the "contiguity guarantee"
114 * Flags are also set at this time. (T.B.D. flags also immutable for
115 * the life of the PMR?)
117 * Logical size is the amount of Virtual space this allocation would
118 * take up when mapped. Note that this does not have to be the same
119 * as the actual physical size of the memory. For example, consider
120 * the sparsely allocated non-power-of-2 texture case. In this
121 * instance, the "logical size" would be the virtual size of the
122 * rounded-up power-of-2 texture. That some pages of physical memory
123 * may not exist does not affect the logical size calculation.
125 * The PMR must also supply the "contiguity guarantee" which is the
126 * finest granularity of alignment and size of physical pages that the
127 * PMR will provide after LockSysPhysAddresses is called. Note that
128 * the calling code may choose to call PMRSysPhysAddr with a finer
129 * granularity than this, for example if it were to map into a device
130 * MMU with a smaller page size, and it's also OK for the PMR to
131 * supply physical memory in larger chunks than this. But
132 * importantly, never the other way around.
134 * More precisely, the following inequality must be maintained
135 * whenever mappings and/or physical addresses exist:
137 * (device MMU page size) <= 2**(uiLog2ContiguityGuarantee) <= (actual contiguity of physical memory)
140 * Note also that the implementation may supply pszPDumpFlavour and
141 * pszPDumpDefaultMemspaceName, which are irrelevant where the PMR
142 * implementation overrides the default symbolic name construction
143 * routine. Where the function pointer for PDump symbolic name
144 * derivation is not overridden (i.e. IMG_NULL appears in the relevant
145 * entry of the functab) and default implementation shall be used
146 * which will copy the PDumpDefaultMemspaceName into the namespace
147 * argument, and create the symbolic name by concatenating the
148 * "PDumpFlavour" and a numeric representation of the PMR's serial
151 * The implementation must guarantee that the storage for these two
152 * strings, and the function table, are maintained, as copies are not
153 * made, the pointer is simply stored.
155 * The function table will contain the following callbacks which may
156 * be overridden by the PMR implementation:
158 * pfnLockPhysAddresses
160 * Called when someone locks requests that Physical pages are to
161 * be locked down via the PMRLockSysPhysAddresses() API. Note
162 * that if physical pages are prefaulted at PMR creation time and
163 * therefore static, it would not be necessary to override this
164 * function, in which case IMG_NULL may be supplied.
166 * pfnUnlockPhysAddresses
168 * The reverse of pfnLockPhysAddresses. Note that this should be
169 * IMG_NULL if and only if pfnLockPhysAddresses is IMG_NULL
173 * This function is mandatory. This is the one which returns the
174 * system physical address for a given offset into this PMR. The
175 * "lock" function will have been called, if overridden, before
176 * this function, thus the implementation should not increase any
177 * refcount when answering this call. Refcounting, if necessary,
178 * should be done in the lock/unlock calls. Refcounting would
179 * not be necessary in the prefaulted/static scenario, as the
180 * pmr.c abstraction will handle the refcounting for the whole
183 * pfnPDumpSymbolicAddr
185 * Derives the PDump symbolic address for the given offset. The
186 * default implementation will copy the PDumpDefaultMemspaceName
187 * into the namespace argument (or use SYSMEM if none was
188 * supplied), and create the symbolic name by concatenating the
189 * "PDumpFlavour" and a numeric representation of the PMR's
194 * Called when the PMR's refcount reaches zero and it gets
195 * destroyed. This allows the implementation to free up any
196 * resource acquired during creation time.
200 PMRCreatePMR(PHYS_HEAP *psPhysHeap,
201 PMR_SIZE_T uiLogicalSize,
202 PMR_SIZE_T uiChunkSize,
203 IMG_UINT32 ui32NumPhysChunks,
204 IMG_UINT32 ui32NumVirtChunks,
205 IMG_BOOL *pabMappingTable,
206 PMR_LOG2ALIGN_T uiLog2ContiguityGuarantee,
208 const IMG_CHAR *pszPDumpFlavour,
209 const PMR_IMPL_FUNCTAB *psFuncTab,
210 PMR_IMPL_PRIVDATA pvPrivData,
212 IMG_HANDLE *phPDumpAllocInfo,
213 IMG_BOOL bForcePersistent);
216 * PMRLockSysPhysAddresses()
218 * Calls the relevant callback to lock down the system physical addresses of the memory that makes up the whole PMR.
220 * Before this call, it is not valid to use any of the information
221 * getting APIs: PMR_Flags(), PMR_SysPhysAddr(),
222 * PMR_PDumpSymbolicAddr() [ see note below about lock/unlock
225 * The caller of this function does not have to care about how the PMR
226 * is implemented. He only has to know that he is allowed access to
227 * the physical addresses _after_ calling this function and _until_
228 * calling PMRUnlockSysPhysAddresses().
231 * Notes to callback implementers (authors of PMR Factories):
233 * Some PMR implementations will be such that the physical memory
234 * exists for the lifetime of the PMR, with a static address, (and
235 * normally flags and symbolic address are static too) and so it is
236 * legal for a PMR implementation to not provide an implementation for
239 * Some PMR implementation may wish to page memory in from secondary
240 * storage on demand. The lock/unlock callbacks _may_ be the place to
241 * do this. (more likely, there would be a separate API for doing
242 * this, but this API provides a useful place to assert that it has
247 PMRLockSysPhysAddresses(PMR *psPMR,
248 IMG_UINT32 uiLog2DevPageSize);
251 PMRLockSysPhysAddressesNested(PMR *psPMR,
252 IMG_UINT32 uiLog2DevPageSize,
253 IMG_UINT32 ui32NestingLevel);
256 * PMRUnlockSysPhysAddresses()
258 * the reverse of PMRLockSysPhysAddresses()
261 PMRUnlockSysPhysAddresses(PMR *psPMR);
263 IMG_VOID PMRLock(void);
264 IMG_VOID PMRUnlock(void);
265 IMG_BOOL PMRIsLocked(void);
266 IMG_BOOL PMRIsLockedByMe(void);
271 * Given a PMR, creates a PMR "Export", which is a handle that
272 * provides sufficient data to be able to "import" this PMR elsewhere.
273 * The PMR Export is an object in its own right, whose existance
274 * implies a reference on the PMR, thus the PMR cannot be destroyed
275 * while the PMR Export exists. The intention is that the PMR Export
276 * will be wrapped in the devicemem layer by a cross process handle,
277 * and some IPC by which to communicate the handle value and password
278 * to other processes. The receiving process is able to unwrap this
279 * to gain access to the same PMR Export in this layer, and, via
280 * PhysmemPMRImport(), obtain a reference to the original PMR.
282 * The caller receives, along with the PMR Export object, information
283 * about the size and contiguity guarantee for the PMR, and also the
284 * PMRs secret password, in order to authenticate the subsequent
287 * N.B. If you call PMRExportPMR() (and it succeeds), you are
288 * promising to later call PMRUnexportPMR()
291 PMRExportPMR(PMR *psPMR,
292 PMR_EXPORT **ppsPMRExport,
294 PMR_LOG2ALIGN_T *puiLog2Contig,
295 PMR_PASSWORD_T *puiPassword);
298 * PMRMakeServerExportClientExport()
300 * This is a "special case" function for making a server export cookie
301 * which went through the direct bridge into an export cookie that can
302 * be passed through the client bridge.
305 PMRMakeServerExportClientExport(DEVMEM_EXPORTCOOKIE *psPMRExportIn,
306 PMR_EXPORT **ppsPMRExportPtr,
308 PMR_LOG2ALIGN_T *puiLog2Contig,
309 PMR_PASSWORD_T *puiPassword);
312 PMRUnmakeServerExportClientExport(PMR_EXPORT *psPMRExport);
317 * The reverse of PMRExportPMR(). This causes the PMR to no
318 * longer be exported. If the PMR has already been imported, the
319 * imported PMR reference will still be valid, but no further imports
323 PMRUnexportPMR(PMR_EXPORT *psPMRExport);
328 * Takes a PMR Export object, as obtained by PMRExportPMR(), and
329 * obtains a reference to the original PMR.
331 * The password must match, and is assumed to have been (by whatever
332 * means, IPC etc.) preserved intact from the former call to
335 * The size and contiguity arguments are entirely irrelevant for the
336 * import, however they are verified in order to trap bugs.
338 * N.B. If you call PhysmemPMRImport() (and it succeeds), you are
339 * promising to later call PhysmemPMRUnimport()
342 PMRImportPMR(PMR_EXPORT *psPMRExport,
343 PMR_PASSWORD_T uiPassword,
345 PMR_LOG2ALIGN_T uiLog2Contig,
351 * releases the reference on the PMR as obtained by PMRImportPMR()
354 PMRUnimportPMR(PMR *psPMR);
357 PMRLocalImportPMR(PMR *psPMR,
359 IMG_DEVMEM_SIZE_T *puiSize,
360 IMG_DEVMEM_ALIGN_T *puiAlign);
363 * Equivalent mapping functions when in kernel mode - TOOD: should
364 * unify this and the PMRAcquireMMapArgs API with a suitable
368 PMRAcquireKernelMappingData(PMR *psPMR,
369 IMG_SIZE_T uiLogicalOffset,
371 IMG_VOID **ppvKernelAddressOut,
372 IMG_SIZE_T *puiLengthOut,
373 IMG_HANDLE *phPrivOut);
376 PMRAcquireSparseKernelMappingData(PMR *psPMR,
377 IMG_SIZE_T uiLogicalOffset,
379 IMG_VOID **ppvKernelAddressOut,
380 IMG_SIZE_T *puiLengthOut,
381 IMG_HANDLE *phPrivOut);
384 PMRReleaseKernelMappingData(PMR *psPMR,
391 * calls into the PMR implementation to read up to uiBufSz bytes,
392 * returning the actual number read in *puiNumBytes
394 * this will read up to the end of the PMR, or the next symbolic name
395 * boundary, or until the requested number of bytes is read, whichever
398 * In the case of sparse PMR's the caller doesn't know what offsets are
399 * valid and which ones aren't so we will just write 0 to invalid offsets
402 PMR_ReadBytes(PMR *psPMR,
403 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
406 IMG_SIZE_T *puiNumBytes);
411 * calls into the PMR implementation to write up to uiBufSz bytes,
412 * returning the actual number read in *puiNumBytes
414 * this will write up to the end of the PMR, or the next symbolic name
415 * boundary, or until the requested number of bytes is written, whichever
418 * In the case of sparse PMR's the caller doesn't know what offsets are
419 * valid and which ones aren't so we will just ignore data at invalid offsets
422 PMR_WriteBytes(PMR *psPMR,
423 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
426 IMG_SIZE_T *puiNumBytes);
431 * Take a reference on the passed in PMR
434 PMRRefPMR(PMR *psPMR);
439 * This undoes a call to any of the PhysmemNew* family of APIs
440 * (i.e. any PMR factory "constructor")
442 * This relinquishes a reference to the PMR, and, where the refcount
443 * reaches 0, causes the PMR to be destroyed (calling the finalizer
444 * callback on the PMR, if there is one)
447 PMRUnrefPMR(PMR *psPMR);
453 * Flags are static and guaranteed for the life of the PMR. Thus this
454 * function is idempotent and acquire/release semantics is not
457 * Returns the flags as specified on the PMR. The flags are to be
458 * interpreted as mapping permissions
461 PMR_Flags(const PMR *psPMR,
462 PMR_FLAGS_T *puiMappingFlags);
466 PMR_LogicalSize(const PMR *psPMR,
467 IMG_DEVMEM_SIZE_T *puiLogicalSize);
472 * A note regarding Lock/Unlock semantics
473 * ======================================
475 * PMR_SysPhysAddr may only be called after PMRLockSysPhysAddresses()
476 * has been called. The data returned may be used only until
477 * PMRUnlockSysPhysAddresses() is called after which time the licence
478 * to use the data is revoked and the information may be invalid.
480 * Given an offset, this function returns the device physical address of the
481 * corresponding page in the PMR. It may be called multiple times
482 * until the address of all relevant pages has been determined.
484 * If caller only wants one physical address it is sufficient to pass in:
485 * ui32Log2PageSize==0 and ui32NumOfPages==1
488 PMR_DevPhysAddr(const PMR *psPMR,
489 IMG_UINT32 ui32Log2PageSize,
490 IMG_UINT32 ui32NumOfPages,
491 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
492 IMG_DEV_PHYADDR *psDevAddr,
498 * See note above about Lock/Unlock semantics.
500 * Given an offset, this function returns the CPU physical address of the
501 * corresponding page in the PMR. It may be called multiple times
502 * until the address of all relevant pages has been determined.
506 PMR_CpuPhysAddr(const PMR *psPMR,
507 IMG_UINT32 ui32Log2PageSize,
508 IMG_UINT32 ui32NumOfPages,
509 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
510 IMG_CPU_PHYADDR *psCpuAddrPtr,
514 PMRGetUID(PMR *psPMR,
515 IMG_UINT64 *pui64UID);
519 * PMR_PDumpSymbolicAddr()
521 * Given an offset, returns the pdump memspace name and symbolic
522 * address of the corresponding page in the PMR.
524 * Note that PDump memspace names and symbolic addresses are static
525 * and valid for the lifetime of the PMR, therefore we don't require
526 * acquire/release semantics here.
528 * Note that it is expected that the pdump "mapping" code will call
529 * this function multiple times as each page is mapped in turn
531 * Note that NextSymName is the offset from the base of the PMR to the
532 * next pdump symbolic address (or the end of the PMR if the PMR only
533 * had one PDUMPMALLOC
536 PMR_PDumpSymbolicAddr(const PMR *psPMR,
537 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
538 IMG_UINT32 ui32NamespaceNameLen,
539 IMG_CHAR *pszNamespaceName,
540 IMG_UINT32 ui32SymbolicAddrLen,
541 IMG_CHAR *pszSymbolicAddr,
542 IMG_DEVMEM_OFFSET_T *puiNewOffset,
543 IMG_DEVMEM_OFFSET_T *puiNextSymName
547 * PMRPDumpLoadMemValue32()
549 * writes the current contents of a dword in PMR memory to the pdump
550 * script stream. Useful for patching a buffer by simply editing the
551 * script output file in ASCII plain text.
555 PMRPDumpLoadMemValue32(PMR *psPMR,
556 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
557 IMG_UINT32 ui32Value,
558 PDUMP_FLAGS_T uiPDumpFlags);
561 * PMRPDumpLoadMemValue64()
563 * writes the current contents of a dword in PMR memory to the pdump
564 * script stream. Useful for patching a buffer by simply editing the
565 * script output file in ASCII plain text.
569 PMRPDumpLoadMemValue64(PMR *psPMR,
570 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
571 IMG_UINT64 ui64Value,
572 PDUMP_FLAGS_T uiPDumpFlags);
577 * writes the current contents of the PMR memory to the pdump PRM
578 * stream, and emits some PDump code to the script stream to LDB said
579 * bytes from said file. If bZero is IMG_TRUE then the PDump zero page
580 * is used as the source for the LDB.
584 PMRPDumpLoadMem(PMR *psPMR,
585 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
586 IMG_DEVMEM_SIZE_T uiSize,
587 PDUMP_FLAGS_T uiPDumpFlags,
591 * PMRPDumpSaveToFile()
593 * emits some PDump that does an SAB (save bytes) using the PDump
594 * symbolic address of the PMR. Note that this is generally not the
595 * preferred way to dump the buffer contents. There is an equivalent
596 * function in devicemem_server.h which also emits SAB but using the
597 * virtual address, which is the "right" way to dump the buffer
598 * contents to a file. This function exists just to aid testing by
599 * providing a means to dump the PMR directly by symbolic address
603 PMRPDumpSaveToFile(const PMR *psPMR,
604 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
605 IMG_DEVMEM_SIZE_T uiSize,
606 IMG_UINT32 uiArraySize,
607 const IMG_CHAR *pszFilename);
611 #ifdef INLINE_IS_PRAGMA
612 #pragma inline(PMR_PDumpSymbolicAddr)
614 static INLINE PVRSRV_ERROR
615 PMR_PDumpSymbolicAddr(const PMR *psPMR,
616 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
617 IMG_UINT32 ui32NamespaceNameLen,
618 IMG_CHAR *pszNamespaceName,
619 IMG_UINT32 ui32SymbolicAddrLen,
620 IMG_CHAR *pszSymbolicAddr,
621 IMG_DEVMEM_OFFSET_T *puiNewOffset,
622 IMG_DEVMEM_OFFSET_T *puiNextSymName)
624 PVR_UNREFERENCED_PARAMETER(psPMR);
625 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
626 PVR_UNREFERENCED_PARAMETER(ui32NamespaceNameLen);
627 PVR_UNREFERENCED_PARAMETER(pszNamespaceName);
628 PVR_UNREFERENCED_PARAMETER(ui32SymbolicAddrLen);
629 PVR_UNREFERENCED_PARAMETER(pszSymbolicAddr);
630 PVR_UNREFERENCED_PARAMETER(puiNewOffset);
631 PVR_UNREFERENCED_PARAMETER(puiNextSymName);
635 #ifdef INLINE_IS_PRAGMA
636 #pragma inline(PMRPDumpLoadMemValue)
638 static INLINE PVRSRV_ERROR
639 PMRPDumpLoadMemValue32(PMR *psPMR,
640 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
641 IMG_UINT32 ui32Value,
642 PDUMP_FLAGS_T uiPDumpFlags)
644 PVR_UNREFERENCED_PARAMETER(psPMR);
645 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
646 PVR_UNREFERENCED_PARAMETER(ui32Value);
647 PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
651 #ifdef INLINE_IS_PRAGMA
652 #pragma inline(PMRPDumpLoadMemValue)
654 static INLINE PVRSRV_ERROR
655 PMRPDumpLoadMemValue64(PMR *psPMR,
656 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
657 IMG_UINT64 ui64Value,
658 PDUMP_FLAGS_T uiPDumpFlags)
660 PVR_UNREFERENCED_PARAMETER(psPMR);
661 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
662 PVR_UNREFERENCED_PARAMETER(ui64Value);
663 PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
667 #ifdef INLINE_IS_PRAGMA
668 #pragma inline(PMRPDumpLoadMem)
670 static INLINE PVRSRV_ERROR
671 PMRPDumpLoadMem(PMR *psPMR,
672 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
673 IMG_DEVMEM_SIZE_T uiSize,
674 PDUMP_FLAGS_T uiPDumpFlags,
677 PVR_UNREFERENCED_PARAMETER(psPMR);
678 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
679 PVR_UNREFERENCED_PARAMETER(uiSize);
680 PVR_UNREFERENCED_PARAMETER(uiPDumpFlags);
681 PVR_UNREFERENCED_PARAMETER(bZero);
686 #ifdef INLINE_IS_PRAGMA
687 #pragma inline(PMRPDumpSaveToFile)
689 static INLINE PVRSRV_ERROR
690 PMRPDumpSaveToFile(const PMR *psPMR,
691 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
692 IMG_DEVMEM_SIZE_T uiSize,
693 IMG_UINT32 uiArraySize,
694 const IMG_CHAR *pszFilename)
696 PVR_UNREFERENCED_PARAMETER(psPMR);
697 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
698 PVR_UNREFERENCED_PARAMETER(uiSize);
699 PVR_UNREFERENCED_PARAMETER(uiArraySize);
700 PVR_UNREFERENCED_PARAMETER(pszFilename);
706 /* This function returns the private data that a pmr subtype
707 squirrelled in here. We use the function table pointer as
708 "authorization" that this function is being called by the pmr
709 subtype implementation. We can assume (assert) that. It would be
710 a bug in the implementation of the pmr subtype if this assertion
713 PMRGetPrivateDataHack(const PMR *psPMR,
714 const PMR_IMPL_FUNCTAB *psFuncTab);
717 PMRZeroingPMR(PMR *psPMR,
718 IMG_DEVMEM_LOG2ALIGN_T uiLog2PageSize);
721 PMRDumpPageList(PMR *psReferencePMR,
722 IMG_DEVMEM_LOG2ALIGN_T uiLog2PageSize);
725 PMRWritePMPageList(/* Target PMR, offset, and length */
727 IMG_DEVMEM_OFFSET_T uiTableOffset,
728 IMG_DEVMEM_SIZE_T uiTableLength,
729 /* Referenced PMR, and "page" granularity */
731 IMG_DEVMEM_LOG2ALIGN_T uiLog2PageSize,
732 PMR_PAGELIST **ppsPageList,
733 IMG_UINT64 *pui64CheckSum);
735 /* Doesn't actually erase the page list - just releases the appropriate refcounts */
736 extern PVRSRV_ERROR // should be IMG_VOID, surely
737 PMRUnwritePMPageList(PMR_PAGELIST *psPageList);
741 PMRPDumpPol32(const PMR *psPMR,
742 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
743 IMG_UINT32 ui32Value,
745 PDUMP_POLL_OPERATOR eOperator,
746 PDUMP_FLAGS_T uiFlags);
749 PMRPDumpCBP(const PMR *psPMR,
750 IMG_DEVMEM_OFFSET_T uiReadOffset,
751 IMG_DEVMEM_OFFSET_T uiWriteOffset,
752 IMG_DEVMEM_SIZE_T uiPacketSize,
753 IMG_DEVMEM_SIZE_T uiBufferSize);
756 #ifdef INLINE_IS_PRAGMA
757 #pragma inline(PMRPDumpPol32)
759 static INLINE PVRSRV_ERROR
760 PMRPDumpPol32(const PMR *psPMR,
761 IMG_DEVMEM_OFFSET_T uiLogicalOffset,
762 IMG_UINT32 ui32Value,
764 PDUMP_POLL_OPERATOR eOperator,
765 PDUMP_FLAGS_T uiFlags)
767 PVR_UNREFERENCED_PARAMETER(psPMR);
768 PVR_UNREFERENCED_PARAMETER(uiLogicalOffset);
769 PVR_UNREFERENCED_PARAMETER(ui32Value);
770 PVR_UNREFERENCED_PARAMETER(ui32Mask);
771 PVR_UNREFERENCED_PARAMETER(eOperator);
772 PVR_UNREFERENCED_PARAMETER(uiFlags);
776 #ifdef INLINE_IS_PRAGMA
777 #pragma inline(PMRPDumpCBP)
779 static INLINE PVRSRV_ERROR
780 PMRPDumpCBP(const PMR *psPMR,
781 IMG_DEVMEM_OFFSET_T uiReadOffset,
782 IMG_DEVMEM_OFFSET_T uiWriteOffset,
783 IMG_DEVMEM_SIZE_T uiPacketSize,
784 IMG_DEVMEM_SIZE_T uiBufferSize)
786 PVR_UNREFERENCED_PARAMETER(psPMR);
787 PVR_UNREFERENCED_PARAMETER(uiReadOffset);
788 PVR_UNREFERENCED_PARAMETER(uiWriteOffset);
789 PVR_UNREFERENCED_PARAMETER(uiPacketSize);
790 PVR_UNREFERENCED_PARAMETER(uiBufferSize);
797 * To be called once and only once to initialise the internal data in
798 * the PMR module (mutexes and such)
800 * Not for general use. Only PVRSRVInit(); should be calling this.
808 * To be called once and only once to deinitialise the internal data in
809 * the PMR module (mutexes and such) and for debug checks
811 * Not for general use. Only PVRSRVDeInit(); should be calling this.
816 #if defined(PVR_RI_DEBUG)
818 PMRStoreRIHandle(PMR *psPMR,
819 IMG_PVOID hRIHandle);
822 #endif /* #ifdef _SRVSRV_PMR_H_ */