ne2000-isa.c (fe6f5deb6611c512abcb4cb46a275756295b3e79) ne2000-isa.c (db895a1e6a97e919f9b86d60c969377357b05066)
1/*
2 * QEMU NE2000 emulation -- isa bus windup
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 52 unchanged lines hidden (view full) ---

61 .minimum_version_id = 0,
62 .minimum_version_id_old = 0,
63 .fields = (VMStateField []) {
64 VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
65 VMSTATE_END_OF_LIST()
66 }
67};
68
1/*
2 * QEMU NE2000 emulation -- isa bus windup
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 52 unchanged lines hidden (view full) ---

61 .minimum_version_id = 0,
62 .minimum_version_id_old = 0,
63 .fields = (VMStateField []) {
64 VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
65 VMSTATE_END_OF_LIST()
66 }
67};
68
69static int isa_ne2000_initfn(ISADevice *dev)
69static void isa_ne2000_realizefn(DeviceState *dev, Error **errp)
70{
70{
71 ISADevice *isadev = ISA_DEVICE(dev);
71 ISANE2000State *isa = ISA_NE2000(dev);
72 NE2000State *s = &isa->ne2000;
73
74 ne2000_setup_io(s, 0x20);
72 ISANE2000State *isa = ISA_NE2000(dev);
73 NE2000State *s = &isa->ne2000;
74
75 ne2000_setup_io(s, 0x20);
75 isa_register_ioport(dev, &s->io, isa->iobase);
76 isa_register_ioport(isadev, &s->io, isa->iobase);
76
77
77 isa_init_irq(dev, &s->irq, isa->isairq);
78 isa_init_irq(isadev, &s->irq, isa->isairq);
78
79 qemu_macaddr_default_if_unset(&s->c.macaddr);
80 ne2000_reset(s);
81
82 s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c,
79
80 qemu_macaddr_default_if_unset(&s->c.macaddr);
81 ne2000_reset(s);
82
83 s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c,
83 object_get_typename(OBJECT(dev)), dev->qdev.id, s);
84 object_get_typename(OBJECT(dev)), dev->id, s);
84 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
85 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->c.macaddr.a);
85
86 return 0;
87}
88
89static Property ne2000_isa_properties[] = {
90 DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
91 DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, 9),
92 DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
93 DEFINE_PROP_END_OF_LIST(),
94};
95
96static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
97{
98 DeviceClass *dc = DEVICE_CLASS(klass);
86}
87
88static Property ne2000_isa_properties[] = {
89 DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
90 DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, 9),
91 DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
92 DEFINE_PROP_END_OF_LIST(),
93};
94
95static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
96{
97 DeviceClass *dc = DEVICE_CLASS(klass);
99 ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
100 ic->init = isa_ne2000_initfn;
98
99 dc->realize = isa_ne2000_realizefn;
101 dc->props = ne2000_isa_properties;
102}
103
104static const TypeInfo ne2000_isa_info = {
105 .name = TYPE_ISA_NE2000,
106 .parent = TYPE_ISA_DEVICE,
107 .instance_size = sizeof(ISANE2000State),
108 .class_init = isa_ne2000_class_initfn,
109};
110
111static void ne2000_isa_register_types(void)
112{
113 type_register_static(&ne2000_isa_info);
114}
115
116type_init(ne2000_isa_register_types)
100 dc->props = ne2000_isa_properties;
101}
102
103static const TypeInfo ne2000_isa_info = {
104 .name = TYPE_ISA_NE2000,
105 .parent = TYPE_ISA_DEVICE,
106 .instance_size = sizeof(ISANE2000State),
107 .class_init = isa_ne2000_class_initfn,
108};
109
110static void ne2000_isa_register_types(void)
111{
112 type_register_static(&ne2000_isa_info);
113}
114
115type_init(ne2000_isa_register_types)