The Pedigree Project 0.1
EhciLegacy.h
1/* Copyright (c) 2026, Pedigree Developers. SPDX-License-Identifier: ISC */
2#ifndef EHCI_LEGACY_H
3#define EHCI_LEGACY_H
4#include <stdint.h>
5
6namespace EhciLegacy {
7// EHCI 1.0 section 2.1.8: status shadows are RO, the remaining reserved
8// fields are zero, and only the three upper status bits are W1C.
9constexpr uint32_t SmiEnables = 0x0000e03fU;
10constexpr uint32_t AcknowledgeStatus = 0xe0000000U;
11
12template <typename Read, typename Write>
13bool disableSmis(uint16_t capability, Read read, Write write) {
14 if (capability < 0x40 || capability > 0xf8 || (capability & 3))
15 return false;
16 const uint16_t control = capability + 4;
17 uint32_t value = 0;
18 return write(control, AcknowledgeStatus) && read(control, value) && !(value & SmiEnables);
19}
20} // namespace EhciLegacy
21#endif