static int urtwn_rtl8192cfwT_fw_modevent(module_t mod, int type, void *unused) { const struct firmware *fp, *parent; int error; switch (type) { case MOD_LOAD: TUNABLE_LONG_FETCH("legal.realtek.license_ack", &realtek_license_ack); if (!realtek_license_ack) { printf("urtwn-rtl8192cfwT: You need to read the LICENSE file in /usr/share/doc/legal/realtek.LICENSE.\n"); printf("urtwn-rtl8192cfwT: If you agree with the license, set legal.realtek.license_ack=1 in /boot/loader.conf.\n"); return(EPERM); } fp = firmware_register("urtwn-rtl8192cfwT", _binary_urtwn_rtl8192cfwT_fw_start , (size_t)(_binary_urtwn_rtl8192cfwT_fw_end - _binary_urtwn_rtl8192cfwT_fw_start), 111, NULL); if (fp == NULL) goto fail_0; parent = fp; return (0); fail_0: return (ENXIO); case MOD_UNLOAD: error = firmware_unregister("urtwn-rtl8192cfwT"); return (error); } return (EINVAL); }
static int __init acpi_init (void) { int result = 0; ACPI_FUNCTION_TRACE("acpi_init"); printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); if (acpi_disabled) { printk(KERN_INFO PREFIX "Interpreter disabled.\n"); return_VALUE(-ENODEV); } firmware_register(&acpi_subsys); result = acpi_bus_init(); if (!result) { #ifdef CONFIG_PM if (!PM_IS_ACTIVE()) pm_active = 1; else { printk(KERN_INFO PREFIX "APM is already active, exiting\n"); disable_acpi(); result = -ENODEV; } #endif } else disable_acpi(); return_VALUE(result); }
/* * For now we register the stable subsystem with the firmware subsystem * and the paths subsystem with the stable subsystem */ static int __init pdc_stable_init(void) { struct subsys_attribute *attr; int i, rc = 0, error = 0; /* find the size of the stable storage */ if (pdc_stable_get_size(&pdcs_size) != PDC_OK) return -ENODEV; /* make sure we have enough data */ if (pdcs_size < 96) return -ENODATA; printk(KERN_INFO PDCS_PREFIX " facility v%s\n", PDCS_VERSION); /* For now we'll register the stable subsys within this driver */ if ((rc = firmware_register(&stable_subsys))) goto fail_firmreg; /* Don't forget the root entries */ for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++) if (attr->show) error = subsys_create_file(&stable_subsys, attr); /* register the paths subsys as a subsystem of stable subsys */ kset_set_kset_s(&paths_subsys, stable_subsys); if ((rc= subsystem_register(&paths_subsys))) goto fail_subsysreg; /* now we create all "files" for the paths subsys */ if ((rc = pdcs_register_pathentries())) goto fail_pdcsreg; return rc; fail_pdcsreg: pdcs_unregister_pathentries(); subsystem_unregister(&paths_subsys); fail_subsysreg: firmware_unregister(&stable_subsys); fail_firmreg: printk(KERN_INFO PDCS_PREFIX " bailing out\n"); return rc; }
/* * Create a calibration block from memory mapped SPI data for use by * various drivers. Right now it's just ath(4) but later board support * will include 802.11ac NICs with calibration data in NOR flash. * * (Yes, there are a handful of QCA MIPS boards with QCA9880v2 802.11ac chips * with calibration data in flash..) */ static void ar71xx_platform_create_cal_data(device_t dev, int id, long int flash_addr, int size) { char buf[64]; uint16_t *cal_data = (uint16_t *) MIPS_PHYS_TO_KSEG1(flash_addr); void *eeprom = NULL; const struct firmware *fw = NULL; device_printf(dev, "EEPROM firmware: 0x%lx @ %d bytes\n", flash_addr, size); eeprom = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO); if (! eeprom) { device_printf(dev, "%s: malloc failed for '%s', aborting EEPROM\n", __func__, buf); return; } memcpy(eeprom, cal_data, size); /* * Generate a flash EEPROM 'firmware' from the given memory * region. Since the SPI controller will eventually * go into port-IO mode instead of memory-mapped IO * mode, a copy of the EEPROM contents is required. */ snprintf(buf, sizeof(buf), "%s.%d.map.%d.eeprom_firmware", device_get_name(dev), device_get_unit(dev), id); fw = firmware_register(buf, eeprom, size, 1, NULL); if (fw == NULL) { device_printf(dev, "%s: firmware_register (%s) failed\n", __func__, buf); free(eeprom, M_DEVBUF); return; } device_printf(dev, "device EEPROM '%s' registered\n", buf); }
static int mxge_ethp_z8e_fw_modevent(module_t mod, int type, void *unused) { const struct firmware *fp, *parent; int error; switch (type) { case MOD_LOAD: fp = firmware_register("mxge_ethp_z8e", ethp_z8e, (size_t)ethp_z8e_length, ethp_z8e_uncompressed_length, NULL); if (fp == NULL) goto fail_0; parent = fp; return (0); fail_0: return (ENXIO); case MOD_UNLOAD: error = firmware_unregister("mxge_ethp_z8e"); return (error); } return (EINVAL); }
static int cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused) { const struct firmware *fp, *parent; int error; switch (type) { case MOD_LOAD: fp = firmware_register("cxgb_t3b_tp_eeprom", t3b_tp_eeprom, (size_t)t3b_tp_eeprom_length, 0, NULL); if (fp == NULL) goto fail_0; parent = fp; return (0); fail_0: return (ENXIO); case MOD_UNLOAD: error = firmware_unregister("cxgb_t3b_tp_eeprom"); return (error); } return (EINVAL); }
/* * test_reg_firm * test call to register_firmware, which will * register the subsystem, takes in a struct * subsystem pointer, we can use our bus pointer * that should have been found in a previous test * to pass in a subsystem pointer, returns an * error code */ static int test_reg_firm() { struct subsystem *subsys = NULL; /* check pointer exists */ if (!(subsys = &test_bus_type.subsys)) { printk("tbase: subsys pointer not set in reg firmware\n"); return 1; } /* unregiser firmware */ firmware_unregister(subsys); /* make test call */ if (firmware_register(subsys)) { printk("tbase: failed register firmware\n"); return 1; } else { printk("tbase: regsitered firmware\n"); return 0; } }
/** * edd_init() - creates sysfs tree of EDD data * * This assumes that eddnr and edd were * assigned in setup.c already. */ static int __init edd_init(void) { unsigned int i; int rc=0; struct edd_device *edev; printk(KERN_INFO "BIOS EDD facility v%s, %d devices found\n", EDD_VERSION, eddnr); printk(KERN_INFO "Please report your BIOS at %s\n", REPORT_URL); if (!eddnr) { printk(KERN_INFO "EDD information not available.\n"); return 1; } rc = firmware_register(&edd_subsys); if (rc) return rc; for (i = 0; i < eddnr && i < EDDMAXNR && !rc; i++) { edev = kmalloc(sizeof (*edev), GFP_KERNEL); if (!edev) return -ENOMEM; rc = edd_device_register(edev, i); if (rc) { kfree(edev); break; } edd_devices[i] = edev; } if (rc) firmware_unregister(&edd_subsys); return rc; }