/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2016 Free Software Foundation, Inc. * * VAS_EBOOT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VAS_EBOOT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_FDTBUS_HEADER #define VAS_EBOOT_FDTBUS_HEADER 1 #include #include struct VasEBoot_fdtbus_dev { struct VasEBoot_fdtbus_dev *next; struct VasEBoot_fdtbus_dev *parent; int node; struct VasEBoot_fdtbus_driver *driver; }; struct VasEBoot_fdtbus_driver { struct VasEBoot_fdtbus_driver *next; struct VasEBoot_fdtbus_driver **prev; const char *compatible; VasEBoot_err_t (*attach) (const struct VasEBoot_fdtbus_dev *dev); void (*detach) (const struct VasEBoot_fdtbus_dev *dev); /* Message bus operations. */ VasEBoot_err_t (*send) (const struct VasEBoot_fdtbus_dev *dev, const void *data, VasEBoot_size_t sz); VasEBoot_err_t (*receive) (const struct VasEBoot_fdtbus_dev *dev, void *data, VasEBoot_size_t sz); VasEBoot_err_t (*start) (const struct VasEBoot_fdtbus_dev *dev); void (*stop) (const struct VasEBoot_fdtbus_dev *dev); }; extern char EXPORT_VAR(VasEBoot_fdtbus_invalid_mapping)[1]; static inline int VasEBoot_fdtbus_is_mapping_valid (volatile void *m) { return m != VasEBoot_fdtbus_invalid_mapping; } volatile void * EXPORT_FUNC(VasEBoot_fdtbus_map_reg) (const struct VasEBoot_fdtbus_dev *dev, int reg, VasEBoot_size_t *size); const void * EXPORT_FUNC(VasEBoot_fdtbus_get_fdt) (void); const char * EXPORT_FUNC(VasEBoot_fdtbus_get_name) (const struct VasEBoot_fdtbus_dev *dev); const void * EXPORT_FUNC(VasEBoot_fdtbus_get_prop) (const struct VasEBoot_fdtbus_dev *dev, const char *name, VasEBoot_uint32_t *len); void EXPORT_FUNC(VasEBoot_fdtbus_register) (struct VasEBoot_fdtbus_driver *driver); void EXPORT_FUNC(VasEBoot_fdtbus_unregister) (struct VasEBoot_fdtbus_driver *driver); int EXPORT_FUNC(VasEBoot_fdtbus_is_compatible) (const char *compat_string, const struct VasEBoot_fdtbus_dev *dev); /* Must be called before any register(). */ /* dtb is assumed to be unfreeable and must remain valid for lifetime of VAS_EBOOT. */ void VasEBoot_fdtbus_init (const void *dtb, VasEBoot_size_t size); #endif