X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fne2k.c;h=bbe80c0d6ed0ca0345484462b1ee17cd95d5796a;hb=d962f2be029772be3f21d9bd206ddf2a9f6a1d20;hp=d6399d8ed1bda85ce4b2d10d9c304285029aa636;hpb=dd318f2692eda262168133c6b8f0a633e3db5b44;p=palacios.git diff --git a/palacios/src/devices/ne2k.c b/palacios/src/devices/ne2k.c index d6399d8..bbe80c0 100644 --- a/palacios/src/devices/ne2k.c +++ b/palacios/src/devices/ne2k.c @@ -22,14 +22,16 @@ */ #include -#include +#include #include #include #include #include #include +#include +#include -#ifndef DEBUG_NE2K +#ifndef CONFIG_DEBUG_NE2K #undef PrintDebug #define PrintDebug(fmts, args...) #endif @@ -322,15 +324,9 @@ struct ne2k_context { } __attribute__((packed)); - - - uint8_t mcast_addr[8]; // multicast mask array uint8_t mac_addr[6]; // MAC Addr - - - uint8_t mem[NE2K_MEM_SIZE]; struct pci_device * pci_dev; @@ -339,7 +335,7 @@ struct ne2k_context { #define compare_mac(src, dst) !memcmp(src, dst, 6) -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K static void dump_state(struct vm_device * dev) { struct ne2k_context *nic_state = (struct ne2k_context *)dev->private_data; int i; @@ -364,7 +360,7 @@ static void dump_state(struct vm_device * dev) { static int ne2k_update_irq(struct vm_device *dev) { - struct ne2k_context * nic_state = (struct ne2k_context *)dev->private_data; + struct ne2k_context * nic_state = (struct ne2k_context *)(dev->private_data); struct pci_device * pci_dev = nic_state->pci_dev; int irq_line = 0; @@ -372,7 +368,7 @@ static int ne2k_update_irq(struct vm_device *dev) { PrintDebug("Ne2k: Device %p is not attached to any PCI Bus\n", nic_state); irq_line = NE2K_DEFAULT_IRQ; } else { - irq_line = pdev->config_header.intr_line; + irq_line = pci_dev->config_header.intr_line; } if (irq_line == 0){ @@ -380,14 +376,13 @@ static int ne2k_update_irq(struct vm_device *dev) { return -1; } - PrintDebug("Ne2k: RaiseIrq: isr: 0x%02x imr: 0x%02x\n", nic_state->isr.val, nic_state->imr.val); PrintDebug("ne2k_update_irq: irq_line: %d\n", irq_line); // The top bit of the ISR/IMR is reserved and does not indicate and irq event // We mask the bit out of the irq pending check if ((nic_state->isr.val & nic_state->imr.val) & 0x7f) { - v3_raise_irq(nic_state->vm, irq_line); + v3_raise_virq(nic_state->vm, irq_line); PrintDebug("Ne2k: RaiseIrq: isr: 0x%02x imr: 0x%02x\n", nic_state->isr.val, nic_state->imr.val); } @@ -403,7 +398,7 @@ static void ne2k_init_state(struct vm_device * dev) { nic_state->vm = dev->vm; - nic_state->isr.reset = 1; + nic_state->isr.reset_status = 1; nic_state->imr.val = 0x00; nic_state->cmd.val = 0x22; @@ -420,7 +415,7 @@ static void ne2k_init_state(struct vm_device * dev) { nic_state->mem[14] = 0x57; nic_state->mem[15] = 0x57; -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K dump_state(dev); #endif @@ -474,7 +469,7 @@ static void ne2k_receive(struct vm_device * dev, const uchar_t * pkt, int length uint32_t total_len; uint32_t next; uint32_t len; - uin32_t index; + uint32_t index; uint32_t empty; uchar_t buf[60]; uint32_t start; @@ -515,7 +510,7 @@ static void ne2k_receive(struct vm_device * dev, const uchar_t * pkt, int length p = nic_state->mem + index; nic_state->rsr.val = 0; - nic_state->rsr.rx_pkt_ok = 1; + nic_state->rsr.pkt_rx_ok = 1; if (pkt[0] & 0x01) { nic_state->rsr.phy = 1; @@ -565,7 +560,7 @@ static int netif_input(uchar_t *pkt, uint_t size) { static const uchar_t brocast_mac[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; int i; -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K PrintDebug("\nNe2k: Packet Received:\nSource:"); for (i = 6; i < 12; i++) { PrintDebug("%x ", pkt[i]); @@ -789,7 +784,7 @@ static int ne2k_cmd_write(uint16_t port, void * src, uint_t length, struct vm_de nic_state->cmd.val = *(uint8_t *)src; if (!(nic_state->cmd.stop)) { - nic_state->isr.reset = 0; + nic_state->isr.reset_status = 0; // if ((send pkt) && (dma byte count == 0)) @@ -1153,7 +1148,7 @@ static int ne2k_init_device(struct vm_device * dev) { } -#ifdef DEBUG_NE2K +#ifdef CONFIG_DEBUG_NE2K dump_state(dev); #endif @@ -1176,7 +1171,7 @@ static int ne2k_deinit_device(struct vm_device *dev) { } -static struct vm_device_ops dev_ops = { +static struct v3_device_ops dev_ops = { .init = ne2k_init_device, .deinit = ne2k_deinit_device, .reset = ne2k_reset_device,