Rev 6229 | Rev 6711 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6229 | Rev 6682 | ||
---|---|---|---|
Line 368... | Line 368... | ||
368 | mov eax, edi ; Application wants it in eax instead |
368 | mov eax, edi ; Application wants it in eax instead |
369 | DEBUGF 1, "Kernel says: %u\n", eax |
369 | DEBUGF 1, "Kernel says: %u\n", eax |
370 | ret |
370 | ret |
Line 371... | Line 371... | ||
371 | 371 | ||
372 | ; If an error occured, remove all allocated data and exit (returning -1 in eax) |
- | |
373 | 372 | ; If an error occured, remove all allocated data and exit (returning -1 in eax) |
|
374 | .destroy: |
373 | .destroy: |
- | 374 | ; unregister device from device_list |
|
375 | ; todo: unregister device from device_list |
375 | mov eax, [devices] |
- | 376 | mov dword[device_list-4+4*eax], 0 |
|
Line 376... | Line 377... | ||
376 | ; todo: reset device into virgin state |
377 | dec [devices] |
377 | 378 | ||
378 | .err: |
379 | .err: |
379 | DEBUGF 2, "Error, removing all data !\n" |
380 | DEBUGF 2, "Error, removing all data !\n" |
Line 506... | Line 507... | ||
506 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
507 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 507... | Line 508... | ||
507 | 508 | ||
508 | reset: |
509 | reset: |
Line 509... | Line -... | ||
509 | DEBUGF 1, "Reset\n" |
- | |
510 | - | ||
511 | ; attach int handler |
- | |
512 | movzx eax, [ebx + device.irq_line] |
- | |
513 | DEBUGF 1, "Attaching int handler to irq %x\n", eax:1 |
- | |
514 | invoke AttachIntHandler, eax, int_handler, ebx |
- | |
515 | test eax, eax |
- | |
516 | jnz @f |
- | |
517 | DEBUGF 2, "Could not attach int handler!\n" |
- | |
518 | or eax, -1 |
- | |
519 | ret |
- | |
520 | @@: |
510 | DEBUGF 1, "Reset\n" |
521 | 511 | ||
522 | ; reset chip |
512 | ; reset chip |
523 | DEBUGF 1, "Resetting chip\n" |
513 | DEBUGF 1, "Resetting chip\n" |
524 | set_io [ebx + device.io_addr], 0 |
514 | set_io [ebx + device.io_addr], 0 |
Line 531... | Line 521... | ||
531 | test al, 1 shl BIT_RST |
521 | test al, 1 shl BIT_RST |
532 | jz .reset_completed ; RST remains 1 during reset |
522 | jz .reset_completed ; RST remains 1 during reset |
533 | dec cx |
523 | dec cx |
534 | jns .wait_for_reset |
524 | jns .wait_for_reset |
535 | DEBUGF 2, "Reset timeout!\n" |
525 | DEBUGF 2, "Reset timeout!\n" |
- | 526 | or eax, -1 |
|
- | 527 | ret |
|
536 | .reset_completed: |
528 | .reset_completed: |
Line 537... | Line 529... | ||
537 | 529 | ||
538 | ; Read MAC address |
530 | ; Read MAC address |
Line -... | Line 531... | ||
- | 531 | call read_mac |
|
- | 532 | ||
- | 533 | ; attach int handler |
|
- | 534 | movzx eax, [ebx + device.irq_line] |
|
- | 535 | DEBUGF 1, "Attaching int handler to irq %x\n", eax:1 |
|
- | 536 | invoke AttachIntHandler, eax, int_handler, ebx |
|
- | 537 | test eax, eax |
|
- | 538 | jnz @f |
|
- | 539 | DEBUGF 2, "Could not attach int handler!\n" |
|
- | 540 | or eax, -1 |
|
- | 541 | ret |
|
539 | call read_mac |
542 | @@: |
540 | 543 | ||
541 | ; unlock config and BMCR registers |
544 | ; unlock config and BMCR registers |
542 | set_io [ebx + device.io_addr], 0 |
545 | set_io [ebx + device.io_addr], 0 |
543 | set_io [ebx + device.io_addr], REG_9346CR |
546 | set_io [ebx + device.io_addr], REG_9346CR |