Lines Matching defs:p_ReplicGroup
55 static uint8_t GetMemberPosition(t_FmPcdFrmReplicGroup *p_ReplicGroup,
62 ASSERT_COND(p_ReplicGroup);
72 lastMemberIndex = p_ReplicGroup->numOfEntries;
74 lastMemberIndex = p_ReplicGroup->numOfEntries-1;
140 static t_FmPcdFrmReplicMember *GetAvailableMember(t_FmPcdFrmReplicGroup *p_ReplicGroup)
145 if (!LIST_IsEmpty(&p_ReplicGroup->availableMembersList))
147 p_Next = LIST_FIRST(&p_ReplicGroup->availableMembersList);
155 static void PutAvailableMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
158 LIST_AddToTail(&p_ReplicMember->node, &p_ReplicGroup->availableMembersList);
161 static void AddMemberToList(t_FmPcdFrmReplicGroup *p_ReplicGroup,
167 p_ReplicGroup->numOfEntries++;
170 static void RemoveMemberFromList(t_FmPcdFrmReplicGroup *p_ReplicGroup,
173 ASSERT_COND(p_ReplicGroup->numOfEntries);
175 p_ReplicGroup->numOfEntries--;
178 static void LinkSourceToMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
186 ASSERT_COND(p_ReplicGroup);
187 ASSERT_COND(p_ReplicGroup->h_FmPcd);
190 p_FmPcd = p_ReplicGroup->h_FmPcd;
197 static void LinkMemberToMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
210 p_FmPcd = p_ReplicGroup->h_FmPcd;
219 static t_Error ModifyDescriptor(t_FmPcdFrmReplicGroup *p_ReplicGroup,
227 ASSERT_COND(p_ReplicGroup);
228 ASSERT_COND(p_ReplicGroup->h_FmPcd);
232 p_FmPcd = p_ReplicGroup->h_FmPcd;
280 static t_Error BuildShadowAndModifyDescriptor(t_FmPcdFrmReplicGroup *p_ReplicGroup,
290 ASSERT_COND(p_ReplicGroup);
291 ASSERT_COND(p_ReplicGroup->h_FmPcd);
293 p_FmPcd = p_ReplicGroup->h_FmPcd;
302 LinkSourceToMember(p_ReplicGroup, p_FmPcd->p_CcShadow, p_NextMember);
305 err = ModifyDescriptor(p_ReplicGroup,
306 p_ReplicGroup->p_SourceTd,
326 LinkMemberToMember(p_ReplicGroup, &shadowMember, p_NextMember);
329 err = ModifyDescriptor(p_ReplicGroup,
342 static t_FmPcdFrmReplicMember* GetMemberByIndex(t_FmPcdFrmReplicGroup *p_ReplicGroup,
349 LIST_FOR_EACH(p_Pos, &p_ReplicGroup->membersList)
361 static t_Error AllocMember(t_FmPcdFrmReplicGroup *p_ReplicGroup)
366 ASSERT_COND(p_ReplicGroup);
368 h_Muram = FmPcdGetMuramHandle(p_ReplicGroup->h_FmPcd);
391 LIST_AddToTail(&p_CurrentMember->node, &(p_ReplicGroup->availableMembersList));
396 static t_FmPcdFrmReplicMember* InitMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
402 ASSERT_COND(p_ReplicGroup);
405 p_CurrentMember = GetAvailableMember(p_ReplicGroup);
422 p_ReplicGroup->h_FmPcd);
434 static void FreeMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
445 PutAvailableMember(p_ReplicGroup, p_Member);
448 static t_Error RemoveMember(t_FmPcdFrmReplicGroup *p_ReplicGroup,
456 p_FmPcd = p_ReplicGroup->h_FmPcd;
460 p_CurrentMember = GetMemberByIndex(p_ReplicGroup, memberIndex);
464 memberPosition = GetMemberPosition(p_ReplicGroup,
471 p_NextMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex+1));
475 err = BuildShadowAndModifyDescriptor(p_ReplicGroup,
483 p_PreviousMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex-1));
486 p_NextMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex+1));
489 err = BuildShadowAndModifyDescriptor(p_ReplicGroup,
498 p_PreviousMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex-1));
501 err = BuildShadowAndModifyDescriptor(p_ReplicGroup,
522 RemoveMemberFromList(p_ReplicGroup, p_CurrentMember);
525 FreeMember(p_ReplicGroup, p_CurrentMember);
530 static void DeleteGroup(t_FmPcdFrmReplicGroup *p_ReplicGroup)
536 if (p_ReplicGroup)
538 ASSERT_COND(p_ReplicGroup->h_FmPcd);
539 h_Muram = FmPcdGetMuramHandle(p_ReplicGroup->h_FmPcd);
543 if (p_ReplicGroup->p_SourceTd)
545 FM_MURAM_FreeMem(h_Muram, p_ReplicGroup->p_SourceTd);
546 p_ReplicGroup->p_SourceTd = NULL;
551 if (p_ReplicGroup->numOfEntries)
553 j = p_ReplicGroup->numOfEntries-1;
559 p_CurrentMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)i/*memberIndex*/);
569 RemoveMemberFromList(p_ReplicGroup, p_CurrentMember);
572 FreeMember(p_ReplicGroup, p_CurrentMember);
577 for (i=0; i<p_ReplicGroup->maxNumOfEntries; i++)
579 p_Member = GetAvailableMember(p_ReplicGroup);
590 if (p_ReplicGroup->p_Lock)
591 FmPcdReleaseLock(p_ReplicGroup->h_FmPcd, p_ReplicGroup->p_Lock);
594 XX_Free(p_ReplicGroup);
606 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
607 ASSERT_COND(p_ReplicGroup);
609 return (p_ReplicGroup->p_SourceTd);
616 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
620 ASSERT_COND(p_ReplicGroup);
621 p_FmPcd = p_ReplicGroup->h_FmPcd;
625 (uint32_t)((XX_VirtToPhys(p_ReplicGroup->p_SourceTd)) - p_FmPcd->physicalMuramBase));
633 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
634 ASSERT_COND(p_ReplicGroup);
638 p_ReplicGroup->owners++;
641 ASSERT_COND(p_ReplicGroup->owners);
642 p_ReplicGroup->owners--;
648 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
652 if (FmPcdLockTryLock(p_ReplicGroup->p_Lock))
660 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
664 FmPcdLockUnlock(p_ReplicGroup->p_Lock);
675 t_FmPcdFrmReplicGroup *p_ReplicGroup;
698 p_ReplicGroup = (t_FmPcdFrmReplicGroup*)XX_Malloc(sizeof(t_FmPcdFrmReplicGroup));
699 if (!p_ReplicGroup)
704 memset(p_ReplicGroup, 0, sizeof(t_FmPcdFrmReplicGroup));
707 INIT_LIST(&p_ReplicGroup->availableMembersList);
708 INIT_LIST(&p_ReplicGroup->membersList);
710 p_ReplicGroup->h_FmPcd = h_FmPcd;
712 h_Muram = FmPcdGetMuramHandle(p_ReplicGroup->h_FmPcd);
716 p_ReplicGroup->p_Lock = FmPcdAcquireLock(p_ReplicGroup->h_FmPcd);
717 if (!p_ReplicGroup->p_Lock)
720 DeleteGroup(p_ReplicGroup);
725 p_ReplicGroup->p_SourceTd =
729 if (!p_ReplicGroup->p_SourceTd)
732 DeleteGroup(p_ReplicGroup);
737 err = FmPcdUpdateCcShadow(p_ReplicGroup->h_FmPcd,
743 DeleteGroup(p_ReplicGroup);
747 p_ReplicGroup->maxNumOfEntries = p_ReplicGroupParam->maxNumOfEntries;
751 for (i=0; i<p_ReplicGroup->maxNumOfEntries; i++)
753 err = AllocMember(p_ReplicGroup);
757 DeleteGroup(p_ReplicGroup);
774 p_CurrentMember = InitMember(p_ReplicGroup,
780 DeleteGroup(p_ReplicGroup);
785 LinkMemberToMember(p_ReplicGroup, p_CurrentMember, p_NextMember);
788 AddMemberToList(p_ReplicGroup, p_CurrentMember, &p_ReplicGroup->membersList);
794 BuildSourceTd(p_ReplicGroup->p_SourceTd);
797 LinkSourceToMember(p_ReplicGroup, p_ReplicGroup->p_SourceTd, p_NextMember);
799 return p_ReplicGroup;
804 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup *)h_ReplicGroup;
806 SANITY_CHECK_RETURN_ERROR(p_ReplicGroup, E_INVALID_HANDLE);
808 if (p_ReplicGroup->owners)
813 DeleteGroup(p_ReplicGroup);
826 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup*) h_ReplicGroup;
831 SANITY_CHECK_RETURN_ERROR(p_ReplicGroup, E_INVALID_HANDLE);
835 err = FrmReplicGroupTryLock(p_ReplicGroup);
839 if (memberIndex > p_ReplicGroup->numOfEntries)
842 FrmReplicGroupUnlock(p_ReplicGroup);
847 if (memberIndex >= p_ReplicGroup->maxNumOfEntries)
850 FrmReplicGroupUnlock(p_ReplicGroup);
854 if ((p_ReplicGroup->numOfEntries + 1) > FM_PCD_FRM_REPLIC_MAX_NUM_OF_ENTRIES)
857 FrmReplicGroupUnlock(p_ReplicGroup);
863 err = MemberCheckParams(p_ReplicGroup->h_FmPcd, p_MemberParams);
867 FrmReplicGroupUnlock(p_ReplicGroup);
871 memberPosition = GetMemberPosition(p_ReplicGroup,
876 p_NewMember = InitMember(p_ReplicGroup,
882 FrmReplicGroupUnlock(p_ReplicGroup);
889 p_CurrentMember = GetMemberByIndex(p_ReplicGroup, memberIndex);
892 LinkMemberToMember(p_ReplicGroup, p_NewMember, p_CurrentMember);
895 LinkSourceToMember(p_ReplicGroup,
896 p_ReplicGroup->p_SourceTd,
900 AddMemberToList(p_ReplicGroup,
902 &p_ReplicGroup->membersList);
906 p_CurrentMember = GetMemberByIndex(p_ReplicGroup, memberIndex);
909 p_PreviousMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex-1));
912 LinkMemberToMember(p_ReplicGroup, p_NewMember, p_CurrentMember);
913 LinkMemberToMember(p_ReplicGroup, p_PreviousMember, p_NewMember);
915 AddMemberToList(p_ReplicGroup, p_NewMember, &p_PreviousMember->node);
919 p_PreviousMember = GetMemberByIndex(p_ReplicGroup, (uint16_t)(memberIndex-1));
922 LinkMemberToMember(p_ReplicGroup, p_PreviousMember, p_NewMember);
926 AddMemberToList(p_ReplicGroup, p_NewMember, &p_PreviousMember->node);
931 FrmReplicGroupUnlock(p_ReplicGroup);
937 FrmReplicGroupUnlock(p_ReplicGroup);
945 t_FmPcdFrmReplicGroup *p_ReplicGroup = (t_FmPcdFrmReplicGroup*) h_ReplicGroup;
948 SANITY_CHECK_RETURN_ERROR(p_ReplicGroup, E_INVALID_HANDLE);
951 err = FrmReplicGroupTryLock(p_ReplicGroup);
955 if (memberIndex >= p_ReplicGroup->numOfEntries)
960 if (p_ReplicGroup->numOfEntries == 1)
963 err = RemoveMember(p_ReplicGroup, memberIndex);
966 FrmReplicGroupUnlock(p_ReplicGroup);