#pragma once #include #include #include #include #include namespace Kernel::ACPI::AML { struct ThermalZone final : public AML::Scope { ThermalZone(NameSeg name) : Scope(Node::Type::ThermalZone, name) {} BAN::RefPtr convert(uint8_t) override { return {}; } static ParseResult parse(ParseContext& context) { ASSERT(context.aml_data.size() >= 2); ASSERT(static_cast(context.aml_data[0]) == AML::Byte::ExtOpPrefix); ASSERT(static_cast(context.aml_data[1]) == AML::ExtOp::ThermalZoneOp); context.aml_data = context.aml_data.slice(2); auto opt_thermal_zone_pkg = AML::parse_pkg(context.aml_data); if (!opt_thermal_zone_pkg.has_value()) return ParseResult::Failure; auto thermal_zone_pkg = opt_thermal_zone_pkg.value(); auto name = NameString::parse(thermal_zone_pkg); if (!name.has_value()) return ParseResult::Failure; auto thermal_zone = MUST(BAN::RefPtr::create(name->path.back())); if (!Namespace::root_namespace()->add_named_object(context, name.value(), thermal_zone)) return ParseResult::Success; #if AML_DEBUG_LEVEL >= 2 thermal_zone->debug_print(0); AML_DEBUG_PRINTLN(""); #endif return thermal_zone->enter_context_and_parse_term_list(context, name.value(), thermal_zone_pkg); } virtual void debug_print(int indent) const override { AML_DEBUG_PRINT_INDENT(indent); AML_DEBUG_PRINT("ThermalZone {} {", name); Namespace::root_namespace()->for_each_child(scope, [&](const auto&, const auto& child) { child->debug_print(indent + 1); AML_DEBUG_PRINTLN(""); } ); AML_DEBUG_PRINT_INDENT(indent); AML_DEBUG_PRINT("}"); } }; }