rtoss - Diff between revs 77 and 79

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 77 Rev 79
Line 17... Line 17...
17 #define NUM_PACKETS 4 17 #define NUM_PACKETS 4
18 18
19 typedef struct { 19 typedef struct {
20     SysBusDevice busdev; 20     SysBusDevice busdev;
21     VLANClientState *vc; 21     VLANClientState *vc;
-   22     NICConf conf;
22     uint16_t tcr; 23     uint16_t tcr;
23     uint16_t rcr; 24     uint16_t rcr;
24     uint16_t cr; 25     uint16_t cr;
25     uint16_t ctr; 26     uint16_t ctr;
26     uint16_t gpr; 27     uint16_t gpr;
Line 40... Line 41...
40     int tx_fifo_done[NUM_PACKETS]; 41     int tx_fifo_done[NUM_PACKETS];
41     /* Packet buffer memory.  */ 42     /* Packet buffer memory.  */
42     uint8_t data[NUM_PACKETS][2048]; 43     uint8_t data[NUM_PACKETS][2048];
43     uint8_t int_level; 44     uint8_t int_level;
44     uint8_t int_mask; 45     uint8_t int_mask;
45     uint8_t macaddr[6]; -  
46     int mmio_index; 46     int mmio_index;
47 } smc91c111_state; 47 } smc91c111_state;
48 48
49 #define RCR_SOFT_RST  0x8000 49 #define RCR_SOFT_RST  0x8000
50 #define RCR_STRIP_CRC 0x0200 50 #define RCR_STRIP_CRC 0x0200
Line 472... Line 472...
472             return s->cr >> 8; 472             return s->cr >> 8;
473         case 2: case 3: /* BASE */ 473         case 2: case 3: /* BASE */
474             /* Not implemented.  */ 474             /* Not implemented.  */
475             return 0; 475             return 0;
476         case 4: case 5: case 6: case 7: case 8: case 9: /* IA */ 476         case 4: case 5: case 6: case 7: case 8: case 9: /* IA */
477             return s->macaddr[offset - 4]; -  
-   477             return s->conf.macaddr.a[offset - 4];
478         case 10: /* General Purpose */ 478         case 10: /* General Purpose */
479             return s->gpr & 0xff; 479             return s->gpr & 0xff;
480         case 11: 480         case 11:
481             return s->gpr >> 8; 481             return s->gpr >> 8;
482         case 12: /* Control */ 482         case 12: /* Control */
Line 694... Line 694...
694 694
695 static void smc91c111_cleanup(VLANClientState *vc) 695 static void smc91c111_cleanup(VLANClientState *vc)
696 { 696 {
697     smc91c111_state *s = vc->opaque; 697     smc91c111_state *s = vc->opaque;
698 698
699     cpu_unregister_io_memory(s->mmio_index); -  
700     qemu_free(s); -  
-   699     s->vc = NULL;
701 } 700 }
702 701
703 static int smc91c111_init1(SysBusDevice *dev) 702 static int smc91c111_init1(SysBusDevice *dev)
704 { 703 {
705     smc91c111_state *s = FROM_SYSBUS(smc91c111_state, dev); 704     smc91c111_state *s = FROM_SYSBUS(smc91c111_state, dev);
706 705
707     s->mmio_index = cpu_register_io_memory(smc91c111_readfn, 706     s->mmio_index = cpu_register_io_memory(smc91c111_readfn,
708                                            smc91c111_writefn, s); 707                                            smc91c111_writefn, s);
709     sysbus_init_mmio(dev, 16, s->mmio_index); 708     sysbus_init_mmio(dev, 16, s->mmio_index);
710     sysbus_init_irq(dev, &s->irq); 709     sysbus_init_irq(dev, &s->irq);
711     qdev_get_macaddr(&dev->qdev, s->macaddr); -  
-   710     qemu_macaddr_default_if_unset(&s->conf.macaddr);
712 711
713     smc91c111_reset(s); 712     smc91c111_reset(s);
714 713
715     s->vc = qdev_get_vlan_client(&dev->qdev, -  
-   714     s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC,
-   715                                  s->conf.vlan, s->conf.peer,
-   716                                  dev->qdev.info->name, dev->qdev.id,
716                                  smc91c111_can_receive, smc91c111_receive, NULL, 717                                  smc91c111_can_receive, smc91c111_receive, NULL,
717                                  smc91c111_cleanup, s); -  
718     qemu_format_nic_info_str(s->vc, s->macaddr); -  
-   718                                  NULL, smc91c111_cleanup, s);
-   719     qemu_format_nic_info_str(s->vc, s->conf.macaddr.a);
719     /* ??? Save/restore.  */ 720     /* ??? Save/restore.  */
720     return 0; 721     return 0;
721 } 722 }
-   723
-   724 static SysBusDeviceInfo smc91c111_info = {
-   725     .init = smc91c111_init1,
-   726     .qdev.name  = "smc91c111",
-   727     .qdev.size  = sizeof(smc91c111_state),
-   728     .qdev.props = (Property[]) {
-   729         DEFINE_NIC_PROPERTIES(smc91c111_state, conf),
-   730         DEFINE_PROP_END_OF_LIST(),
-   731     }
-   732 };
722 733
723 static void smc91c111_register_devices(void) 734 static void smc91c111_register_devices(void)
724 { 735 {
725     sysbus_register_dev("smc91c111", sizeof(smc91c111_state), smc91c111_init1); -  
-   736     sysbus_register_withprop(&smc91c111_info);
726 } 737 }
727 738
728 /* Legacy helper function.  Should go away when machine config files are 739 /* Legacy helper function.  Should go away when machine config files are
729    implemented.  */ 740    implemented.  */
730 void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq) 741 void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq)
Line 732... Line 743...
732     DeviceState *dev; 743     DeviceState *dev;
733     SysBusDevice *s; 744     SysBusDevice *s;
734 745
735     qemu_check_nic_model(nd, "smc91c111"); 746     qemu_check_nic_model(nd, "smc91c111");
736     dev = qdev_create(NULL, "smc91c111"); 747     dev = qdev_create(NULL, "smc91c111");
737     dev->nd = nd; -  
-   748     qdev_set_nic_properties(dev, nd);
738     qdev_init_nofail(dev); 749     qdev_init_nofail(dev);
739     s = sysbus_from_qdev(dev); 750     s = sysbus_from_qdev(dev);
740     sysbus_mmio_map(s, 0, base); 751     sysbus_mmio_map(s, 0, base);
741     sysbus_connect_irq(s, 0, irq); 752     sysbus_connect_irq(s, 0, irq);
742 } 753 }