17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Constants etc. for the Bochs/Etherboot pseudo-NIC 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * This header file must be valid C and C++. 57c478bd9Sstevel@tonic-gate * 67c478bd9Sstevel@tonic-gate * Operation of the pseudo-NIC (PNIC) is pretty simple. To write a 77c478bd9Sstevel@tonic-gate * command plus data, first write the length of the data to 87c478bd9Sstevel@tonic-gate * PNIC_REG_LEN, then write the data a byte at a type to 97c478bd9Sstevel@tonic-gate * PNIC_REG_DATA, then write the command code to PNIC_REG_CMD. The 107c478bd9Sstevel@tonic-gate * status will be available from PNIC_REG_STAT. The length of any 117c478bd9Sstevel@tonic-gate * data returned will be in PNIC_REG_LEN and can be read a byte at a 127c478bd9Sstevel@tonic-gate * time from PNIC_REG_DATA. 137c478bd9Sstevel@tonic-gate */ 147c478bd9Sstevel@tonic-gate 157c478bd9Sstevel@tonic-gate /* 167c478bd9Sstevel@tonic-gate * PCI parameters 177c478bd9Sstevel@tonic-gate */ 187c478bd9Sstevel@tonic-gate #define PNIC_PCI_VENDOR 0xfefe /* Hopefully these won't clash with */ 197c478bd9Sstevel@tonic-gate #define PNIC_PCI_DEVICE 0xefef /* any real PCI device IDs. */ 207c478bd9Sstevel@tonic-gate 217c478bd9Sstevel@tonic-gate /* 227c478bd9Sstevel@tonic-gate * 'Hardware' register addresses, offset from io_base 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate #define PNIC_REG_CMD 0x00 /* Command register, 2 bytes, write only */ 257c478bd9Sstevel@tonic-gate #define PNIC_REG_STAT 0x00 /* Status register, 2 bytes, read only */ 267c478bd9Sstevel@tonic-gate #define PNIC_REG_LEN 0x02 /* Length register, 2 bytes, read-write */ 277c478bd9Sstevel@tonic-gate #define PNIC_REG_DATA 0x04 /* Data port, 1 byte, read-write */ 287c478bd9Sstevel@tonic-gate /* 297c478bd9Sstevel@tonic-gate * PNIC_MAX_REG used in Bochs to claim i/o space 307c478bd9Sstevel@tonic-gate */ 317c478bd9Sstevel@tonic-gate #define PNIC_MAX_REG 0x04 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Command code definitions: write these into PNIC_REG_CMD 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate #define PNIC_CMD_NOOP 0x0000 377c478bd9Sstevel@tonic-gate #define PNIC_CMD_API_VER 0x0001 387c478bd9Sstevel@tonic-gate #define PNIC_CMD_READ_MAC 0x0002 397c478bd9Sstevel@tonic-gate #define PNIC_CMD_RESET 0x0003 407c478bd9Sstevel@tonic-gate #define PNIC_CMD_XMIT 0x0004 417c478bd9Sstevel@tonic-gate #define PNIC_CMD_RECV 0x0005 427c478bd9Sstevel@tonic-gate #define PNIC_CMD_RECV_QLEN 0x0006 437c478bd9Sstevel@tonic-gate #define PNIC_CMD_MASK_IRQ 0x0007 447c478bd9Sstevel@tonic-gate #define PNIC_CMD_FORCE_IRQ 0x0008 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * Status code definitions: read these from PNIC_REG_STAT 487c478bd9Sstevel@tonic-gate * 497c478bd9Sstevel@tonic-gate * We avoid using status codes that might be confused with 507c478bd9Sstevel@tonic-gate * randomly-read data (e.g. 0x0000, 0xffff etc.) 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate #define PNIC_STATUS_OK 0x4f4b /* 'OK' */ 537c478bd9Sstevel@tonic-gate #define PNIC_STATUS_UNKNOWN_CMD 0x3f3f /* '??' */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * Other miscellaneous information 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #define PNIC_API_VERSION 0x0101 /* 1.1 */ 60