/* * Sonics Silicon Backplane * Common SPROM support routines * * Copyright (C) 2005-2008 Michael Buesch <[email protected]> * Copyright (C) 2005 Martin Langer <[email protected]> * Copyright (C) 2005 Stefano Brivio <[email protected]> * Copyright (C) 2005 Danny van Dyk <[email protected]> * Copyright (C) 2005 Andreas Jaggi <[email protected]> * * Licensed under the GNU/GPL. See COPYING for details. */ #include "ssb_private.h" #include <linux/ctype.h> #include <linux/slab.h> static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out); static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len, size_t sprom_size_words) { … } static int hex2sprom(u16 *sprom, const char *dump, size_t len, size_t sprom_size_words) { … } /* Common sprom device-attribute show-handler */ ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf, int (*sprom_read)(struct ssb_bus *bus, u16 *sprom)) { … } /* Common sprom device-attribute store-handler */ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus, const char *buf, size_t count, int (*sprom_check_crc)(const u16 *sprom, size_t size), int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom)) { … } /** * ssb_arch_register_fallback_sprom - Registers a method providing a * fallback SPROM if no SPROM is found. * * @sprom_callback: The callback function. * * With this function the architecture implementation may register a * callback handler which fills the SPROM data structure. The fallback is * only used for PCI based SSB devices, where no valid SPROM can be found * in the shadow registers. * * This function is useful for weird architectures that have a half-assed * SSB device hardwired to their PCI bus. * * Note that it does only work with PCI attached SSB devices. PCMCIA * devices currently don't use this fallback. * Architectures must provide the SPROM for native SSB devices anyway, so * the fallback also isn't used for native devices. * * This function is available for architecture code, only. So it is not * exported. */ int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, struct ssb_sprom *out)) { … } int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) { … } /* https://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */ bool ssb_is_sprom_available(struct ssb_bus *bus) { … }