mirror of
https://github.com/torvalds/linux.git
synced 2024-12-18 09:02:17 +00:00
d0a874cb45
ACPICA commit b3317239749d1907ec95e7aa2057d7ea29d3c638 Before this change we see the following UBSAN stack trace in Fuchsia: #0 0x000020c1f68c9959 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:244 <platform-bus-x86.so>+0x2d0959 #1.2 0x000020e5d259f77f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f #1.1 0x000020e5d259f77f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f #1 0x000020e5d259f77f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f #2 0x000020e5d25a0385 in handletype_mismatch_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 <libclang_rt.asan.so>+0x3e385 #3 0x000020e5d259fead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 <libclang_rt.asan.so>+0x3dead #4 0x000020c1f68c9959 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:244 <platform-bus-x86.so>+0x2d0959 #5 0x000020c1f68c65a9 in acpi_rs_convert_aml_to_resources(u8*, u32, u32, u8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 <platform-bus-x86.so>+0x2cd5a9 #6 0x000020c1f68efda9 in acpi_ut_walk_aml_resources(struct acpi_walk_state*, u8*, acpi_size, acpi_walk_aml_callback, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 <platform-bus-x86.so>+0x2f6da9 #7 0x000020c1f68c1806 in acpi_rs_create_resource_list(union acpi_operand_object*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rscreate.c:199 <platform-bus-x86.so>+0x2c8806 #8 0x000020c1f68ccef2 in acpi_rs_get_method_data(acpi_handle, const char*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rsutils.c:770 <platform-bus-x86.so>+0x2d3ef2 #9 0x000020c1f68cd26d in acpi_walk_resources(acpi_handle, char*, acpi_walk_resource_callback, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 <platform-bus-x86.so>+0x2d426d #10 0x000020c1f66e4d48 in acpi::acpi_impl::walk_resources(acpi::acpi_impl*, acpi_handle, const char*, acpi::Acpi::resources_callable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 <platform-bus-x86.so>+0xebd48 #11 0x000020c1f66ea94d in acpi::device_builder::gather_resources(acpi::device_builder*, acpi::Acpi*, fidl::any_arena&, acpi::Manager*, acpi::device_builder::gather_resources_callback) ../../src/devices/board/lib/acpi/device-builder.cc:52 <platform-bus-x86.so>+0xf194d #12 0x000020c1f6776af2 in acpi::Manager::configure_discovered_devices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 <platform-bus-x86.so>+0x17daf2 #13 0x000020c1f669eb44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 <platform-bus-x86.so>+0xa5b44 #14 0x000020c1f66b06f7 in x86::X86::do_init(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 <platform-bus-x86.so>+0xb76f7 #15.1 0x000020c1f66ba8ea in λ(x86::X86::ddk_init::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 <platform-bus-x86.so>+0xc18ea #15 0x000020c1f66ba8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 <platform-bus-x86.so>+0xc18ea #16.2 0x000020c1f68ff86c in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <platform-bus-x86.so>+0x30686c #16.1 0x000020c1f68ff86c in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 <platform-bus-x86.so>+0x30686c #16 0x000020c1f68ff86c in async::internal::retained_task::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 <platform-bus-x86.so>+0x30686c #17.1 0x000022d99b37bd91 in λ(const driver_runtime::Dispatcher::post_task::(anon class)*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 <libdriver_runtime.so>+0x4bd91 #17 0x000022d99b37bd91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int>::invoke(void*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4bd91 #18 0x000022d99b374bc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44bc9 #19 0x000022d99b3748dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 <libdriver_runtime.so>+0x448dd #20 0x000022d99b3656a6 in driver_runtime::callback_request::Call(driver_runtime::callback_request*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 <libdriver_runtime.so>+0x356a6 #21 0x000022d99b36c4c8 in driver_runtime::Dispatcher::dispatch_callback(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 <libdriver_runtime.so>+0x3c4c8 #22 0x000022d99b36d2c1 in driver_runtime::Dispatcher::dispatch_callbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 <libdriver_runtime.so>+0x3d2c1 #23.1 0x000022d99b37881e in λ(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>, const driver_runtime::Dispatcher::create_with_adder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 <libdriver_runtime.so>+0x4881e #23 0x000022d99b37881e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>>::invoke(void*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4881e #24 0x000022d99b374e7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44e7e #25.1 0x000022d99b36e964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/function.h:300 <libdriver_runtime.so>+0x3e964 #25 0x000022d99b36e964 in driver_runtime::Dispatcher::event_waiter::invoke_callback(driver_runtime::Dispatcher::event_waiter*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.h:299 <libdriver_runtime.so>+0x3e964 #26 0x000022d99b36e35d in driver_runtime::Dispatcher::event_waiter::handle_event(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 <libdriver_runtime.so>+0x3e35d #27.1 0x000022d99b378c00 in async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event(async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::wait_base*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 <libdriver_runtime.so>+0x48c00 #27 0x000022d99b378c00 in async::wait_method<async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>, &async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event>::call_handler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 <libdriver_runtime.so>+0x48c00 #28.1 0x000022d99b39aead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 <libdriver_runtime.so>+0x6aead #28 0x000022d99b39aead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 <libdriver_runtime.so>+0x6aead #29 0x000022d99b39c78f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 <libdriver_runtime.so>+0x6c78f #30 0x00004230f4a33edc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 <libc.so>+0xd7edc #31 0x00004230f4b6496d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 <libc.so>+0x20896d and #0 0x00002357f60edb6d in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:257 <platform-bus-x86.so>+0x2d0b6d #1.2 0x0000212756f4777f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f #1.1 0x0000212756f4777f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f #1 0x0000212756f4777f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f #2 0x0000212756f48385 in handletype_mismatch_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 <libclang_rt.asan.so>+0x3e385 #3 0x0000212756f47ead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 <libclang_rt.asan.so>+0x3dead #4 0x00002357f60edb6d in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:257 <platform-bus-x86.so>+0x2d0b6d #5 0x00002357f60ea5a9 in acpi_rs_convert_aml_to_resources(u8*, u32, u32, u8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 <platform-bus-x86.so>+0x2cd5a9 #6 0x00002357f6113d09 in acpi_ut_walk_aml_resources(struct acpi_walk_state*, u8*, acpi_size, acpi_walk_aml_callback, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 <platform-bus-x86.so>+0x2f6d09 #7 0x00002357f60e5806 in acpi_rs_create_resource_list(union acpi_operand_object*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rscreate.c:199 <platform-bus-x86.so>+0x2c8806 #8 0x00002357f60f0e52 in acpi_rs_get_method_data(acpi_handle, const char*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rsutils.c:770 <platform-bus-x86.so>+0x2d3e52 #9 0x00002357f60f11cd in acpi_walk_resources(acpi_handle, char*, acpi_walk_resource_callback, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 <platform-bus-x86.so>+0x2d41cd #10 0x00002357f5f08d48 in acpi::acpi_impl::walk_resources(acpi::acpi_impl*, acpi_handle, const char*, acpi::Acpi::resources_callable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 <platform-bus-x86.so>+0xebd48 #11 0x00002357f5f0e94d in acpi::device_builder::gather_resources(acpi::device_builder*, acpi::Acpi*, fidl::any_arena&, acpi::Manager*, acpi::device_builder::gather_resources_callback) ../../src/devices/board/lib/acpi/device-builder.cc:52 <platform-bus-x86.so>+0xf194d #12 0x00002357f5f9aaf2 in acpi::Manager::configure_discovered_devices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 <platform-bus-x86.so>+0x17daf2 #13 0x00002357f5ec2b44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 <platform-bus-x86.so>+0xa5b44 #14 0x00002357f5ed46f7 in x86::X86::do_init(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 <platform-bus-x86.so>+0xb76f7 #15.1 0x00002357f5ede8ea in λ(x86::X86::ddk_init::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 <platform-bus-x86.so>+0xc18ea #15 0x00002357f5ede8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 <platform-bus-x86.so>+0xc18ea #16.2 0x00002357f61237cc in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <platform-bus-x86.so>+0x3067cc #16.1 0x00002357f61237cc in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 <platform-bus-x86.so>+0x3067cc #16 0x00002357f61237cc in async::internal::retained_task::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 <platform-bus-x86.so>+0x3067cc #17.1 0x000023df096b1d91 in λ(const driver_runtime::Dispatcher::post_task::(anon class)*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 <libdriver_runtime.so>+0x4bd91 #17 0x000023df096b1d91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int>::invoke(void*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4bd91 #18 0x000023df096aabc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44bc9 #19 0x000023df096aa8dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 <libdriver_runtime.so>+0x448dd #20 0x000023df0969b6a6 in driver_runtime::callback_request::Call(driver_runtime::callback_request*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 <libdriver_runtime.so>+0x356a6 #21 0x000023df096a24c8 in driver_runtime::Dispatcher::dispatch_callback(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 <libdriver_runtime.so>+0x3c4c8 #22 0x000023df096a32c1 in driver_runtime::Dispatcher::dispatch_callbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 <libdriver_runtime.so>+0x3d2c1 #23.1 0x000023df096ae81e in λ(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>, const driver_runtime::Dispatcher::create_with_adder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 <libdriver_runtime.so>+0x4881e #23 0x000023df096ae81e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>>::invoke(void*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4881e #24 0x000023df096aae7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44e7e #25.1 0x000023df096a4964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/function.h:300 <libdriver_runtime.so>+0x3e964 #25 0x000023df096a4964 in driver_runtime::Dispatcher::event_waiter::invoke_callback(driver_runtime::Dispatcher::event_waiter*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.h:299 <libdriver_runtime.so>+0x3e964 #26 0x000023df096a435d in driver_runtime::Dispatcher::event_waiter::handle_event(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 <libdriver_runtime.so>+0x3e35d #27.1 0x000023df096aec00 in async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event(async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::wait_base*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 <libdriver_runtime.so>+0x48c00 #27 0x000023df096aec00 in async::wait_method<async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>, &async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event>::call_handler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 <libdriver_runtime.so>+0x48c00 #28.1 0x000023df096d0ead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 <libdriver_runtime.so>+0x6aead #28 0x000023df096d0ead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 <libdriver_runtime.so>+0x6aead #29 0x000023df096d278f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 <libdriver_runtime.so>+0x6c78f #30 0x0000424c7690eedc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 <libc.so>+0xd7edc #31 0x0000424c76a3f96d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 <libc.so>+0x20896d and #0 0x000020883e0b9c01 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:334 <platform-bus-x86.so>+0x2d0c01 #1.2 0x000022cae2d8677f in ubsan_get_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:41 <libclang_rt.asan.so>+0x3d77f #1.1 0x000022cae2d8677f in maybe_print_stack_trace() compiler-rt/lib/ubsan/ubsan_diag.cpp:51 <libclang_rt.asan.so>+0x3d77f #1 0x000022cae2d8677f in ~scoped_report() compiler-rt/lib/ubsan/ubsan_diag.cpp:387 <libclang_rt.asan.so>+0x3d77f #2 0x000022cae2d87385 in handletype_mismatch_impl() compiler-rt/lib/ubsan/ubsan_handlers.cpp:137 <libclang_rt.asan.so>+0x3e385 #3 0x000022cae2d86ead in compiler-rt/lib/ubsan/ubsan_handlers.cpp:142 <libclang_rt.asan.so>+0x3dead #4 0x000020883e0b9c01 in acpi_rs_convert_aml_to_resource(struct acpi_resource*, union aml_resource*, struct acpi_rsconvert_info*) ../../third_party/acpica/source/components/resources/rsmisc.c:334 <platform-bus-x86.so>+0x2d0c01 #5 0x000020883e0b65a9 in acpi_rs_convert_aml_to_resources(u8*, u32, u32, u8, void**) ../../third_party/acpica/source/components/resources/rslist.c:137 <platform-bus-x86.so>+0x2cd5a9 #6 0x000020883e0dfd89 in acpi_ut_walk_aml_resources(struct acpi_walk_state*, u8*, acpi_size, acpi_walk_aml_callback, void**) ../../third_party/acpica/source/components/utilities/utresrc.c:234 <platform-bus-x86.so>+0x2f6d89 #7 0x000020883e0b1806 in acpi_rs_create_resource_list(union acpi_operand_object*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rscreate.c:199 <platform-bus-x86.so>+0x2c8806 #8 0x000020883e0bced2 in acpi_rs_get_method_data(acpi_handle, const char*, struct acpi_buffer*) ../../third_party/acpica/source/components/resources/rsutils.c:770 <platform-bus-x86.so>+0x2d3ed2 #9 0x000020883e0bd24d in acpi_walk_resources(acpi_handle, char*, acpi_walk_resource_callback, void*) ../../third_party/acpica/source/components/resources/rsxface.c:731 <platform-bus-x86.so>+0x2d424d #10 0x000020883ded4d48 in acpi::acpi_impl::walk_resources(acpi::acpi_impl*, acpi_handle, const char*, acpi::Acpi::resources_callable) ../../src/devices/board/lib/acpi/acpi-impl.cc:41 <platform-bus-x86.so>+0xebd48 #11 0x000020883deda94d in acpi::device_builder::gather_resources(acpi::device_builder*, acpi::Acpi*, fidl::any_arena&, acpi::Manager*, acpi::device_builder::gather_resources_callback) ../../src/devices/board/lib/acpi/device-builder.cc:52 <platform-bus-x86.so>+0xf194d #12 0x000020883df66af2 in acpi::Manager::configure_discovered_devices(acpi::Manager*) ../../src/devices/board/lib/acpi/manager.cc:75 <platform-bus-x86.so>+0x17daf2 #13 0x000020883de8eb44 in publish_acpi_devices(acpi::Manager*, zx_device_t*, zx_device_t*) ../../src/devices/board/drivers/x86/acpi-nswalk.cc:102 <platform-bus-x86.so>+0xa5b44 #14 0x000020883dea06f7 in x86::X86::do_init(x86::X86*) ../../src/devices/board/drivers/x86/x86.cc:65 <platform-bus-x86.so>+0xb76f7 #15.1 0x000020883deaa8ea in λ(x86::X86::ddk_init::(anon class)*) ../../src/devices/board/drivers/x86/x86.cc:82 <platform-bus-x86.so>+0xc18ea #15 0x000020883deaa8ea in fit::internal::target<(lambda at../../src/devices/board/drivers/x86/x86.cc:81:19), false, false, void>::invoke(void*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:181 <platform-bus-x86.so>+0xc18ea #16.2 0x000020883e0ef84c in fit::internal::function_base<16UL, false, void()>::invoke(const fit::internal::function_base<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <platform-bus-x86.so>+0x30684c #16.1 0x000020883e0ef84c in fit::function_impl<16UL, false, void()>::operator()(const fit::function_impl<16UL, false, void ()>*) ../../sdk/lib/fit/include/lib/fit/function.h:300 <platform-bus-x86.so>+0x30684c #16 0x000020883e0ef84c in async::internal::retained_task::Handler(async_dispatcher_t*, async_task_t*, zx_status_t) ../../zircon/system/ulib/async/task.cc:25 <platform-bus-x86.so>+0x30684c #17.1 0x000021ae7c20cd91 in λ(const driver_runtime::Dispatcher::post_task::(anon class)*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/dispatcher.cc:715 <libdriver_runtime.so>+0x4bd91 #17 0x000021ae7c20cd91 in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:714:7), true, false, void, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int>::invoke(void*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4bd91 #18 0x000021ae7c205bc9 in fit::internal::function_base<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::invoke(const fit::internal::function_base<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44bc9 #19 0x000021ae7c2058dd in fit::callback_impl<24UL, true, void(std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request>>, int)>::operator()(fit::callback_impl<24UL, true, void (std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int)>*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, int) ../../sdk/lib/fit/include/lib/fit/function.h:451 <libdriver_runtime.so>+0x448dd #20 0x000021ae7c1f66a6 in driver_runtime::callback_request::Call(driver_runtime::callback_request*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >, zx_status_t) ../../src/devices/bin/driver_runtime/callback_request.h:67 <libdriver_runtime.so>+0x356a6 #21 0x000021ae7c1fd4c8 in driver_runtime::Dispatcher::dispatch_callback(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::callback_request, std::__2::default_delete<driver_runtime::callback_request> >) ../../src/devices/bin/driver_runtime/dispatcher.cc:1093 <libdriver_runtime.so>+0x3c4c8 #22 0x000021ae7c1fe2c1 in driver_runtime::Dispatcher::dispatch_callbacks(driver_runtime::Dispatcher*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.cc:1169 <libdriver_runtime.so>+0x3d2c1 #23.1 0x000021ae7c20981e in λ(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>, const driver_runtime::Dispatcher::create_with_adder::(anon class)*) ../../src/devices/bin/driver_runtime/dispatcher.cc:338 <libdriver_runtime.so>+0x4881e #23 0x000021ae7c20981e in fit::internal::target<(lambda at../../src/devices/bin/driver_runtime/dispatcher.cc:337:7), true, false, void, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>>::invoke(void*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:128 <libdriver_runtime.so>+0x4881e #24 0x000021ae7c205e7e in fit::internal::function_base<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::invoke(const fit::internal::function_base<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/internal/function.h:505 <libdriver_runtime.so>+0x44e7e #25.1 0x000021ae7c1ff964 in fit::function_impl<8UL, true, void(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter>>, fbl::ref_ptr<driver_runtime::Dispatcher>)>::operator()(const fit::function_impl<8UL, true, void (std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>)>*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../sdk/lib/fit/include/lib/fit/function.h:300 <libdriver_runtime.so>+0x3e964 #25 0x000021ae7c1ff964 in driver_runtime::Dispatcher::event_waiter::invoke_callback(driver_runtime::Dispatcher::event_waiter*, std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, fbl::ref_ptr<driver_runtime::Dispatcher>) ../../src/devices/bin/driver_runtime/dispatcher.h:299 <libdriver_runtime.so>+0x3e964 #26 0x000021ae7c1ff35d in driver_runtime::Dispatcher::event_waiter::handle_event(std::__2::unique_ptr<driver_runtime::Dispatcher::event_waiter, std::__2::default_delete<driver_runtime::Dispatcher::event_waiter> >, async_dispatcher_t*, async::wait_base*, zx_status_t, zx_packet_signal_t const*) ../../src/devices/bin/driver_runtime/dispatcher.cc:1259 <libdriver_runtime.so>+0x3e35d #27.1 0x000021ae7c209c00 in async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event(async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>*, zx_status_t, zx_packet_signal_t const*, async_dispatcher_t*, async::wait_base*) ../../src/devices/bin/driver_runtime/async_loop_owned_event_handler.h:59 <libdriver_runtime.so>+0x48c00 #27 0x000021ae7c209c00 in async::wait_method<async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>, &async_loop_owned_event_handler<driver_runtime::Dispatcher::event_waiter>::handle_event>::call_handler(async_dispatcher_t*, async_wait_t*, zx_status_t, zx_packet_signal_t const*) ../../zircon/system/ulib/async/include/lib/async/cpp/wait.h:201 <libdriver_runtime.so>+0x48c00 #28.1 0x000021ae7c22bead in async_loop_run_once(async_loop_t*, zx_time_t) ../../zircon/system/ulib/async-loop/loop.c:415 <libdriver_runtime.so>+0x6aead #28 0x000021ae7c22bead in async_loop_run(async_loop_t*, zx_time_t, _Bool) ../../zircon/system/ulib/async-loop/loop.c:288 <libdriver_runtime.so>+0x6aead #29 0x000021ae7c22d78f in async_loop_run_thread(void*) ../../zircon/system/ulib/async-loop/loop.c:840 <libdriver_runtime.so>+0x6c78f #30 0x000042b2518e3edc in start_c11(void*) ../../zircon/third_party/ulib/musl/pthread/pthread_create.c:55 <libc.so>+0xd7edc #31 0x000042b251a1496d in thread_trampoline(uintptr_t, uintptr_t) ../../zircon/system/ulib/runtime/thread.cc:100 <libc.so>+0x20896d Link: https://github.com/acpica/acpica/commit/b3317239 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
807 lines
19 KiB
C
807 lines
19 KiB
C
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
|
/*******************************************************************************
|
|
*
|
|
* Module Name: rsmisc - Miscellaneous resource descriptors
|
|
*
|
|
******************************************************************************/
|
|
|
|
#include <acpi/acpi.h>
|
|
#include "accommon.h"
|
|
#include "acresrc.h"
|
|
|
|
#define _COMPONENT ACPI_RESOURCES
|
|
ACPI_MODULE_NAME("rsmisc")
|
|
#define INIT_RESOURCE_TYPE(i) i->resource_offset
|
|
#define INIT_RESOURCE_LENGTH(i) i->aml_offset
|
|
#define INIT_TABLE_LENGTH(i) i->value
|
|
#define COMPARE_OPCODE(i) i->resource_offset
|
|
#define COMPARE_TARGET(i) i->aml_offset
|
|
#define COMPARE_VALUE(i) i->value
|
|
/*******************************************************************************
|
|
*
|
|
* FUNCTION: acpi_rs_convert_aml_to_resource
|
|
*
|
|
* PARAMETERS: resource - Pointer to the resource descriptor
|
|
* aml - Where the AML descriptor is returned
|
|
* info - Pointer to appropriate conversion table
|
|
*
|
|
* RETURN: Status
|
|
*
|
|
* DESCRIPTION: Convert an external AML resource descriptor to the corresponding
|
|
* internal resource descriptor
|
|
*
|
|
******************************************************************************/
|
|
acpi_status
|
|
acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
|
|
union aml_resource *aml,
|
|
struct acpi_rsconvert_info *info)
|
|
{
|
|
acpi_rs_length aml_resource_length;
|
|
void *source;
|
|
void *destination;
|
|
char *target;
|
|
u8 count;
|
|
u8 flags_mode = FALSE;
|
|
u16 item_count = 0;
|
|
u16 temp16 = 0;
|
|
|
|
ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource);
|
|
|
|
if (!info) {
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
|
|
if (((acpi_size)resource) & 0x3) {
|
|
|
|
/* Each internal resource struct is expected to be 32-bit aligned */
|
|
|
|
ACPI_WARNING((AE_INFO,
|
|
"Misaligned resource pointer (get): %p Type 0x%2.2X Length %u",
|
|
resource, resource->type, resource->length));
|
|
}
|
|
|
|
/* Extract the resource Length field (does not include header length) */
|
|
|
|
aml_resource_length = acpi_ut_get_resource_length(aml);
|
|
|
|
/*
|
|
* First table entry must be ACPI_RSC_INITxxx and must contain the
|
|
* table length (# of table entries)
|
|
*/
|
|
count = INIT_TABLE_LENGTH(info);
|
|
while (count) {
|
|
target = NULL;
|
|
|
|
/*
|
|
* Source is the external AML byte stream buffer,
|
|
* destination is the internal resource descriptor
|
|
*/
|
|
source = ACPI_ADD_PTR(void, aml, info->aml_offset);
|
|
destination =
|
|
ACPI_ADD_PTR(void, resource, info->resource_offset);
|
|
|
|
switch (info->opcode) {
|
|
case ACPI_RSC_INITGET:
|
|
/*
|
|
* Get the resource type and the initial (minimum) length
|
|
*/
|
|
memset(resource, 0, INIT_RESOURCE_LENGTH(info));
|
|
resource->type = INIT_RESOURCE_TYPE(info);
|
|
resource->length = INIT_RESOURCE_LENGTH(info);
|
|
break;
|
|
|
|
case ACPI_RSC_INITSET:
|
|
break;
|
|
|
|
case ACPI_RSC_FLAGINIT:
|
|
|
|
flags_mode = TRUE;
|
|
break;
|
|
|
|
case ACPI_RSC_1BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bit
|
|
*/
|
|
ACPI_SET8(destination,
|
|
((ACPI_GET8(source) >> info->value) & 0x01));
|
|
break;
|
|
|
|
case ACPI_RSC_2BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET8(destination,
|
|
((ACPI_GET8(source) >> info->value) & 0x03));
|
|
break;
|
|
|
|
case ACPI_RSC_3BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET8(destination,
|
|
((ACPI_GET8(source) >> info->value) & 0x07));
|
|
break;
|
|
|
|
case ACPI_RSC_6BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET8(destination,
|
|
((ACPI_GET8(source) >> info->value) & 0x3F));
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT:
|
|
|
|
item_count = ACPI_GET8(source);
|
|
ACPI_SET8(destination, item_count);
|
|
|
|
resource->length = resource->length +
|
|
(info->value * (item_count - 1));
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT16:
|
|
|
|
item_count = aml_resource_length;
|
|
ACPI_SET16(destination, item_count);
|
|
|
|
resource->length = resource->length +
|
|
(info->value * (item_count - 1));
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_PIN:
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
item_count = ACPI_GET16(target) - ACPI_GET16(source);
|
|
|
|
resource->length = resource->length + item_count;
|
|
item_count = item_count / 2;
|
|
ACPI_SET16(destination, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_VEN:
|
|
|
|
item_count = ACPI_GET8(source);
|
|
ACPI_SET8(destination, item_count);
|
|
|
|
resource->length =
|
|
resource->length + (info->value * item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_RES:
|
|
/*
|
|
* Vendor data is optional (length/offset may both be zero)
|
|
* Examine vendor data length field first
|
|
*/
|
|
target = ACPI_ADD_PTR(void, aml, (info->value + 2));
|
|
if (ACPI_GET16(target)) {
|
|
|
|
/* Use vendor offset to get resource source length */
|
|
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
item_count =
|
|
ACPI_GET16(target) - ACPI_GET16(source);
|
|
} else {
|
|
/* No vendor data to worry about */
|
|
|
|
item_count = aml->large_header.resource_length +
|
|
sizeof(struct aml_resource_large_header) -
|
|
ACPI_GET16(source);
|
|
}
|
|
|
|
resource->length = resource->length + item_count;
|
|
ACPI_SET16(destination, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_VEN:
|
|
|
|
ACPI_MOVE_16_TO_16(&temp16, source);
|
|
item_count = temp16 - info->value;
|
|
|
|
resource->length = resource->length + item_count;
|
|
ACPI_SET16(destination, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_RES:
|
|
|
|
ACPI_MOVE_16_TO_16(&temp16, source);
|
|
item_count = (aml_resource_length +
|
|
sizeof(struct aml_resource_large_header))
|
|
- temp16 - info->value;
|
|
|
|
resource->length = resource->length + item_count;
|
|
ACPI_SET16(destination, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_LENGTH:
|
|
|
|
resource->length = resource->length + info->value;
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE8:
|
|
case ACPI_RSC_MOVE16:
|
|
case ACPI_RSC_MOVE32:
|
|
case ACPI_RSC_MOVE64:
|
|
/*
|
|
* Raw data move. Use the Info value field unless item_count has
|
|
* been previously initialized via a COUNT opcode
|
|
*/
|
|
if (info->value) {
|
|
item_count = info->value;
|
|
}
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_GPIO_PIN:
|
|
|
|
/* Generate and set the PIN data pointer */
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
(resource->length -
|
|
item_count * 2));
|
|
*(u16 **)destination = ACPI_CAST_PTR(u16, target);
|
|
|
|
/* Copy the PIN data */
|
|
|
|
source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
|
|
acpi_rs_move_data(target, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_GPIO_RES:
|
|
|
|
/* Generate and set the resource_source string pointer */
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
(resource->length -
|
|
item_count));
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
/* Copy the resource_source string */
|
|
|
|
source = ACPI_ADD_PTR(void, aml, ACPI_GET16(source));
|
|
acpi_rs_move_data(target, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_VEN:
|
|
|
|
/* Generate and set the Vendor Data pointer */
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
(resource->length -
|
|
item_count));
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
/* Copy the Vendor Data */
|
|
|
|
source = ACPI_ADD_PTR(void, aml, info->value);
|
|
acpi_rs_move_data(target, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_RES:
|
|
|
|
/* Generate and set the resource_source string pointer */
|
|
|
|
target = (char *)ACPI_ADD_PTR(void, resource,
|
|
(resource->length -
|
|
item_count));
|
|
*(u8 **)destination = ACPI_CAST_PTR(u8, target);
|
|
|
|
/* Copy the resource_source string */
|
|
|
|
ACPI_MOVE_16_TO_16(&temp16, source);
|
|
source =
|
|
ACPI_ADD_PTR(void, aml, (temp16 + info->value));
|
|
acpi_rs_move_data(target, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_SET8:
|
|
|
|
memset(destination, info->aml_offset, info->value);
|
|
break;
|
|
|
|
case ACPI_RSC_DATA8:
|
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
|
memcpy(destination, source, ACPI_GET16(target));
|
|
break;
|
|
|
|
case ACPI_RSC_ADDRESS:
|
|
/*
|
|
* Common handler for address descriptor flags
|
|
*/
|
|
if (!acpi_rs_get_address_common(resource, aml)) {
|
|
return_ACPI_STATUS
|
|
(AE_AML_INVALID_RESOURCE_TYPE);
|
|
}
|
|
break;
|
|
|
|
case ACPI_RSC_SOURCE:
|
|
/*
|
|
* Optional resource_source (Index and String)
|
|
*/
|
|
resource->length +=
|
|
acpi_rs_get_resource_source(aml_resource_length,
|
|
info->value,
|
|
destination, aml, NULL);
|
|
break;
|
|
|
|
case ACPI_RSC_SOURCEX:
|
|
/*
|
|
* Optional resource_source (Index and String). This is the more
|
|
* complicated case used by the Interrupt() macro
|
|
*/
|
|
target = ACPI_ADD_PTR(char, resource,
|
|
info->aml_offset +
|
|
(item_count * 4));
|
|
|
|
resource->length +=
|
|
acpi_rs_get_resource_source(aml_resource_length,
|
|
(acpi_rs_length)
|
|
(((item_count -
|
|
1) * sizeof(u32)) +
|
|
info->value),
|
|
destination, aml,
|
|
target);
|
|
break;
|
|
|
|
case ACPI_RSC_BITMASK:
|
|
/*
|
|
* 8-bit encoded bitmask (DMA macro)
|
|
*/
|
|
item_count =
|
|
acpi_rs_decode_bitmask(ACPI_GET8(source),
|
|
destination);
|
|
if (item_count) {
|
|
resource->length += (item_count - 1);
|
|
}
|
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
|
ACPI_SET8(target, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_BITMASK16:
|
|
/*
|
|
* 16-bit encoded bitmask (IRQ macro)
|
|
*/
|
|
ACPI_MOVE_16_TO_16(&temp16, source);
|
|
|
|
item_count =
|
|
acpi_rs_decode_bitmask(temp16, destination);
|
|
if (item_count) {
|
|
resource->length += (item_count - 1);
|
|
}
|
|
|
|
target = ACPI_ADD_PTR(char, resource, info->value);
|
|
ACPI_SET8(target, item_count);
|
|
break;
|
|
|
|
case ACPI_RSC_EXIT_NE:
|
|
/*
|
|
* control - Exit conversion if not equal
|
|
*/
|
|
switch (info->resource_offset) {
|
|
case ACPI_RSC_COMPARE_AML_LENGTH:
|
|
|
|
if (aml_resource_length != info->value) {
|
|
goto exit;
|
|
}
|
|
break;
|
|
|
|
case ACPI_RSC_COMPARE_VALUE:
|
|
|
|
if (ACPI_GET8(source) != info->value) {
|
|
goto exit;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
"Invalid conversion sub-opcode"));
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
|
|
ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
|
|
count--;
|
|
info++;
|
|
}
|
|
|
|
exit:
|
|
if (!flags_mode) {
|
|
|
|
/* Round the resource struct length up to the next boundary (32 or 64) */
|
|
|
|
resource->length = (u32)
|
|
ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length);
|
|
}
|
|
return_ACPI_STATUS(AE_OK);
|
|
}
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* FUNCTION: acpi_rs_convert_resource_to_aml
|
|
*
|
|
* PARAMETERS: resource - Pointer to the resource descriptor
|
|
* aml - Where the AML descriptor is returned
|
|
* info - Pointer to appropriate conversion table
|
|
*
|
|
* RETURN: Status
|
|
*
|
|
* DESCRIPTION: Convert an internal resource descriptor to the corresponding
|
|
* external AML resource descriptor.
|
|
*
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
|
acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
|
|
union aml_resource *aml,
|
|
struct acpi_rsconvert_info *info)
|
|
{
|
|
void *source = NULL;
|
|
void *destination;
|
|
char *target;
|
|
acpi_rsdesc_size aml_length = 0;
|
|
u8 count;
|
|
u16 temp16 = 0;
|
|
u16 item_count = 0;
|
|
|
|
ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml);
|
|
|
|
if (!info) {
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
|
|
/*
|
|
* First table entry must be ACPI_RSC_INITxxx and must contain the
|
|
* table length (# of table entries)
|
|
*/
|
|
count = INIT_TABLE_LENGTH(info);
|
|
|
|
while (count) {
|
|
/*
|
|
* Source is the internal resource descriptor,
|
|
* destination is the external AML byte stream buffer
|
|
*/
|
|
source = ACPI_ADD_PTR(void, resource, info->resource_offset);
|
|
destination = ACPI_ADD_PTR(void, aml, info->aml_offset);
|
|
|
|
switch (info->opcode) {
|
|
case ACPI_RSC_INITSET:
|
|
|
|
memset(aml, 0, INIT_RESOURCE_LENGTH(info));
|
|
aml_length = INIT_RESOURCE_LENGTH(info);
|
|
acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
|
|
aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_INITGET:
|
|
break;
|
|
|
|
case ACPI_RSC_FLAGINIT:
|
|
/*
|
|
* Clear the flag byte
|
|
*/
|
|
ACPI_SET8(destination, 0);
|
|
break;
|
|
|
|
case ACPI_RSC_1BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bit
|
|
*/
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
((ACPI_GET8(source) & 0x01) << info->
|
|
value));
|
|
break;
|
|
|
|
case ACPI_RSC_2BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
((ACPI_GET8(source) & 0x03) << info->
|
|
value));
|
|
break;
|
|
|
|
case ACPI_RSC_3BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
((ACPI_GET8(source) & 0x07) << info->
|
|
value));
|
|
break;
|
|
|
|
case ACPI_RSC_6BITFLAG:
|
|
/*
|
|
* Mask and shift the flag bits
|
|
*/
|
|
ACPI_SET_BIT(*ACPI_CAST8(destination), (u8)
|
|
((ACPI_GET8(source) & 0x3F) << info->
|
|
value));
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT:
|
|
|
|
item_count = ACPI_GET8(source);
|
|
ACPI_SET8(destination, item_count);
|
|
|
|
aml_length = (u16)
|
|
(aml_length + (info->value * (item_count - 1)));
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT16:
|
|
|
|
item_count = ACPI_GET16(source);
|
|
aml_length = (u16) (aml_length + item_count);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_PIN:
|
|
|
|
item_count = ACPI_GET16(source);
|
|
ACPI_SET16(destination, aml_length);
|
|
|
|
aml_length = (u16)(aml_length + item_count * 2);
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
ACPI_SET16(target, aml_length);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_VEN:
|
|
|
|
item_count = ACPI_GET16(source);
|
|
ACPI_SET16(destination, item_count);
|
|
|
|
aml_length =
|
|
(u16)(aml_length + (info->value * item_count));
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_GPIO_RES:
|
|
|
|
/* Set resource source string length */
|
|
|
|
item_count = ACPI_GET16(source);
|
|
ACPI_SET16(destination, aml_length);
|
|
|
|
/* Compute offset for the Vendor Data */
|
|
|
|
aml_length = (u16)(aml_length + item_count);
|
|
target = ACPI_ADD_PTR(void, aml, info->value);
|
|
|
|
/* Set vendor offset only if there is vendor data */
|
|
|
|
ACPI_SET16(target, aml_length);
|
|
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_VEN:
|
|
|
|
item_count = ACPI_GET16(source);
|
|
ACPI_SET16(destination, item_count + info->value);
|
|
aml_length = (u16)(aml_length + item_count);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_COUNT_SERIAL_RES:
|
|
|
|
item_count = ACPI_GET16(source);
|
|
aml_length = (u16)(aml_length + item_count);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_LENGTH:
|
|
|
|
acpi_rs_set_resource_length(info->value, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE8:
|
|
case ACPI_RSC_MOVE16:
|
|
case ACPI_RSC_MOVE32:
|
|
case ACPI_RSC_MOVE64:
|
|
|
|
if (info->value) {
|
|
item_count = info->value;
|
|
}
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_GPIO_PIN:
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
ACPI_GET16
|
|
(destination));
|
|
source = *(u16 **)source;
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_GPIO_RES:
|
|
|
|
/* Used for both resource_source string and vendor_data */
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
ACPI_GET16
|
|
(destination));
|
|
source = *(u8 **)source;
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_VEN:
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
(aml_length -
|
|
item_count));
|
|
source = *(u8 **)source;
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_MOVE_SERIAL_RES:
|
|
|
|
destination = (char *)ACPI_ADD_PTR(void, aml,
|
|
(aml_length -
|
|
item_count));
|
|
source = *(u8 **)source;
|
|
acpi_rs_move_data(destination, source, item_count,
|
|
info->opcode);
|
|
break;
|
|
|
|
case ACPI_RSC_ADDRESS:
|
|
|
|
/* Set the Resource Type, General Flags, and Type-Specific Flags */
|
|
|
|
acpi_rs_set_address_common(aml, resource);
|
|
break;
|
|
|
|
case ACPI_RSC_SOURCEX:
|
|
/*
|
|
* Optional resource_source (Index and String)
|
|
*/
|
|
aml_length =
|
|
acpi_rs_set_resource_source(aml,
|
|
(acpi_rs_length)
|
|
aml_length, source);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_SOURCE:
|
|
/*
|
|
* Optional resource_source (Index and String). This is the more
|
|
* complicated case used by the Interrupt() macro
|
|
*/
|
|
aml_length =
|
|
acpi_rs_set_resource_source(aml, info->value,
|
|
source);
|
|
acpi_rs_set_resource_length(aml_length, aml);
|
|
break;
|
|
|
|
case ACPI_RSC_BITMASK:
|
|
/*
|
|
* 8-bit encoded bitmask (DMA macro)
|
|
*/
|
|
ACPI_SET8(destination,
|
|
acpi_rs_encode_bitmask(source,
|
|
*ACPI_ADD_PTR(u8,
|
|
resource,
|
|
info->
|
|
value)));
|
|
break;
|
|
|
|
case ACPI_RSC_BITMASK16:
|
|
/*
|
|
* 16-bit encoded bitmask (IRQ macro)
|
|
*/
|
|
temp16 =
|
|
acpi_rs_encode_bitmask(source,
|
|
*ACPI_ADD_PTR(u8, resource,
|
|
info->value));
|
|
ACPI_MOVE_16_TO_16(destination, &temp16);
|
|
break;
|
|
|
|
case ACPI_RSC_EXIT_LE:
|
|
/*
|
|
* control - Exit conversion if less than or equal
|
|
*/
|
|
if (item_count <= info->value) {
|
|
goto exit;
|
|
}
|
|
break;
|
|
|
|
case ACPI_RSC_EXIT_NE:
|
|
/*
|
|
* control - Exit conversion if not equal
|
|
*/
|
|
switch (COMPARE_OPCODE(info)) {
|
|
case ACPI_RSC_COMPARE_VALUE:
|
|
|
|
if (*ACPI_ADD_PTR(u8, resource,
|
|
COMPARE_TARGET(info)) !=
|
|
COMPARE_VALUE(info)) {
|
|
goto exit;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
"Invalid conversion sub-opcode"));
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
break;
|
|
|
|
case ACPI_RSC_EXIT_EQ:
|
|
/*
|
|
* control - Exit conversion if equal
|
|
*/
|
|
if (*ACPI_ADD_PTR(u8, resource,
|
|
COMPARE_TARGET(info)) ==
|
|
COMPARE_VALUE(info)) {
|
|
goto exit;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
|
|
ACPI_ERROR((AE_INFO, "Invalid conversion opcode"));
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
}
|
|
|
|
count--;
|
|
info++;
|
|
}
|
|
|
|
exit:
|
|
return_ACPI_STATUS(AE_OK);
|
|
}
|
|
|
|
#if 0
|
|
/* Previous resource validations */
|
|
|
|
if (aml->ext_address64.revision_ID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION) {
|
|
return_ACPI_STATUS(AE_SUPPORT);
|
|
}
|
|
|
|
if (resource->data.start_dpf.performance_robustness >= 3) {
|
|
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
|
|
}
|
|
|
|
if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
|
|
/*
|
|
* Only [active_high, edge_sensitive] or [active_low, level_sensitive]
|
|
* polarity/trigger interrupts are allowed (ACPI spec, section
|
|
* "IRQ Format"), so 0x00 and 0x09 are illegal.
|
|
*/
|
|
ACPI_ERROR((AE_INFO,
|
|
"Invalid interrupt polarity/trigger in resource list, 0x%X",
|
|
aml->irq.flags));
|
|
return_ACPI_STATUS(AE_BAD_DATA);
|
|
}
|
|
|
|
resource->data.extended_irq.interrupt_count = temp8;
|
|
if (temp8 < 1) {
|
|
|
|
/* Must have at least one IRQ */
|
|
|
|
return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
|
|
}
|
|
|
|
if (resource->data.dma.transfer == 0x03) {
|
|
ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)"));
|
|
return_ACPI_STATUS(AE_BAD_DATA);
|
|
}
|
|
#endif
|