# Debugging xHCI scratchpad allocation and port-status handling

DevFeed: [Debugging xHCI scratchpad allocation and port-status handling](<https://devfeed.tech/articles/xhci-a-life-lesson-learnt-33060.md>)

Original publisher: [Read original article](<https://reactos.org/blogs/xhci-life-lesson-learnt/>)

Published: 2017-08-07T00:00:00Z

Content type: opinion

Language: en

Sources: [Front Page on ReactOS Website](<https://devfeed.tech/sources/front-page-on-reactos-website.md>)

Topics: [Hardware](<https://devfeed.tech/topics/hardware.md>), [Code](<https://devfeed.tech/topics/code.md>), [dma](<https://devfeed.tech/topics/dma.md>), [Operating system](<https://devfeed.tech/topics/operating-system.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [dma](<https://devfeed.tech/tags/dma.md>), [driver](<https://devfeed.tech/tags/driver.md>), [free](<https://devfeed.tech/tags/free.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [memory-management](<https://devfeed.tech/tags/memory-management.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [os](<https://devfeed.tech/tags/os.md>), [react](<https://devfeed.tech/tags/react.md>), [reactos](<https://devfeed.tech/tags/reactos.md>), [win32](<https://devfeed.tech/tags/win32.md>), [winapi](<https://devfeed.tech/tags/winapi.md>), [windows](<https://devfeed.tech/tags/windows.md>)

## AI overview

A developer describes implementing xHCI scratchpad buffer allocation while debugging incorrect port-status results. The article explains scratchpad buffers, DMA physical-address handling in Windows drivers, and a VMware xHCI implementation that required zero scratchpad buffers; the underlying port-status issue remained unresolved in the supplied text.

## Source excerpt

Recently I've worked on Scratchpad allocation. Scratchpad buffers are PAGESIZE blocks of system memory which the xHCI uses to store its internal state. xHCI can request 0 to 1024 buffers. Number of buffers required is given in the HCSPARAMS1 register. Each buffer is a PAGESIZE block aligned to PAGESIZE boundary. Scratchpad buffer array is an array which contains addresses of the scratchpad buffers. Its size is equal to the number of maximum scratchpad buffers required by the hardware.