implemented the first pxe bios call

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19622 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2006-12-25 02:48:50 +00:00
parent 578e3c2607
commit 8456183dfd
2 changed files with 99 additions and 9 deletions

View File

@ -5,6 +5,7 @@
#include <OS.h>
#include <KernelExport.h>
#include <string.h>
#include "pxe_undi.h"
@ -16,22 +17,19 @@
#endif
struct pxe_struct
{
uint32 signature;
};
pxe_struct *gPxeData;
pxe_struct *
PXE_STRUCT *gPxeData;
PXE_STRUCT *
pxe_undi_find_data()
{
pxe_struct *data = NULL;
PXE_STRUCT *data = NULL;
for (char *addr = (char *)0x8D000; addr < (char *)0xA0000; addr += 16) {
if (*(uint32 *)addr == 'EXP!' /* '!PXE' */) {
TRACE("found !PXE at %p\n", addr);
data = (pxe_struct *)addr;
data = (PXE_STRUCT *)addr;
break;
}
}
@ -48,5 +46,28 @@ pxe_undi_init()
if (!gPxeData)
panic("can't find !PXE structure");
TRACE("entrypoint at %p\n", *(uint32 *)&gPxeData->EntryPointSP);
PXENV_UNDI_GET_INFORMATION get_info;
memset(&get_info, 0, sizeof(get_info));
TRACE("PXENV_UNDI_GET_INFORMATION at %p\n", &get_info);
uint16 res = call_pxe_bios(gPxeData, UNDI_GET_INFORMATION, &get_info);
TRACE("res = %04x\n", res);
TRACE("Status = %x\n", get_info.Status);
TRACE("BaseIo = %x\n", get_info.BaseIo);
TRACE("IntNumber = %x\n", get_info.IntNumber);
TRACE("MaxTranUnit = %x\n", get_info.MaxTranUnit);
TRACE("HwType = %x\n", get_info.HwType);
TRACE("HwAddrLen = %x\n", get_info.HwAddrLen);
TRACE("MAC = %02x:%02x:%02x:%02x:%02x:%02x\n", get_info.CurrentNodeAddress[0], get_info.CurrentNodeAddress[1],
get_info.CurrentNodeAddress[2], get_info.CurrentNodeAddress[3],
get_info.CurrentNodeAddress[4], get_info.CurrentNodeAddress[5] );
TRACE("RxBufCt = %x\n", get_info.RxBufCt);
TRACE("TxBufCt = %x\n", get_info.TxBufCt);
}

View File

@ -3,6 +3,75 @@
* Distributed under the terms of the MIT License.
*/
#ifndef _PXE_UNDI_H
#define _PXE_UNDI_H
extern "C" uint16 call_pxe_bios(void *pxe, uint16 opcode, void *param);
void pxe_undi_init();
#define UNDI_GET_INFORMATION 0x000C
struct SEGSEL
{
uint16 a;
};
struct SEGOFF16
{
uint16 seg;
uint16 ofs;
};
struct SEGDESC
{
uint64 a;
};
struct PXE_STRUCT
{
uint32 Signature;
uint8 StructLength;
uint8 StructCksum;
uint8 StructRev;
uint8 reserved_1;
SEGOFF16 UNDIROMID;
SEGOFF16 BaseROMID;
SEGOFF16 EntryPointSP;
SEGOFF16 EntryPointESP;
SEGOFF16 StatusCallout;
uint8 reserved_2;
uint8 SegDescCnt;
SEGSEL FirstSelector;
SEGDESC Stack;
SEGDESC UNDIData;
SEGDESC UNDICode;
SEGDESC UNDICodeWrite;
SEGDESC BC_Data;
SEGDESC BC_Code;
SEGDESC BC_CodeWrite;
};
struct PXENV_UNDI_GET_INFORMATION
{
uint16 Status;
uint16 BaseIo;
uint16 IntNumber;
uint16 MaxTranUnit;
uint16 HwType;
#define ETHER_TYPE 1
#define EXP_ETHER_TYPE 2
#define IEEE_TYPE 6
#define ARCNET_TYPE 7
uint16 HwAddrLen;
uint8 CurrentNodeAddress[16];
uint8 PermNodeAddress[16];
SEGSEL ROMAddress;
uint16 RxBufCt;
uint16 TxBufCt;
};
#endif