42 if (SrcAddr !=
NULL) {
57 (VOID *)Cpb->DestAddr,
65 Cpb->
Protocol = (UINT16)PXE_SWAP_UINT16 (*ProtocolPtr);
81 Snp->Cdb.OpFlags = PXE_OPFLAGS_FILL_HEADER_FRAGMENTED;
87 Snp->Cdb.CPBaddr = (UINT64)(
UINTN)Cpb;
89 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
90 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
91 Snp->Cdb.IFnum = Snp->IfNum;
92 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
97 DEBUG ((DEBUG_NET,
"\nSnp->undi.fill_header() "));
99 (*Snp->IssueUndi32Command)((UINT64)(
UINTN)&Snp->Cdb);
101 switch (Snp->Cdb.StatCode) {
105 case PXE_STATCODE_INVALID_PARAMETER:
108 "\nSnp->undi.fill_header() %xh:%xh\n",
113 return EFI_INVALID_PARAMETER;
118 "\nSnp->undi.fill_header() %xh:%xh\n",
123 return EFI_DEVICE_ERROR;
150 Cpb->
DataLen = (UINT32)BufferSize;
155 Snp->Cdb.OpFlags = PXE_OPFLAGS_TRANSMIT_WHOLE;
158 Snp->Cdb.CPBaddr = (UINT64)(
UINTN)Cpb;
164 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
165 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
166 Snp->Cdb.IFnum = Snp->IfNum;
167 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
172 DEBUG ((DEBUG_NET,
"\nSnp->undi.transmit() "));
173 DEBUG ((DEBUG_NET,
"\nSnp->Cdb.OpCode == %x", Snp->Cdb.OpCode));
174 DEBUG ((DEBUG_NET,
"\nSnp->Cdb.CPBaddr == %LX", Snp->Cdb.CPBaddr));
175 DEBUG ((DEBUG_NET,
"\nSnp->Cdb.DBaddr == %LX", Snp->Cdb.DBaddr));
178 (*Snp->IssueUndi32Command)((UINT64)(
UINTN)&Snp->Cdb);
180 DEBUG ((DEBUG_NET,
"\nexit Snp->undi.transmit() "));
185 switch (Snp->Cdb.StatCode) {
189 case PXE_STATCODE_BUFFER_FULL:
190 case PXE_STATCODE_QUEUE_FULL:
191 case PXE_STATCODE_BUSY:
192 Status = EFI_NOT_READY;
195 "\nSnp->undi.transmit() %xh:%xh\n",
204 "\nSnp->undi.transmit() %xh:%xh\n",
208 Status = EFI_DEVICE_ERROR;
277 IN UINT16 *Protocol OPTIONAL
285 return EFI_INVALID_PARAMETER;
288 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
290 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
293 return EFI_DEVICE_ERROR;
296 switch (Snp->Mode.
State) {
297 case EfiSimpleNetworkInitialized:
300 case EfiSimpleNetworkStopped:
301 Status = EFI_NOT_STARTED;
305 Status = EFI_DEVICE_ERROR;
309 if (Buffer ==
NULL) {
310 Status = EFI_INVALID_PARAMETER;
314 if (BufferSize < Snp->Mode.MediaHeaderSize) {
315 Status = EFI_BUFFER_TOO_SMALL;
323 if (HeaderSize != 0) {
324 if ((HeaderSize != Snp->Mode.
MediaHeaderSize) || (DestAddr == 0) || (Protocol == 0)) {
325 Status = EFI_INVALID_PARAMETER;
333 (UINT8 *)Buffer + HeaderSize,
334 BufferSize - HeaderSize,
340 if (EFI_ERROR (Status)) {
348 gBS->RestoreTPL (OldTpl);
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define DEBUG(Expression)
EFI_STATUS PxeTransmit(SNP_DRIVER *Snp, VOID *Buffer, UINTN BufferSize)
EFI_STATUS PxeFillHeader(SNP_DRIVER *Snp, VOID *MacHeaderPtr, UINTN HeaderSize, VOID *Buffer, UINTN BufferSize, EFI_MAC_ADDRESS *DestAddr, EFI_MAC_ADDRESS *SrcAddr, UINT16 *ProtocolPtr)
EFI_STATUS EFIAPI SnpUndi32Transmit(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINTN HeaderSize, IN UINTN BufferSize, IN VOID *Buffer, IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, IN UINT16 *Protocol OPTIONAL)
#define PXE_OPCODE_TRANSMIT
#define PXE_OPCODE_FILL_HEADER
#define PXE_DBSIZE_NOT_USED
zero
#define PXE_DBADDR_NOT_USED
zero
#define PXE_STATCODE_SUCCESS
EFI_MAC_ADDRESS CurrentAddress
PXE_UINT16 MediaheaderLen