Lines Matching defs:pbBuf

1085 DECLINLINE(void) ataH2BE_U16(uint8_t *pbBuf, uint16_t val)
1087 pbBuf[0] = val >> 8;
1088 pbBuf[1] = val;
1092 DECLINLINE(void) ataH2BE_U24(uint8_t *pbBuf, uint32_t val)
1094 pbBuf[0] = val >> 16;
1095 pbBuf[1] = val >> 8;
1096 pbBuf[2] = val;
1100 DECLINLINE(void) ataH2BE_U32(uint8_t *pbBuf, uint32_t val)
1102 pbBuf[0] = val >> 24;
1103 pbBuf[1] = val >> 16;
1104 pbBuf[2] = val >> 8;
1105 pbBuf[3] = val;
1109 DECLINLINE(uint16_t) ataBE2H_U16(const uint8_t *pbBuf)
1111 return (pbBuf[0] << 8) | pbBuf[1];
1115 DECLINLINE(uint32_t) ataBE2H_U24(const uint8_t *pbBuf)
1117 return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2];
1121 DECLINLINE(uint32_t) ataBE2H_U32(const uint8_t *pbBuf)
1123 return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3];
1127 DECLINLINE(void) ataLBA2MSF(uint8_t *pbBuf, uint32_t iATAPILBA)
1130 pbBuf[0] = (iATAPILBA / 75) / 60;
1131 pbBuf[1] = (iATAPILBA / 75) % 60;
1132 pbBuf[2] = iATAPILBA % 75;
1136 DECLINLINE(uint32_t) ataMSF2LBA(const uint8_t *pbBuf)
1138 return (pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2];
1878 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
1883 *pbBuf++ = 0x00;
1884 memset(pbBuf, 0xff, 10);
1885 pbBuf += 10;
1886 *pbBuf++ = 0x00;
1888 ataLBA2MSF(pbBuf, i);
1889 pbBuf += 3;
1890 *pbBuf++ = 0x01; /* mode 1 data */
1892 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)i * 2048, pbBuf, 2048);
1895 pbBuf += 2048;
1902 memset(pbBuf, 0, 280);
1903 pbBuf += 280;
2022 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2094 rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, pbBuf, &cbCurrTX, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);
2098 pbBuf += s->cbATAPISector * cReqSectors;
2416 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2420 ataH2BE_U32(pbBuf, s->cTotalSectors - 1);
2421 ataH2BE_U32(pbBuf + 4, 2048);
2430 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2434 memset(pbBuf, '\0', 34);
2435 ataH2BE_U16(pbBuf, 32);
2436 pbBuf[2] = (0 << 4) | (3 << 2) | (2 << 0); /* not erasable, complete session, complete disc */
2437 pbBuf[3] = 1; /* number of first track */
2438 pbBuf[4] = 1; /* number of sessions (LSB) */
2439 pbBuf[5] = 1; /* first track number in last session (LSB) */
2440 pbBuf[6] = 1; /* last track number in last session (LSB) */
2441 pbBuf[7] = (0 << 7) | (0 << 6) | (1 << 5) | (0 << 2) | (0 << 0); /* disc id not valid, disc bar code not valid, unrestricted use, not dirty, not RW medium */
2442 pbBuf[8] = 0; /* disc type = CD-ROM */
2443 pbBuf[9] = 0; /* number of sessions (MSB) */
2444 pbBuf[10] = 0; /* number of sessions (MSB) */
2445 pbBuf[11] = 0; /* number of sessions (MSB) */
2446 ataH2BE_U32(pbBuf + 16, 0x00ffffff); /* last session lead-in start time is not available */
2447 ataH2BE_U32(pbBuf + 20, 0x00ffffff); /* last possible start time for lead-out is not available */
2456 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2466 memset(pbBuf, '\0', 36);
2467 ataH2BE_U16(pbBuf, 34);
2468 pbBuf[2] = 1; /* track number (LSB) */
2469 pbBuf[3] = 1; /* session number (LSB) */
2470 pbBuf[5] = (0 << 5) | (0 << 4) | (4 << 0); /* not damaged, primary copy, data track */
2471 pbBuf[6] = (0 << 7) | (0 << 6) | (0 << 5) | (0 << 6) | (1 << 0); /* not reserved track, not blank, not packet writing, not fixed packet, data mode 1 */
2472 pbBuf[7] = (0 << 1) | (0 << 0); /* last recorded address not valid, next recordable address not valid */
2473 ataH2BE_U32(pbBuf + 8, 0); /* track start address is 0 */
2474 ataH2BE_U32(pbBuf + 24, s->cTotalSectors); /* track size */
2475 pbBuf[32] = 0; /* track number (MSB) */
2476 pbBuf[33] = 0; /* session number (MSB) */
2482 static uint32_t atapiGetConfigurationFillFeatureListProfiles(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2487 ataH2BE_U16(pbBuf, 0x0); /* feature 0: list of profiles supported */
2488 pbBuf[2] = (0 << 2) | (1 << 1) | (1 << 0); /* version 0, persistent, current */
2489 pbBuf[3] = 8; /* additional bytes for profiles */
2492 ataH2BE_U16(pbBuf + 4, 0x10); /* profile: read-only DVD */
2493 pbBuf[6] = (0 << 0); /* NOT current profile */
2494 ataH2BE_U16(pbBuf + 8, 0x08); /* profile: read only CD */
2495 pbBuf[10] = (1 << 0); /* current profile */
2500 static uint32_t atapiGetConfigurationFillFeatureCore(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2505 ataH2BE_U16(pbBuf, 0x1); /* feature 0001h: Core Feature */
2506 pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2507 pbBuf[3] = 8; /* Additional length */
2508 ataH2BE_U16(pbBuf + 4, 0x00000002); /* Physical interface ATAPI. */
2509 pbBuf[8] = RT_BIT(0); /* DBE */
2515 static uint32_t atapiGetConfigurationFillFeatureMorphing(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2520 ataH2BE_U16(pbBuf, 0x2); /* feature 0002h: Morphing Feature */
2521 pbBuf[2] = (0x1 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2522 pbBuf[3] = 4; /* Additional length */
2523 pbBuf[4] = RT_BIT(1) | 0x0; /* OCEvent | !ASYNC */
2529 static uint32_t atapiGetConfigurationFillFeatureRemovableMedium(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2534 ataH2BE_U16(pbBuf, 0x3); /* feature 0003h: Removable Medium Feature */
2535 pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2536 pbBuf[3] = 4; /* Additional length */
2538 pbBuf[4] = (0x2 << 5) | RT_BIT(4) | RT_BIT(3) | (0x0 << 2) | (0x0 << 1) | RT_BIT(0);
2544 static uint32_t atapiGetConfigurationFillFeatureRandomReadable(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2549 ataH2BE_U16(pbBuf, 0x10); /* feature 0010h: Random Readable Feature */
2550 pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2551 pbBuf[3] = 8; /* Additional length */
2552 ataH2BE_U32(pbBuf + 4, 2048); /* Logical block size. */
2553 ataH2BE_U16(pbBuf + 8, 0x10); /* Blocking (0x10 for DVD, CD is not defined). */
2554 pbBuf[10] = 0; /* PP not present */
2560 static uint32_t atapiGetConfigurationFillFeatureCDRead(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2565 ataH2BE_U16(pbBuf, 0x1e); /* feature 001Eh: CD Read Feature */
2566 pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2567 pbBuf[3] = 0; /* Additional length */
2568 pbBuf[4] = (0x0 << 7) | (0x0 << 1) | 0x0; /* !DAP | !C2-Flags | !CD-Text. */
2574 static uint32_t atapiGetConfigurationFillFeaturePowerManagement(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2579 ataH2BE_U16(pbBuf, 0x100); /* feature 0100h: Power Management Feature */
2580 pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2581 pbBuf[3] = 0; /* Additional length */
2586 static uint32_t atapiGetConfigurationFillFeatureTimeout(ATADevState *s, uint8_t *pbBuf, size_t cbBuf)
2591 ataH2BE_U16(pbBuf, 0x105); /* feature 0105h: Timeout Feature */
2592 pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
2593 pbBuf[3] = 4; /* Additional length */
2594 pbBuf[4] = 0x0; /* !Group3 */
2601 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2614 memset(pbBuf, '\0', cbBuf);
2618 ataH2BE_U16(pbBuf + 6, 0x08); /* current profile: read-only CD */
2620 ataH2BE_U16(pbBuf + 6, 0x00); /* current profile: none -> no media */
2622 pbBuf += 8;
2624 cbCopied = atapiGetConfigurationFillFeatureListProfiles(s, pbBuf, cbBuf);
2626 pbBuf += cbCopied;
2628 cbCopied = atapiGetConfigurationFillFeatureCore(s, pbBuf, cbBuf);
2630 pbBuf += cbCopied;
2632 cbCopied = atapiGetConfigurationFillFeatureMorphing(s, pbBuf, cbBuf);
2634 pbBuf += cbCopied;
2636 cbCopied = atapiGetConfigurationFillFeatureRemovableMedium(s, pbBuf, cbBuf);
2638 pbBuf += cbCopied;
2640 cbCopied = atapiGetConfigurationFillFeatureRandomReadable(s, pbBuf, cbBuf);
2642 pbBuf += cbCopied;
2644 cbCopied = atapiGetConfigurationFillFeatureCDRead(s, pbBuf, cbBuf);
2646 pbBuf += cbCopied;
2648 cbCopied = atapiGetConfigurationFillFeaturePowerManagement(s, pbBuf, cbBuf);
2650 pbBuf += cbCopied;
2652 cbCopied = atapiGetConfigurationFillFeatureTimeout(s, pbBuf, cbBuf);
2654 pbBuf += cbCopied;
2668 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2689 ataH2BE_U16(pbBuf + 0, 6);
2690 pbBuf[2] = 0x04; /* media */
2691 pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
2692 pbBuf[4] = 0x02; /* new medium */
2693 pbBuf[5] = 0x02; /* medium present / door closed */
2694 pbBuf[6] = 0x00;
2695 pbBuf[7] = 0x00;
2701 ataH2BE_U16(pbBuf + 0, 6);
2702 pbBuf[2] = 0x04; /* media */
2703 pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
2704 pbBuf[4] = 0x03; /* media removal */
2705 pbBuf[5] = 0x00; /* medium absent / door closed */
2706 pbBuf[6] = 0x00;
2707 pbBuf[7] = 0x00;
2713 ataH2BE_U16(pbBuf + 0, 6);
2714 pbBuf[2] = 0x04; /* media */
2715 pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
2716 pbBuf[4] = 0x01; /* eject requested (eject button pressed) */
2717 pbBuf[5] = 0x02; /* medium present / door closed */
2718 pbBuf[6] = 0x00;
2719 pbBuf[7] = 0x00;
2724 ataH2BE_U16(pbBuf + 0, 6);
2725 pbBuf[2] = 0x01; /* operational change request / notification */
2726 pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
2727 pbBuf[4] = 0x00;
2728 pbBuf[5] = 0x00;
2729 pbBuf[6] = 0x00;
2730 pbBuf[7] = 0x00;
2743 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2747 pbBuf[0] = 0x05; /* CD-ROM */
2748 pbBuf[1] = 0x80; /* removable */
2750 pbBuf[2] = 0x00; /* ISO */
2751 pbBuf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */
2753 pbBuf[2] = 0x00; /* ISO */
2754 pbBuf[3] = 0x91; /* format 1, MESN=1, AENC=9 ??? */
2756 pbBuf[4] = 31; /* additional length */
2757 pbBuf[5] = 0; /* reserved */
2758 pbBuf[6] = 0; /* reserved */
2759 pbBuf[7] = 0; /* reserved */
2760 ataSCSIPadStr(pbBuf + 8, s->szInquiryVendorId, 8);
2761 ataSCSIPadStr(pbBuf + 16, s->szInquiryProductId, 16);
2762 ataSCSIPadStr(pbBuf + 32, s->szInquiryRevision, 4);
2771 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2775 ataH2BE_U16(&pbBuf[0], 16 + 6);
2776 pbBuf[2] = (uint8_t)s->MediaTrackType;
2777 pbBuf[3] = 0;
2778 pbBuf[4] = 0;
2779 pbBuf[5] = 0;
2780 pbBuf[6] = 0;
2781 pbBuf[7] = 0;
2783 pbBuf[8] = 0x01;
2784 pbBuf[9] = 0x06;
2785 pbBuf[10] = 0x00; /* Maximum error recovery */
2786 pbBuf[11] = 0x05; /* 5 retries */
2787 pbBuf[12] = 0x00;
2788 pbBuf[13] = 0x00;
2789 pbBuf[14] = 0x00;
2790 pbBuf[15] = 0x00;
2799 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2803 ataH2BE_U16(&pbBuf[0], 38);
2804 pbBuf[2] = (uint8_t)s->MediaTrackType;
2805 pbBuf[3] = 0;
2806 pbBuf[4] = 0;
2807 pbBuf[5] = 0;
2808 pbBuf[6] = 0;
2809 pbBuf[7] = 0;
2811 pbBuf[8] = 0x2a;
2812 pbBuf[9] = 30; /* page length */
2813 pbBuf[10] = 0x08; /* DVD-ROM read support */
2814 pbBuf[11] = 0x00; /* no write support */
2818 pbBuf[12] = 0x71; /* multisession support, mode 2 form 1/2 support, audio play */
2819 pbBuf[13] = 0x00; /* no subchannel reads supported */
2820 pbBuf[14] = (1 << 0) | (1 << 3) | (1 << 5); /* lock supported, eject supported, tray type loading mechanism */
2822 pbBuf[14] |= 1 << 1; /* report lock state */
2823 pbBuf[15] = 0; /* no subchannel reads supported, no separate audio volume control, no changer etc. */
2824 ataH2BE_U16(&pbBuf[16], 5632); /* (obsolete) claim 32x speed support */
2825 ataH2BE_U16(&pbBuf[18], 2); /* number of audio volume levels */
2826 ataH2BE_U16(&pbBuf[20], s->cbIOBuffer / _1K); /* buffer size supported in Kbyte */
2827 ataH2BE_U16(&pbBuf[22], 5632); /* (obsolete) current read speed 32x */
2828 pbBuf[24] = 0; /* reserved */
2829 pbBuf[25] = 0; /* reserved for digital audio (see idx 15) */
2830 ataH2BE_U16(&pbBuf[26], 0); /* (obsolete) maximum write speed */
2831 ataH2BE_U16(&pbBuf[28], 0); /* (obsolete) current write speed */
2832 ataH2BE_U16(&pbBuf[30], 0); /* copy management revision supported 0=no CSS */
2833 pbBuf[32] = 0; /* reserved */
2834 pbBuf[33] = 0; /* reserved */
2835 pbBuf[34] = 0; /* reserved */
2836 pbBuf[35] = 1; /* rotation control CAV */
2837 ataH2BE_U16(&pbBuf[36], 0); /* current write speed */
2838 ataH2BE_U16(&pbBuf[38], 0); /* number of write speed performance descriptors */
2847 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2850 memset(pbBuf, '\0', s->cbElementaryTransfer);
2851 memcpy(pbBuf, s->abATAPISense, RT_MIN(s->cbElementaryTransfer, sizeof(s->abATAPISense)));
2860 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2864 ataH2BE_U16(pbBuf, 0);
2866 pbBuf[2] = 0;
2867 pbBuf[3] = 0;
2868 pbBuf[4] = 0;
2869 pbBuf[5] = 1;
2870 ataH2BE_U16(pbBuf + 6, 0);
2879 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
2891 q = pbBuf + 2;
2929 cbSize = q - pbBuf;
2930 ataH2BE_U16(pbBuf, cbSize - 2);
2941 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer);
2949 memset(pbBuf, 0, 12);
2950 pbBuf[1] = 0x0a;
2951 pbBuf[2] = 0x01;
2952 pbBuf[3] = 0x01;
2953 pbBuf[5] = 0x14; /* ADR, control */
2954 pbBuf[6] = 1; /* first track in last complete session */
2957 pbBuf[8] = 0; /* reserved */
2958 ataLBA2MSF(&pbBuf[9], 0);
2963 ataH2BE_U32(pbBuf + 8, 0);
2973 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack;
2981 q = pbBuf + 2;
3048 cbSize = q - pbBuf;
3049 ataH2BE_U16(pbBuf, cbSize - 2);
3061 uint8_t *pbBuf;
3065 pbBuf = s->CTX_SUFF(pbIOBuffer);
3429 uint8_t *pbBuf;
3435 pbBuf = s->CTX_SUFF(pbIOBuffer);
4771 static int ataDataWrite(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, const uint8_t *pbBuf)
4785 memcpy(p, pbBuf, cbSize);
4791 memcpy(p, pbBuf, cbSize);
4799 Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf));
4803 static int ataDataRead(PATACONTROLLER pCtl, uint32_t addr, uint32_t cbSize, uint8_t *pbBuf)
4817 memcpy(pbBuf, p, cbSize);
4823 memcpy(pbBuf, p, cbSize);
4832 memset(pbBuf, '\xff', cbSize);
4834 Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, addr, cbSize, pbBuf));