Lines Matching full:s
150 static uint32_t dp8393x_cdp(dp8393xState *s) in dp8393x_cdp() argument
152 return (s->regs[SONIC_URRA] << 16) | s->regs[SONIC_CDP]; in dp8393x_cdp()
155 static uint32_t dp8393x_crba(dp8393xState *s) in dp8393x_crba() argument
157 return (s->regs[SONIC_CRBA1] << 16) | s->regs[SONIC_CRBA0]; in dp8393x_crba()
160 static uint32_t dp8393x_crda(dp8393xState *s) in dp8393x_crda() argument
162 return (s->regs[SONIC_URDA] << 16) | in dp8393x_crda()
163 (s->regs[SONIC_CRDA] & SONIC_DESC_ADDR); in dp8393x_crda()
166 static uint32_t dp8393x_rbwc(dp8393xState *s) in dp8393x_rbwc() argument
168 return (s->regs[SONIC_RBWC1] << 16) | s->regs[SONIC_RBWC0]; in dp8393x_rbwc()
171 static uint32_t dp8393x_rrp(dp8393xState *s) in dp8393x_rrp() argument
173 return (s->regs[SONIC_URRA] << 16) | s->regs[SONIC_RRP]; in dp8393x_rrp()
176 static uint32_t dp8393x_tsa(dp8393xState *s) in dp8393x_tsa() argument
178 return (s->regs[SONIC_TSA1] << 16) | s->regs[SONIC_TSA0]; in dp8393x_tsa()
181 static uint32_t dp8393x_ttda(dp8393xState *s) in dp8393x_ttda() argument
183 return (s->regs[SONIC_UTDA] << 16) | in dp8393x_ttda()
184 (s->regs[SONIC_TTDA] & SONIC_DESC_ADDR); in dp8393x_ttda()
187 static uint32_t dp8393x_wt(dp8393xState *s) in dp8393x_wt() argument
189 return s->regs[SONIC_WT1] << 16 | s->regs[SONIC_WT0]; in dp8393x_wt()
192 static uint16_t dp8393x_get(dp8393xState *s, hwaddr addr, int offset) in dp8393x_get() argument
197 if (s->regs[SONIC_DCR] & SONIC_DCR_DW) { in dp8393x_get()
199 if (s->big_endian) { in dp8393x_get()
200 val = address_space_ldl_be(&s->as, addr, attrs, NULL); in dp8393x_get()
202 val = address_space_ldl_le(&s->as, addr, attrs, NULL); in dp8393x_get()
206 if (s->big_endian) { in dp8393x_get()
207 val = address_space_lduw_be(&s->as, addr, attrs, NULL); in dp8393x_get()
209 val = address_space_lduw_le(&s->as, addr, attrs, NULL); in dp8393x_get()
216 static void dp8393x_put(dp8393xState *s, in dp8393x_put() argument
221 if (s->regs[SONIC_DCR] & SONIC_DCR_DW) { in dp8393x_put()
223 if (s->big_endian) { in dp8393x_put()
224 address_space_stl_be(&s->as, addr, val, attrs, NULL); in dp8393x_put()
226 address_space_stl_le(&s->as, addr, val, attrs, NULL); in dp8393x_put()
230 if (s->big_endian) { in dp8393x_put()
231 address_space_stw_be(&s->as, addr, val, attrs, NULL); in dp8393x_put()
233 address_space_stw_le(&s->as, addr, val, attrs, NULL); in dp8393x_put()
238 static void dp8393x_update_irq(dp8393xState *s) in dp8393x_update_irq() argument
240 int level = (s->regs[SONIC_IMR] & s->regs[SONIC_ISR]) ? 1 : 0; in dp8393x_update_irq()
242 if (level != s->irq_level) { in dp8393x_update_irq()
243 s->irq_level = level; in dp8393x_update_irq()
245 trace_dp8393x_raise_irq(s->regs[SONIC_ISR]); in dp8393x_update_irq()
251 qemu_set_irq(s->irq, level); in dp8393x_update_irq()
254 static void dp8393x_do_load_cam(dp8393xState *s) in dp8393x_do_load_cam() argument
259 width = (s->regs[SONIC_DCR] & SONIC_DCR_DW) ? 2 : 1; in dp8393x_do_load_cam()
262 while (s->regs[SONIC_CDC] & 0x1f) { in dp8393x_do_load_cam()
264 index = dp8393x_get(s, dp8393x_cdp(s), 0) & 0xf; in dp8393x_do_load_cam()
265 s->cam[index][0] = dp8393x_get(s, dp8393x_cdp(s), 1); in dp8393x_do_load_cam()
266 s->cam[index][1] = dp8393x_get(s, dp8393x_cdp(s), 2); in dp8393x_do_load_cam()
267 s->cam[index][2] = dp8393x_get(s, dp8393x_cdp(s), 3); in dp8393x_do_load_cam()
269 s->cam[index][0] >> 8, s->cam[index][0] & 0xff, in dp8393x_do_load_cam()
270 s->cam[index][1] >> 8, s->cam[index][1] & 0xff, in dp8393x_do_load_cam()
271 s->cam[index][2] >> 8, s->cam[index][2] & 0xff); in dp8393x_do_load_cam()
273 s->regs[SONIC_CDC]--; in dp8393x_do_load_cam()
274 s->regs[SONIC_CDP] += size; in dp8393x_do_load_cam()
278 s->regs[SONIC_CE] = dp8393x_get(s, dp8393x_cdp(s), 0); in dp8393x_do_load_cam()
279 trace_dp8393x_load_cam_done(s->regs[SONIC_CE]); in dp8393x_do_load_cam()
282 s->regs[SONIC_CR] &= ~SONIC_CR_LCAM; in dp8393x_do_load_cam()
283 s->regs[SONIC_ISR] |= SONIC_ISR_LCD; in dp8393x_do_load_cam()
284 dp8393x_update_irq(s); in dp8393x_do_load_cam()
287 static void dp8393x_do_read_rra(dp8393xState *s) in dp8393x_do_read_rra() argument
292 width = (s->regs[SONIC_DCR] & SONIC_DCR_DW) ? 2 : 1; in dp8393x_do_read_rra()
296 s->regs[SONIC_CRBA0] = dp8393x_get(s, dp8393x_rrp(s), 0); in dp8393x_do_read_rra()
297 s->regs[SONIC_CRBA1] = dp8393x_get(s, dp8393x_rrp(s), 1); in dp8393x_do_read_rra()
298 s->regs[SONIC_RBWC0] = dp8393x_get(s, dp8393x_rrp(s), 2); in dp8393x_do_read_rra()
299 s->regs[SONIC_RBWC1] = dp8393x_get(s, dp8393x_rrp(s), 3); in dp8393x_do_read_rra()
300 trace_dp8393x_read_rra_regs(s->regs[SONIC_CRBA0], s->regs[SONIC_CRBA1], in dp8393x_do_read_rra()
301 s->regs[SONIC_RBWC0], s->regs[SONIC_RBWC1]); in dp8393x_do_read_rra()
304 s->regs[SONIC_RRP] += size; in dp8393x_do_read_rra()
307 if (s->regs[SONIC_RRP] == s->regs[SONIC_REA]) { in dp8393x_do_read_rra()
308 s->regs[SONIC_RRP] = s->regs[SONIC_RSA]; in dp8393x_do_read_rra()
312 if (s->regs[SONIC_RRP] == s->regs[SONIC_RWP]) { in dp8393x_do_read_rra()
313 s->regs[SONIC_ISR] |= SONIC_ISR_RBE; in dp8393x_do_read_rra()
314 dp8393x_update_irq(s); in dp8393x_do_read_rra()
318 s->last_rba_is_full = false; in dp8393x_do_read_rra()
321 static void dp8393x_do_software_reset(dp8393xState *s) in dp8393x_do_software_reset() argument
323 timer_del(s->watchdog); in dp8393x_do_software_reset()
325 s->regs[SONIC_CR] &= ~(SONIC_CR_LCAM | SONIC_CR_RRRA | SONIC_CR_TXP | in dp8393x_do_software_reset()
327 s->regs[SONIC_CR] |= SONIC_CR_RST | SONIC_CR_RXDIS; in dp8393x_do_software_reset()
330 static void dp8393x_set_next_tick(dp8393xState *s) in dp8393x_set_next_tick() argument
335 if (s->regs[SONIC_CR] & SONIC_CR_STP) { in dp8393x_set_next_tick()
336 timer_del(s->watchdog); in dp8393x_set_next_tick()
340 ticks = dp8393x_wt(s); in dp8393x_set_next_tick()
341 s->wt_last_update = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in dp8393x_set_next_tick()
343 timer_mod(s->watchdog, s->wt_last_update + delay); in dp8393x_set_next_tick()
346 static void dp8393x_update_wt_regs(dp8393xState *s) in dp8393x_update_wt_regs() argument
351 if (s->regs[SONIC_CR] & SONIC_CR_STP) { in dp8393x_update_wt_regs()
352 timer_del(s->watchdog); in dp8393x_update_wt_regs()
356 elapsed = s->wt_last_update - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); in dp8393x_update_wt_regs()
357 val = dp8393x_wt(s); in dp8393x_update_wt_regs()
359 s->regs[SONIC_WT1] = (val >> 16) & 0xffff; in dp8393x_update_wt_regs()
360 s->regs[SONIC_WT0] = (val >> 0) & 0xffff; in dp8393x_update_wt_regs()
361 dp8393x_set_next_tick(s); in dp8393x_update_wt_regs()
365 static void dp8393x_do_start_timer(dp8393xState *s) in dp8393x_do_start_timer() argument
367 s->regs[SONIC_CR] &= ~SONIC_CR_STP; in dp8393x_do_start_timer()
368 dp8393x_set_next_tick(s); in dp8393x_do_start_timer()
371 static void dp8393x_do_stop_timer(dp8393xState *s) in dp8393x_do_stop_timer() argument
373 s->regs[SONIC_CR] &= ~SONIC_CR_ST; in dp8393x_do_stop_timer()
374 dp8393x_update_wt_regs(s); in dp8393x_do_stop_timer()
379 static void dp8393x_do_receiver_enable(dp8393xState *s) in dp8393x_do_receiver_enable() argument
381 s->regs[SONIC_CR] &= ~SONIC_CR_RXDIS; in dp8393x_do_receiver_enable()
382 if (dp8393x_can_receive(s->nic->ncs)) { in dp8393x_do_receiver_enable()
383 qemu_flush_queued_packets(qemu_get_queue(s->nic)); in dp8393x_do_receiver_enable()
387 static void dp8393x_do_receiver_disable(dp8393xState *s) in dp8393x_do_receiver_disable() argument
389 s->regs[SONIC_CR] &= ~SONIC_CR_RXEN; in dp8393x_do_receiver_disable()
392 static void dp8393x_do_transmit_packets(dp8393xState *s) in dp8393x_do_transmit_packets() argument
394 NetClientState *nc = qemu_get_queue(s->nic); in dp8393x_do_transmit_packets()
400 s->regs[SONIC_TTDA] = s->regs[SONIC_CTDA]; in dp8393x_do_transmit_packets()
401 trace_dp8393x_transmit_packet(dp8393x_ttda(s)); in dp8393x_do_transmit_packets()
405 s->regs[SONIC_TCR] = dp8393x_get(s, dp8393x_ttda(s), 1) & 0xf000; in dp8393x_do_transmit_packets()
406 s->regs[SONIC_TPS] = dp8393x_get(s, dp8393x_ttda(s), 2); in dp8393x_do_transmit_packets()
407 s->regs[SONIC_TFC] = dp8393x_get(s, dp8393x_ttda(s), 3); in dp8393x_do_transmit_packets()
408 s->regs[SONIC_TSA0] = dp8393x_get(s, dp8393x_ttda(s), 4); in dp8393x_do_transmit_packets()
409 s->regs[SONIC_TSA1] = dp8393x_get(s, dp8393x_ttda(s), 5); in dp8393x_do_transmit_packets()
410 s->regs[SONIC_TFS] = dp8393x_get(s, dp8393x_ttda(s), 6); in dp8393x_do_transmit_packets()
413 if (s->regs[SONIC_TCR] & SONIC_TCR_PINT) { in dp8393x_do_transmit_packets()
414 s->regs[SONIC_ISR] |= SONIC_ISR_PINT; in dp8393x_do_transmit_packets()
416 s->regs[SONIC_ISR] &= ~SONIC_ISR_PINT; in dp8393x_do_transmit_packets()
419 for (i = 0; i < s->regs[SONIC_TFC]; ) { in dp8393x_do_transmit_packets()
421 len = s->regs[SONIC_TFS]; in dp8393x_do_transmit_packets()
422 if (tx_len + len > sizeof(s->tx_buffer)) { in dp8393x_do_transmit_packets()
423 len = sizeof(s->tx_buffer) - tx_len; in dp8393x_do_transmit_packets()
425 address_space_read(&s->as, dp8393x_tsa(s), MEMTXATTRS_UNSPECIFIED, in dp8393x_do_transmit_packets()
426 &s->tx_buffer[tx_len], len); in dp8393x_do_transmit_packets()
430 if (i != s->regs[SONIC_TFC]) { in dp8393x_do_transmit_packets()
432 s->regs[SONIC_TSA0] = dp8393x_get(s, dp8393x_ttda(s), in dp8393x_do_transmit_packets()
434 s->regs[SONIC_TSA1] = dp8393x_get(s, dp8393x_ttda(s), in dp8393x_do_transmit_packets()
436 s->regs[SONIC_TFS] = dp8393x_get(s, dp8393x_ttda(s), in dp8393x_do_transmit_packets()
442 if (!(s->regs[SONIC_TCR] & SONIC_TCR_CRCI)) { in dp8393x_do_transmit_packets()
456 if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) { in dp8393x_do_transmit_packets()
458 s->regs[SONIC_TCR] |= SONIC_TCR_CRSL; in dp8393x_do_transmit_packets()
460 s->loopback_packet = 1; in dp8393x_do_transmit_packets()
461 qemu_receive_packet(nc, s->tx_buffer, tx_len); in dp8393x_do_transmit_packets()
465 qemu_send_packet(nc, s->tx_buffer, tx_len); in dp8393x_do_transmit_packets()
467 s->regs[SONIC_TCR] |= SONIC_TCR_PTX; in dp8393x_do_transmit_packets()
470 dp8393x_put(s, dp8393x_ttda(s), 0, s->regs[SONIC_TCR] & 0x0fff); in dp8393x_do_transmit_packets()
472 if (!(s->regs[SONIC_CR] & SONIC_CR_HTX)) { in dp8393x_do_transmit_packets()
474 s->regs[SONIC_CTDA] = dp8393x_get(s, dp8393x_ttda(s), in dp8393x_do_transmit_packets()
475 4 + 3 * s->regs[SONIC_TFC]); in dp8393x_do_transmit_packets()
476 if (s->regs[SONIC_CTDA] & SONIC_DESC_EOL) { in dp8393x_do_transmit_packets()
484 s->regs[SONIC_CR] &= ~SONIC_CR_TXP; in dp8393x_do_transmit_packets()
485 s->regs[SONIC_ISR] |= SONIC_ISR_TXDN; in dp8393x_do_transmit_packets()
486 dp8393x_update_irq(s); in dp8393x_do_transmit_packets()
489 static void dp8393x_do_halt_transmission(dp8393xState *s) in dp8393x_do_halt_transmission() argument
494 static void dp8393x_do_command(dp8393xState *s, uint16_t command) in dp8393x_do_command() argument
496 if ((s->regs[SONIC_CR] & SONIC_CR_RST) && !(command & SONIC_CR_RST)) { in dp8393x_do_command()
497 s->regs[SONIC_CR] &= ~SONIC_CR_RST; in dp8393x_do_command()
501 s->regs[SONIC_CR] |= (command & SONIC_CR_MASK); in dp8393x_do_command()
504 dp8393x_do_halt_transmission(s); in dp8393x_do_command()
507 dp8393x_do_transmit_packets(s); in dp8393x_do_command()
510 dp8393x_do_receiver_disable(s); in dp8393x_do_command()
513 dp8393x_do_receiver_enable(s); in dp8393x_do_command()
516 dp8393x_do_stop_timer(s); in dp8393x_do_command()
519 dp8393x_do_start_timer(s); in dp8393x_do_command()
522 dp8393x_do_software_reset(s); in dp8393x_do_command()
525 dp8393x_do_read_rra(s); in dp8393x_do_command()
526 s->regs[SONIC_CR] &= ~SONIC_CR_RRRA; in dp8393x_do_command()
529 dp8393x_do_load_cam(s); in dp8393x_do_command()
535 dp8393xState *s = opaque; in dp8393x_read() local
536 int reg = addr >> s->it_shift; in dp8393x_read()
543 dp8393x_update_wt_regs(s); in dp8393x_read()
544 val = s->regs[reg]; in dp8393x_read()
550 if (s->regs[SONIC_CR] & SONIC_CR_RST) { in dp8393x_read()
551 val = s->cam[s->regs[SONIC_CEP] & 0xf][SONIC_CAP0 - reg]; in dp8393x_read()
556 val = s->regs[reg]; in dp8393x_read()
567 dp8393xState *s = opaque; in dp8393x_write() local
568 int reg = addr >> s->it_shift; in dp8393x_write()
575 dp8393x_do_command(s, val); in dp8393x_write()
587 if (s->regs[SONIC_CR] & SONIC_CR_RST) { in dp8393x_write()
588 s->regs[reg] = val & 0xbfff; in dp8393x_write()
594 if (s->regs[SONIC_CR] & SONIC_CR_RST) { in dp8393x_write()
595 s->regs[reg] = val & 0xf017; in dp8393x_write()
602 s->regs[reg] = val & 0xf000; in dp8393x_write()
606 s->regs[reg] = val & 0xffe0; in dp8393x_write()
610 s->regs[reg] = val & 0x7fff; in dp8393x_write()
611 dp8393x_update_irq(s); in dp8393x_write()
615 val &= s->regs[reg]; in dp8393x_write()
616 s->regs[reg] &= ~val; in dp8393x_write()
618 dp8393x_do_read_rra(s); in dp8393x_write()
620 dp8393x_update_irq(s); in dp8393x_write()
627 if (s->regs[SONIC_DCR] & SONIC_DCR_DW) { in dp8393x_write()
628 s->regs[reg] = val & 0xfffc; in dp8393x_write()
630 s->regs[reg] = val & 0xfffe; in dp8393x_write()
637 s->regs[reg] = val ^ 0xffff; in dp8393x_write()
641 s->regs[reg] = val; in dp8393x_write()
645 dp8393x_set_next_tick(s); in dp8393x_write()
664 dp8393xState *s = opaque; in dp8393x_watchdog() local
666 if (s->regs[SONIC_CR] & SONIC_CR_STP) { in dp8393x_watchdog()
670 s->regs[SONIC_WT1] = 0xffff; in dp8393x_watchdog()
671 s->regs[SONIC_WT0] = 0xffff; in dp8393x_watchdog()
672 dp8393x_set_next_tick(s); in dp8393x_watchdog()
675 s->regs[SONIC_ISR] |= SONIC_ISR_TC; in dp8393x_watchdog()
676 dp8393x_update_irq(s); in dp8393x_watchdog()
681 dp8393xState *s = qemu_get_nic_opaque(nc); in dp8393x_can_receive() local
683 return !!(s->regs[SONIC_CR] & SONIC_CR_RXEN); in dp8393x_can_receive()
686 static int dp8393x_receive_filter(dp8393xState *s, const uint8_t * buf, in dp8393x_receive_filter() argument
693 if ((s->regs[SONIC_RCR] & SONIC_RCR_PRO) && (buf[0] & 1) == 0) { in dp8393x_receive_filter()
698 if ((s->regs[SONIC_RCR] & SONIC_RCR_AMC) && (buf[0] & 1) == 1) { in dp8393x_receive_filter()
703 if ((s->regs[SONIC_RCR] & SONIC_RCR_BRD) && in dp8393x_receive_filter()
710 if (s->regs[SONIC_CE] & (1 << i)) { in dp8393x_receive_filter()
712 if (!memcmp(buf, s->cam[i], sizeof(s->cam[i]))) { in dp8393x_receive_filter()
724 dp8393xState *s = qemu_get_nic_opaque(nc); in dp8393x_receive() local
731 s->regs[SONIC_RCR] &= ~(SONIC_RCR_PRX | SONIC_RCR_LBK | SONIC_RCR_FAER | in dp8393x_receive()
734 if (s->last_rba_is_full) { in dp8393x_receive()
739 if (s->regs[SONIC_DCR] & SONIC_DCR_DW) { in dp8393x_receive()
745 if (padded_len > dp8393x_rbwc(s) * 2) { in dp8393x_receive()
747 s->regs[SONIC_ISR] |= SONIC_ISR_RBAE; in dp8393x_receive()
748 dp8393x_update_irq(s); in dp8393x_receive()
749 s->regs[SONIC_RCR] |= SONIC_RCR_LPKT; in dp8393x_receive()
753 packet_type = dp8393x_receive_filter(s, buf, pkt_size); in dp8393x_receive()
760 if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) { in dp8393x_receive()
762 s->regs[SONIC_LLFA] = dp8393x_get(s, dp8393x_crda(s), 5); in dp8393x_receive()
763 if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) { in dp8393x_receive()
770 dp8393x_put(s, dp8393x_crda(s), 6, 0x0000); in dp8393x_receive()
773 s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA]; in dp8393x_receive()
774 s->regs[SONIC_ISR] |= SONIC_ISR_PKTRX; in dp8393x_receive()
778 s->regs[SONIC_TRBA1] = s->regs[SONIC_CRBA1]; in dp8393x_receive()
779 s->regs[SONIC_TRBA0] = s->regs[SONIC_CRBA0]; in dp8393x_receive()
785 trace_dp8393x_receive_packet(dp8393x_crba(s)); in dp8393x_receive()
786 address = dp8393x_crba(s); in dp8393x_receive()
787 address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED, in dp8393x_receive()
792 address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED, in dp8393x_receive()
799 address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED, in dp8393x_receive()
804 s->regs[SONIC_CRBA1] = address >> 16; in dp8393x_receive()
805 s->regs[SONIC_CRBA0] = address & 0xffff; in dp8393x_receive()
806 available = dp8393x_rbwc(s); in dp8393x_receive()
808 s->regs[SONIC_RBWC1] = available >> 16; in dp8393x_receive()
809 s->regs[SONIC_RBWC0] = available & 0xffff; in dp8393x_receive()
812 if (dp8393x_rbwc(s) < s->regs[SONIC_EOBC]) { in dp8393x_receive()
813 s->regs[SONIC_RCR] |= SONIC_RCR_LPKT; in dp8393x_receive()
815 s->regs[SONIC_RCR] |= packet_type; in dp8393x_receive()
816 s->regs[SONIC_RCR] |= SONIC_RCR_PRX; in dp8393x_receive()
817 if (s->loopback_packet) { in dp8393x_receive()
818 s->regs[SONIC_RCR] |= SONIC_RCR_LBK; in dp8393x_receive()
819 s->loopback_packet = 0; in dp8393x_receive()
823 trace_dp8393x_receive_write_status(dp8393x_crda(s)); in dp8393x_receive()
824 dp8393x_put(s, dp8393x_crda(s), 0, s->regs[SONIC_RCR]); /* status */ in dp8393x_receive()
825 dp8393x_put(s, dp8393x_crda(s), 1, rx_len); /* byte count */ in dp8393x_receive()
826 dp8393x_put(s, dp8393x_crda(s), 2, s->regs[SONIC_TRBA0]); /* pkt_ptr0 */ in dp8393x_receive()
827 dp8393x_put(s, dp8393x_crda(s), 3, s->regs[SONIC_TRBA1]); /* pkt_ptr1 */ in dp8393x_receive()
828 dp8393x_put(s, dp8393x_crda(s), 4, s->regs[SONIC_RSC]); /* seq_no */ in dp8393x_receive()
831 s->regs[SONIC_LLFA] = dp8393x_get(s, dp8393x_crda(s), 5); in dp8393x_receive()
832 if (s->regs[SONIC_LLFA] & SONIC_DESC_EOL) { in dp8393x_receive()
834 s->regs[SONIC_ISR] |= SONIC_ISR_RDE; in dp8393x_receive()
837 dp8393x_put(s, dp8393x_crda(s), 6, 0x0000); in dp8393x_receive()
840 s->regs[SONIC_CRDA] = s->regs[SONIC_LLFA]; in dp8393x_receive()
841 s->regs[SONIC_ISR] |= SONIC_ISR_PKTRX; in dp8393x_receive()
844 dp8393x_update_irq(s); in dp8393x_receive()
846 s->regs[SONIC_RSC] = (s->regs[SONIC_RSC] & 0xff00) | in dp8393x_receive()
847 ((s->regs[SONIC_RSC] + 1) & 0x00ff); in dp8393x_receive()
851 if (s->regs[SONIC_RCR] & SONIC_RCR_LPKT) { in dp8393x_receive()
852 if (s->regs[SONIC_RRP] == s->regs[SONIC_RWP]) { in dp8393x_receive()
854 s->last_rba_is_full = true; in dp8393x_receive()
857 dp8393x_do_read_rra(s); in dp8393x_receive()
866 dp8393xState *s = DP8393X(dev); in dp8393x_reset() local
867 timer_del(s->watchdog); in dp8393x_reset()
869 memset(s->regs, 0, sizeof(s->regs)); in dp8393x_reset()
870 s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux/mips */ in dp8393x_reset()
871 s->regs[SONIC_CR] = SONIC_CR_RST | SONIC_CR_STP | SONIC_CR_RXDIS; in dp8393x_reset()
872 s->regs[SONIC_DCR] &= ~(SONIC_DCR_EXBUS | SONIC_DCR_LBR); in dp8393x_reset()
873 s->regs[SONIC_RCR] &= ~(SONIC_RCR_LB0 | SONIC_RCR_LB1 | SONIC_RCR_BRD | in dp8393x_reset()
875 s->regs[SONIC_TCR] |= SONIC_TCR_NCRS | SONIC_TCR_PTX; in dp8393x_reset()
876 s->regs[SONIC_TCR] &= ~SONIC_TCR_BCM; in dp8393x_reset()
877 s->regs[SONIC_IMR] = 0; in dp8393x_reset()
878 s->regs[SONIC_ISR] = 0; in dp8393x_reset()
879 s->regs[SONIC_DCR2] = 0; in dp8393x_reset()
880 s->regs[SONIC_EOBC] = 0x02F8; in dp8393x_reset()
881 s->regs[SONIC_RSC] = 0; in dp8393x_reset()
882 s->regs[SONIC_CE] = 0; in dp8393x_reset()
883 s->regs[SONIC_RSC] = 0; in dp8393x_reset()
886 s->regs[SONIC_RCR] |= SONIC_RCR_CRS; in dp8393x_reset()
888 dp8393x_update_irq(s); in dp8393x_reset()
901 dp8393xState *s = DP8393X(obj); in dp8393x_instance_init() local
903 sysbus_init_mmio(sbd, &s->mmio); in dp8393x_instance_init()
904 sysbus_init_irq(sbd, &s->irq); in dp8393x_instance_init()
909 dp8393xState *s = DP8393X(dev); in dp8393x_realize() local
911 address_space_init(&s->as, s->dma_mr, "dp8393x"); in dp8393x_realize()
912 memory_region_init_io(&s->mmio, OBJECT(dev), &dp8393x_ops, s, in dp8393x_realize()
913 "dp8393x-regs", SONIC_REG_COUNT << s->it_shift); in dp8393x_realize()
915 s->nic = qemu_new_nic(&net_dp83932_info, &s->conf, in dp8393x_realize()
917 &dev->mem_reentrancy_guard, s); in dp8393x_realize()
918 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); in dp8393x_realize()
920 s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); in dp8393x_realize()