74 if ( output_length ==
NULL ) {
75 if ( _output_length != output_max_length ) {
76 printf (
"pnic_command %#hx: wrong data length " 77 "returned (expected %d, got %d)\n",
command,
78 output_max_length, _output_length );
81 *output_length = _output_length;
84 if ( _output_length > output_max_length ) {
85 printf (
"pnic_command %#hx: output buffer too small " 86 "(have %d, need %d)\n",
command,
87 output_max_length, _output_length );
88 _output_length = output_max_length;
102 output, output_max_length,
105 printf (
"PNIC command %#hx (len %#hx) failed with status %#hx\n",
113 printf (
"Warning: API version mismatch! " 114 "(NIC's is %d.%d, ours is %d.%d)\n",
115 api_version >> 8, api_version & 0xff,
119 printf (
"** You may need to update your copy of Bochs **\n" );
136 &qlen,
sizeof ( qlen ),
NULL )
143 DBG (
"could not allocate buffer\n" );
195 uint8_t mask = ( enable ? 1 : 0 );
251 sizeof ( api_version ),
NULL );
253 printf (
"PNIC failed installation check, code %#hx\n",
282 PCI_ROM ( 0xfefe, 0xefef,
"pnic",
"Bochs Pseudo NIC Adaptor", 0 ),
struct arbelprm_rc_send_wqe rc
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
int printf(const char *fmt,...)
Write a formatted string to the console.
uint16_t inw(volatile uint16_t *io_addr)
Read 16-bit word from I/O-mapped device.
#define PNIC_CMD_MASK_IRQ
int(* open)(struct net_device *netdev)
Open network device.
#define outw(data, io_addr)
unsigned long ioaddr
I/O address.
#define PNIC_CMD_READ_MAC
struct pci_device_id * ids
PCI ID table.
static void pnic_poll(struct net_device *netdev)
static uint16_t pnic_command_quiet(struct pnic *pnic, uint16_t command, const void *input, uint16_t input_length, void *output, uint16_t output_max_length, uint16_t *output_length)
static int pnic_transmit(struct net_device *netdev, struct io_buffer *iobuf)
void insb(volatile uint8_t *io_addr, uint8_t *data, unsigned int count)
Read bytes from I/O-mapped device.
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct device dev
Generic device.
static void pnic_close(struct net_device *netdev __unused)
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void pnic_remove(struct pci_device *pci)
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
#define ENOMEM
Not enough space.
static struct pci_device_id pnic_nics[]
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
void * priv
Driver private data.
#define __unused
Declare a variable or data structure as unused.
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
static struct net_device * netdev
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define PNIC_CMD_RECV_QLEN
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
A PCI device ID list entry.
static struct xen_remove_from_physmap * remove
struct pci_driver pnic_driver __pci_driver
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
Network device management.
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void outsb(volatile uint8_t *io_addr, const uint8_t *data, unsigned int count)
Write bytes to I/O-mapped device.
static int pnic_api_check(uint16_t api_version)
int(* probe)(struct pci_device *pci)
Probe device.
void * data
Start of data.
#define EIO
Input/output error.
static void pnic_irq(struct net_device *netdev, int enable)
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static uint16_t pnic_command(struct pnic *pnic, uint16_t command, const void *input, uint16_t input_length, void *output, uint16_t output_max_length, uint16_t *output_length)
static int pnic_probe(struct pci_device *pci)
FILE_LICENCE(GPL2_OR_LATER)
static struct net_device_operations pnic_operations
#define DBG(...)
Print a debugging message.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
static int pnic_open(struct net_device *netdev __unused)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.