1 // Copyright 2017 The Fuchsia Authors 2 // 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file or at 5 // https://opensource.org/licenses/MIT 6 7 #pragma once 8 9 #include <lk/init.h> 10 #include <zircon/compiler.h> 11 12 __BEGIN_CDECLS 13 14 typedef void (*lk_pdev_init_hook)(const void* driver_data, uint32_t length); 15 16 // for registering platform drivers 17 struct lk_pdev_init_struct { 18 uint32_t type; // driver type, as defined in <zircon/boot/kernel-drivers.h> 19 lk_pdev_init_hook hook; // hook for driver init 20 uint level; // init level for the hook 21 const char* name; 22 }; 23 24 #define LK_PDEV_INIT(_name, _type, _hook, _level) \ 25 __ALIGNED(sizeof(void*)) \ 26 __USED __SECTION(".data.rel.ro.lk_pdev_init") static const struct lk_pdev_init_struct _dev_init_struct_##_name = { \ 27 .type = _type, \ 28 .hook = _hook, \ 29 .level = _level, \ 30 .name = #_name, \ 31 }; 32 33 __END_CDECLS 34