Changeset 705b65ea in mainline
- Timestamp:
- 2024-07-11T11:29:43Z (6 months ago)
- Branches:
- master
- Children:
- 994f87b
- Parents:
- f77ede10
- Location:
- uspace/drv/block/pc-floppy
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/block/pc-floppy/main.c
rf77ede10 r705b65ea 105 105 106 106 /* IRQ */ 107 ddf_msg(LVL_NOTE, "irqs count=%zu", hw_res.irqs.count);108 107 if (hw_res.irqs.count > 0) { 109 ddf_msg(LVL_NOTE, "set IRQ=%u", hw_res.irqs.irqs[0]);110 108 res->irq = hw_res.irqs.irqs[0]; 111 109 } else { 112 ddf_msg(LVL_NOTE, "set IRQ=-1");113 110 res->irq = -1; 114 111 } -
uspace/drv/block/pc-floppy/pc-floppy.c
rf77ede10 r705b65ea 165 165 rc = pc_fdc_init_irq(fdc); 166 166 if (rc != EOK) { 167 ddf_msg(LVL_ NOTE, "Init IRQ failed");167 ddf_msg(LVL_ERROR, "Init IRQ failed"); 168 168 return rc; 169 169 } … … 179 179 AS_AREA_WRITE | AS_AREA_READ, 0, &fdc->dma_buf_pa, &buffer); 180 180 if (rc != EOK) { 181 ddf_msg(LVL_ NOTE, "Failed allocating PRD table.");181 ddf_msg(LVL_ERROR, "Failed allocating PRD table."); 182 182 goto error; 183 183 } … … 185 185 fdc->dma_buf = buffer; 186 186 187 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: reset controller...");187 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: reset controller..."); 188 188 (void)pc_fdc_reset(fdc); 189 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: read_ID..");190 191 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: MSR=0x%x",189 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: read_ID.."); 190 191 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: MSR=0x%x", 192 192 pio_read_8(&fdc->regs->msr)); 193 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: DIR=0x%x",193 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: DIR=0x%x", 194 194 pio_read_8(&fdc->regs->dir)); 195 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: SRA=0x%x",195 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: SRA=0x%x", 196 196 pio_read_8(&fdc->regs->sra)); 197 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: SRB=0x%x",197 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: SRB=0x%x", 198 198 pio_read_8(&fdc->regs->srb)); 199 199 … … 213 213 /* Read ID MFM, D0, H0 */ 214 214 rc = pc_fdc_read_id(fdc, true, 0, 0); 215 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: read_ID -> %d", rc);215 ddf_msg(LVL_DEBUG, "pc_fdc_ctrl_init: read_ID -> %d", rc); 216 216 217 217 rc = pc_fdc_drive_create(fdc, 0, &fdc->drive[0]); 218 218 if (rc != EOK) { 219 ddf_msg(LVL_ NOTE, "pc_fdc_ctrl_init: pc_fdc_drive_create "219 ddf_msg(LVL_ERROR, "pc_fdc_ctrl_init: pc_fdc_drive_create " 220 220 "failed"); 221 221 goto error; … … 454 454 bound = true; 455 455 456 #if 0 456 457 rc = ddf_fun_add_to_category(fun, "partition"); 457 458 if (rc != EOK) { … … 460 461 goto error; 461 462 } 463 #endif 462 464 463 465 free(fun_name); … … 497 499 498 500 status = pio_read_8(&fdc->regs->msr); 499 ddf_msg(LVL_ NOTE, "pc_fdc_send_byte: status=0x%x", status);501 ddf_msg(LVL_DEBUG, "pc_fdc_send_byte: status=0x%x", status); 500 502 do { 501 503 cnt = msr_read_cycles; … … 513 515 stopwatch_stop(&sw); 514 516 nsec = stopwatch_get_nanos(&sw); 515 ddf_msg(LVL_ NOTE, "nsec=%lld", nsec);517 ddf_msg(LVL_DEBUG, "nsec=%lld", nsec); 516 518 } while (nsec < 1000 * msr_max_wait_usec); 517 519 518 ddf_msg(LVL_ NOTE, "pc_fdc_send_byte: FAILED (status=0x%x)", status);520 ddf_msg(LVL_ERROR, "pc_fdc_send_byte: FAILED (status=0x%x)", status); 519 521 return EIO; 520 522 } … … 541 543 542 544 status = pio_read_8(&fdc->regs->msr); 543 ddf_msg(LVL_ NOTE, "pc_fdc_send: final status=0x%x", status);545 ddf_msg(LVL_DEBUG, "pc_fdc_send: final status=0x%x", status); 544 546 return EOK; 545 547 } … … 567 569 568 570 status = pio_read_8(&fdc->regs->msr); 569 ddf_msg(LVL_ NOTE, "pc_fdc_get_byte: status=0x%x", status);571 ddf_msg(LVL_DEBUG, "pc_fdc_get_byte: status=0x%x", status); 570 572 do { 571 573 cnt = msr_read_cycles; … … 585 587 } while (nsec / 1000 < 1000 * msr_max_wait_usec); 586 588 587 ddf_msg(LVL_ NOTE, "pc_fdc_get_byte: FAILED (status=0x%x)", status);589 ddf_msg(LVL_ERROR, "pc_fdc_get_byte: FAILED (status=0x%x)", status); 588 590 return EIO; 589 591 } … … 606 608 rc = pc_fdc_get_byte(fdc, &((uint8_t *)buf)[i]); 607 609 if (rc != EOK) { 608 ddf_msg(LVL_ NOTE, "pc_fdc_get: abort after "610 ddf_msg(LVL_ERROR, "pc_fdc_get: abort after " 609 611 "reading %zu bytes", i); 610 612 return rc; … … 612 614 } 613 615 614 ddf_msg(LVL_ NOTE, "pc_fdc_get: successfully read %zu bytes", i);616 ddf_msg(LVL_DEBUG, "pc_fdc_get: successfully read %zu bytes", i); 615 617 status = pio_read_8(&fdc->regs->msr); 616 ddf_msg(LVL_ NOTE, "pc_fdc_get: final status=0x%x", status);618 ddf_msg(LVL_DEBUG, "pc_fdc_get: final status=0x%x", status); 617 619 return EOK; 618 620 } … … 632 634 /* Clear DOR reset in case it was set (i.e., nreset := 1) */ 633 635 dor = pio_read_8(&fdc->regs->dor); 634 ddf_msg(LVL_ NOTE, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor,636 ddf_msg(LVL_DEBUG, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor, 635 637 dor & ~fdor_nreset); 636 638 pio_write_8(&fdc->regs->dor, dor & ~fdor_nreset); 637 639 638 640 dor = pio_read_8(&fdc->regs->dor); 639 ddf_msg(LVL_ NOTE, "pc_fdc_reset: read DOR: value= 0x%x", dor);641 ddf_msg(LVL_DEBUG, "pc_fdc_reset: read DOR: value= 0x%x", dor); 640 642 641 643 fibril_usleep(4); 642 644 643 ddf_msg(LVL_ NOTE, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor,645 ddf_msg(LVL_DEBUG, "pc_fdc_reset: old DOR=0x%x, DOR := 0x%x", dor, 644 646 dor | fdor_nreset | fdor_ndmagate); 645 647 pio_write_8(&fdc->regs->dor, dor | fdor_nreset | fdor_ndmagate); 646 648 647 649 dor = pio_read_8(&fdc->regs->dor); 648 ddf_msg(LVL_ NOTE, "pc_fdc_reset: read DOR: value= 0x%x", dor);650 ddf_msg(LVL_DEBUG, "pc_fdc_reset: read DOR: value= 0x%x", dor); 649 651 650 652 return EOK; … … 669 671 670 672 dor = pio_read_8(&fdc->regs->dor); 671 ddf_msg(LVL_ NOTE, "pc_fdc_read_id: read DOR: value= 0x%x", dor);673 ddf_msg(LVL_DEBUG, "pc_fdc_read_id: read DOR: value= 0x%x", dor); 672 674 673 675 dor |= fdor_me0; /* turn drive 0 motor on */ 674 676 dor = (dor & ~0x03) | 0x00; /* select drive 0 */ 675 677 pio_write_8(&fdc->regs->dor, dor); 676 ddf_msg(LVL_ NOTE, "pc_fdc_read_id: DOR := 0x%x", dor);678 ddf_msg(LVL_DEBUG, "pc_fdc_read_id: DOR := 0x%x", dor); 677 679 678 680 dor = pio_read_8(&fdc->regs->dor); 679 ddf_msg(LVL_ NOTE, "pc_fdc_read_id: read DOR: value= 0x%x", dor);681 ddf_msg(LVL_DEBUG, "pc_fdc_read_id: read DOR: value= 0x%x", dor); 680 682 681 683 /* 500 ms to let drive spin up */ … … 685 687 cmd.hd_us = 0x00; 686 688 687 ddf_msg(LVL_ NOTE, "read ID: send");689 ddf_msg(LVL_DEBUG, "read ID: send"); 688 690 rc = pc_fdc_send(fdc, &cmd, sizeof(cmd)); 689 691 if (rc != EOK) { … … 692 694 } 693 695 694 ddf_msg(LVL_ NOTE, "read ID: get");696 ddf_msg(LVL_DEBUG, "read ID: get"); 695 697 rc = pc_fdc_get(fdc, &status, sizeof(status)); 696 698 if (rc != EOK) { … … 699 701 } 700 702 701 ddf_msg(LVL_ NOTE, "read ID: DONE");702 ddf_msg(LVL_ NOTE, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "703 ddf_msg(LVL_DEBUG, "read ID: DONE"); 704 ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u " 703 705 "number=%u", status.st0, status.st1, status.st2, 704 706 status.cyl, status.head, status.rec, status.number); … … 732 734 errno_t rc; 733 735 734 ddf_msg(LVL_ NOTE, "pc_fdc_drive_read_data");736 ddf_msg(LVL_DEBUG, "pc_fdc_drive_read_data"); 735 737 736 738 memset(fdc->dma_buf, 0, fdc->dma_buf_size); 737 739 738 740 sess = ddf_dev_parent_sess_get(fdc->dev); 739 ddf_msg(LVL_ NOTE, "hw_res_dma_channel_setup(sess=%p, chan=%d "741 ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup(sess=%p, chan=%d " 740 742 "pa=%lu size=%zu", sess, fdc->dma, fdc->dma_buf_pa, 741 743 fdc->dma_buf_size); … … 743 745 fdc->dma_buf_size, DMA_MODE_READ | DMA_MODE_AUTO | 744 746 DMA_MODE_ON_DEMAND); 745 ddf_msg(LVL_ NOTE, "hw_res_dma_channel_setup->%d", rc);747 ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup->%d", rc); 746 748 747 749 cmd.flags_cc = fcf_mf | fcc_read_data; … … 755 757 cmd.dtl = 0xff; 756 758 757 ddf_msg(LVL_ NOTE, "read data: send");759 ddf_msg(LVL_DEBUG, "read data: send"); 758 760 rc = pc_fdc_send(fdc, &cmd, sizeof(cmd)); 759 761 if (rc != EOK) { … … 762 764 } 763 765 764 ddf_msg(LVL_ NOTE, "read data: get");766 ddf_msg(LVL_DEBUG, "read data: get"); 765 767 rc = pc_fdc_get(fdc, &status, sizeof(status)); 766 768 if (rc != EOK) { … … 769 771 } 770 772 771 ddf_msg(LVL_ NOTE, "read data: DONE");772 ddf_msg(LVL_ NOTE, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "773 ddf_msg(LVL_DEBUG, "read data: DONE"); 774 ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u " 773 775 "number=%u", status.st0, status.st1, status.st2, 774 776 status.cyl, status.head, status.rec, status.number); … … 806 808 errno_t rc; 807 809 808 ddf_msg(LVL_ NOTE, "pc_fdc_drive_write_data");810 ddf_msg(LVL_DEBUG, "pc_fdc_drive_write_data"); 809 811 810 812 /* Copy data from source buffer to DMA buffer */ … … 813 815 814 816 sess = ddf_dev_parent_sess_get(fdc->dev); 815 ddf_msg(LVL_ NOTE, "hw_res_dma_channel_setup(sess=%p, chan=%d "817 ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup(sess=%p, chan=%d " 816 818 "pa=%lu size=%zu", sess, fdc->dma, fdc->dma_buf_pa, 817 819 fdc->dma_buf_size); … … 819 821 fdc->dma_buf_size, DMA_MODE_WRITE | DMA_MODE_AUTO | 820 822 DMA_MODE_ON_DEMAND); 821 ddf_msg(LVL_ NOTE, "hw_res_dma_channel_setup->%d", rc);823 ddf_msg(LVL_DEBUG, "hw_res_dma_channel_setup->%d", rc); 822 824 823 825 cmd.flags_cc = fcf_mf | fcc_write_data; … … 831 833 cmd.dtl = 0xff; 832 834 833 ddf_msg(LVL_ NOTE, "write data: send");835 ddf_msg(LVL_DEBUG, "write data: send"); 834 836 rc = pc_fdc_send(fdc, &cmd, sizeof(cmd)); 835 837 if (rc != EOK) { … … 838 840 } 839 841 840 ddf_msg(LVL_ NOTE, "write data: get");842 ddf_msg(LVL_DEBUG, "write data: get"); 841 843 rc = pc_fdc_get(fdc, &status, sizeof(status)); 842 844 if (rc != EOK) { … … 845 847 } 846 848 847 ddf_msg(LVL_ NOTE, "write data: DONE");848 ddf_msg(LVL_ NOTE, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u "849 ddf_msg(LVL_DEBUG, "write data: DONE"); 850 ddf_msg(LVL_DEBUG, "st0=0x%x st1=0x%x st2=0x%x cyl=%u head=%u rec=%u " 849 851 "number=%u", status.st0, status.st1, status.st2, 850 852 status.cyl, status.head, status.rec, status.number); … … 874 876 cmd.cc = fcc_sense_int_sts; 875 877 876 ddf_msg(LVL_ NOTE, "Sense Interrupt Status: send");878 ddf_msg(LVL_DEBUG, "Sense Interrupt Status: send"); 877 879 rc = pc_fdc_send(fdc, &cmd, sizeof(cmd)); 878 880 if (rc != EOK) { … … 882 884 } 883 885 884 ddf_msg(LVL_ NOTE, "Sense Interrupt Status: get");886 ddf_msg(LVL_DEBUG, "Sense Interrupt Status: get"); 885 887 rc = pc_fdc_get(fdc, &status, sizeof(status)); 886 888 if (rc != EOK) { … … 890 892 } 891 893 892 ddf_msg(LVL_ NOTE, "Sense Interrupt Status: DONE");893 ddf_msg(LVL_ NOTE, "st0=0x%x pcn=0x%x", status.st0, status.pcn);894 ddf_msg(LVL_DEBUG, "Sense Interrupt Status: DONE"); 895 ddf_msg(LVL_DEBUG, "st0=0x%x pcn=0x%x", status.st0, status.pcn); 894 896 895 897 return EOK; … … 916 918 h = ipc_get_arg5(call); 917 919 n = ipc_get_imethod(call); 918 ddf_msg(LVL_ NOTE, "pc_fdc_irq_handler st0=%x st1=%x st2=%x c=%u h=%u n=%u",920 ddf_msg(LVL_DEBUG, "pc_fdc_irq_handler st0=%x st1=%x st2=%x c=%u h=%u n=%u", 919 921 st0, st1, st2, c, h, n); 920 922 … … 990 992 errno_t rc; 991 993 992 ddf_msg(LVL_ NOTE, "pc_fdc_bd_read_blocks");994 ddf_msg(LVL_DEBUG, "pc_fdc_bd_read_blocks"); 993 995 994 996 if (size < cnt * drive->sec_size) { … … 1013 1015 return EOK; 1014 1016 error: 1015 ddf_msg(LVL_ NOTE, "pc_fdc_bd_read_blocks: rc=%d", rc);1017 ddf_msg(LVL_ERROR, "pc_fdc_bd_read_blocks: rc=%d", rc); 1016 1018 return rc; 1017 1019 } … … 1048 1050 errno_t rc; 1049 1051 1050 ddf_msg(LVL_ NOTE, "pc_fdc_bd_write_blocks");1052 ddf_msg(LVL_DEBUG, "pc_fdc_bd_write_blocks"); 1051 1053 1052 1054 if (size < cnt * drive->sec_size) { … … 1071 1073 return EOK; 1072 1074 error: 1073 ddf_msg(LVL_ NOTE, "pc_fdc_bd_write_blocks: rc=%d", rc);1075 ddf_msg(LVL_ERROR, "pc_fdc_bd_write_blocks: rc=%d", rc); 1074 1076 return rc; 1075 1077 }
Note:
See TracChangeset
for help on using the changeset viewer.