iPXE
pnic_api.h
Go to the documentation of this file.
00001 /*
00002  * Constants etc. for the Bochs/Etherboot pseudo-NIC
00003  * 
00004  * This header file must be valid C and C++.
00005  *
00006  * Operation of the pseudo-NIC (PNIC) is pretty simple.  To write a
00007  * command plus data, first write the length of the data to
00008  * PNIC_REG_LEN, then write the data a byte at a type to
00009  * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD.  The
00010  * status will be available from PNIC_REG_STAT.  The length of any
00011  * data returned will be in PNIC_REG_LEN and can be read a byte at a
00012  * time from PNIC_REG_DATA.
00013  */
00014 
00015 FILE_LICENCE ( GPL2_OR_LATER );
00016 
00017 /*
00018  * PCI parameters
00019  */
00020 #define PNIC_PCI_VENDOR 0xfefe  /* Hopefully these won't clash with */
00021 #define PNIC_PCI_DEVICE 0xefef  /* any real PCI device IDs.         */
00022 
00023 /*
00024  * 'Hardware' register addresses, offset from io_base
00025  */
00026 #define PNIC_REG_CMD    0x00    /* Command register, 2 bytes, write only */
00027 #define PNIC_REG_STAT   0x00    /* Status register, 2 bytes, read only */
00028 #define PNIC_REG_LEN    0x02    /* Length register, 2 bytes, read-write */
00029 #define PNIC_REG_DATA   0x04    /* Data port, 1 byte, read-write */
00030 /*
00031  * PNIC_MAX_REG used in Bochs to claim i/o space
00032  */
00033 #define PNIC_MAX_REG    0x04
00034 
00035 /*
00036  * Command code definitions: write these into PNIC_REG_CMD
00037  */
00038 #define PNIC_CMD_NOOP           0x0000
00039 #define PNIC_CMD_API_VER        0x0001
00040 #define PNIC_CMD_READ_MAC       0x0002
00041 #define PNIC_CMD_RESET          0x0003
00042 #define PNIC_CMD_XMIT           0x0004
00043 #define PNIC_CMD_RECV           0x0005
00044 #define PNIC_CMD_RECV_QLEN      0x0006
00045 #define PNIC_CMD_MASK_IRQ       0x0007
00046 #define PNIC_CMD_FORCE_IRQ      0x0008
00047 
00048 /*
00049  * Status code definitions: read these from PNIC_REG_STAT
00050  *
00051  * We avoid using status codes that might be confused with
00052  * randomly-read data (e.g. 0x0000, 0xffff etc.)
00053  */
00054 #define PNIC_STATUS_OK          0x4f4b          /* 'OK' */
00055 #define PNIC_STATUS_UNKNOWN_CMD 0x3f3f          /* '??' */
00056 
00057 /*
00058  * Other miscellaneous information
00059  */
00060 
00061 #define PNIC_API_VERSION        0x0101          /* 1.1 */