xref: /titanic_50/usr/src/grub/grub-0.97/netboot/pnic_api.h (revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809)
1*1b8adde7SWilliam Kucharski /*
2*1b8adde7SWilliam Kucharski  * Constants etc. for the Bochs/Etherboot pseudo-NIC
3*1b8adde7SWilliam Kucharski  *
4*1b8adde7SWilliam Kucharski  * This header file must be valid C and C++.
5*1b8adde7SWilliam Kucharski  *
6*1b8adde7SWilliam Kucharski  * Operation of the pseudo-NIC (PNIC) is pretty simple.  To write a
7*1b8adde7SWilliam Kucharski  * command plus data, first write the length of the data to
8*1b8adde7SWilliam Kucharski  * PNIC_REG_LEN, then write the data a byte at a type to
9*1b8adde7SWilliam Kucharski  * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD.  The
10*1b8adde7SWilliam Kucharski  * status will be available from PNIC_REG_STAT.  The length of any
11*1b8adde7SWilliam Kucharski  * data returned will be in PNIC_REG_LEN and can be read a byte at a
12*1b8adde7SWilliam Kucharski  * time from PNIC_REG_DATA.
13*1b8adde7SWilliam Kucharski  */
14*1b8adde7SWilliam Kucharski 
15*1b8adde7SWilliam Kucharski /*
16*1b8adde7SWilliam Kucharski  * PCI parameters
17*1b8adde7SWilliam Kucharski  */
18*1b8adde7SWilliam Kucharski #define PNIC_PCI_VENDOR	0xfefe	/* Hopefully these won't clash with */
19*1b8adde7SWilliam Kucharski #define PNIC_PCI_DEVICE 0xefef	/* any real PCI device IDs.         */
20*1b8adde7SWilliam Kucharski 
21*1b8adde7SWilliam Kucharski /*
22*1b8adde7SWilliam Kucharski  * 'Hardware' register addresses, offset from io_base
23*1b8adde7SWilliam Kucharski  */
24*1b8adde7SWilliam Kucharski #define PNIC_REG_CMD	0x00	/* Command register, 2 bytes, write only */
25*1b8adde7SWilliam Kucharski #define PNIC_REG_STAT	0x00	/* Status register, 2 bytes, read only */
26*1b8adde7SWilliam Kucharski #define PNIC_REG_LEN	0x02	/* Length register, 2 bytes, read-write */
27*1b8adde7SWilliam Kucharski #define PNIC_REG_DATA	0x04	/* Data port, 1 byte, read-write */
28*1b8adde7SWilliam Kucharski /*
29*1b8adde7SWilliam Kucharski  * PNIC_MAX_REG used in Bochs to claim i/o space
30*1b8adde7SWilliam Kucharski  */
31*1b8adde7SWilliam Kucharski #define PNIC_MAX_REG	0x04
32*1b8adde7SWilliam Kucharski 
33*1b8adde7SWilliam Kucharski /*
34*1b8adde7SWilliam Kucharski  * Command code definitions: write these into PNIC_REG_CMD
35*1b8adde7SWilliam Kucharski  */
36*1b8adde7SWilliam Kucharski #define PNIC_CMD_NOOP		0x0000
37*1b8adde7SWilliam Kucharski #define PNIC_CMD_API_VER	0x0001
38*1b8adde7SWilliam Kucharski #define PNIC_CMD_READ_MAC	0x0002
39*1b8adde7SWilliam Kucharski #define PNIC_CMD_RESET		0x0003
40*1b8adde7SWilliam Kucharski #define PNIC_CMD_XMIT		0x0004
41*1b8adde7SWilliam Kucharski #define PNIC_CMD_RECV		0x0005
42*1b8adde7SWilliam Kucharski #define PNIC_CMD_RECV_QLEN	0x0006
43*1b8adde7SWilliam Kucharski #define PNIC_CMD_MASK_IRQ	0x0007
44*1b8adde7SWilliam Kucharski #define PNIC_CMD_FORCE_IRQ	0x0008
45*1b8adde7SWilliam Kucharski 
46*1b8adde7SWilliam Kucharski /*
47*1b8adde7SWilliam Kucharski  * Status code definitions: read these from PNIC_REG_STAT
48*1b8adde7SWilliam Kucharski  *
49*1b8adde7SWilliam Kucharski  * We avoid using status codes that might be confused with
50*1b8adde7SWilliam Kucharski  * randomly-read data (e.g. 0x0000, 0xffff etc.)
51*1b8adde7SWilliam Kucharski  */
52*1b8adde7SWilliam Kucharski #define PNIC_STATUS_OK		0x4f4b		/* 'OK' */
53*1b8adde7SWilliam Kucharski #define PNIC_STATUS_UNKNOWN_CMD	0x3f3f		/* '??' */
54*1b8adde7SWilliam Kucharski 
55*1b8adde7SWilliam Kucharski /*
56*1b8adde7SWilliam Kucharski  * Other miscellaneous information
57*1b8adde7SWilliam Kucharski  */
58*1b8adde7SWilliam Kucharski 
59*1b8adde7SWilliam Kucharski #define PNIC_API_VERSION	0x0101		/* 1.1 */
60