80 return EFI_INVALID_PARAMETER;
83 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
85 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
90 switch (Snp->Mode.
State) {
91 case EfiSimpleNetworkInitialized:
94 case EfiSimpleNetworkStopped:
95 Status = EFI_NOT_STARTED;
99 Status = EFI_DEVICE_ERROR;
107 if (!Reset && (StatisticsSize ==
NULL)) {
108 Status = (StatisticsTable !=
NULL) ? EFI_INVALID_PARAMETER :
EFI_SUCCESS;
118 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
119 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
120 Snp->Cdb.IFnum = Snp->IfNum;
121 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
124 Snp->Cdb.OpFlags = PXE_OPFLAGS_STATISTICS_RESET;
131 Snp->Cdb.DBaddr = (UINT64)(
UINTN)(Db = Snp->Db);
137 DEBUG ((DEBUG_NET,
"\nsnp->undi.statistics() "));
139 (*Snp->IssueUndi32Command)((UINT64)(
UINTN)&Snp->Cdb);
141 switch (Snp->Cdb.StatCode) {
145 case PXE_STATCODE_UNSUPPORTED:
148 "\nsnp->undi.statistics() %xh:%xh\n",
153 Status = EFI_UNSUPPORTED;
159 "\nsnp->undi.statistics() %xh:%xh\n",
164 Status = EFI_DEVICE_ERROR;
173 if (StatisticsTable ==
NULL) {
175 Status = EFI_BUFFER_TOO_SMALL;
183 ZeroMem (StatisticsTable, *StatisticsSize);
184 Stp = (UINT64 *)StatisticsTable;
187 for (Index = 0, Mask = 1; Index < 64; Index++, Mask =
LShiftU64 (Mask, 1), Stp++) {
192 if ((Index + 1) *
sizeof (UINT64) > *StatisticsSize) {
197 *Stp = Db->
Data[Index];
200 SetMem (Stp,
sizeof (UINT64), 0xFF);
207 while (++Index < 64) {
213 Size *=
sizeof (UINT64);
215 if (*StatisticsSize >= Size) {
216 *StatisticsSize = Size;
219 *StatisticsSize = Size;
220 Status = EFI_BUFFER_TOO_SMALL;
224 gBS->RestoreTPL (OldTpl);
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DEBUG(Expression)
EFI_STATUS EFIAPI SnpUndi32Statistics(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN OUT UINTN *StatisticsSize OPTIONAL, IN OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL)
#define PXE_CPBSIZE_NOT_USED
zero
#define PXE_OPCODE_STATISTICS
#define PXE_DBSIZE_NOT_USED
zero
#define PXE_CPBADDR_NOT_USED
zero
#define PXE_DBADDR_NOT_USED
zero
#define PXE_OPFLAGS_STATISTICS_READ
#define PXE_STATCODE_SUCCESS