Beispiel #1
0
static const struct imsm_orom *find_imsm_hba_orom(enum sys_dev_type hba_id)
{
	unsigned long align;

	if (hba_id >= SYS_DEV_MAX)
		return NULL;

	/* it's static data so we only need to read it once */
	if (populated_orom[hba_id]) {
		dprintf("OROM CAP: %p, pid: %d pop: %d\n",
			&imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]);
		return &imsm_orom[hba_id];
	}
	if (check_env("IMSM_TEST_OROM")) {
		dprintf("OROM CAP: %p,  pid: %d pop: %d\n",
                     &imsm_orom[hba_id], (int) getpid(), populated_orom[hba_id]);
		return imsm_platform_test(hba_id, &populated_orom[hba_id], &imsm_orom[hba_id]);
	}
	/* return empty OROM capabilities in EFI test mode */
	if (check_env("IMSM_TEST_AHCI_EFI") ||
	    check_env("IMSM_TEST_SCU_EFI"))
		return NULL;


	if (intel_devices != NULL)
		free_sys_dev(&intel_devices);

	intel_devices = find_intel_devices();

	if (intel_devices == NULL)
		return NULL;

	/* scan option-rom memory looking for an imsm signature */
	if (check_env("IMSM_SAFE_OROM_SCAN"))
		align = 2048;
	else
		align = 512;
	if (probe_roms_init(align) != 0)
		return NULL;
	probe_roms();
	/* ignore return value - True is returned if both adapater roms are found */
	scan_adapter_roms(scan);
	probe_roms_exit();

	if (intel_devices != NULL)
		free_sys_dev(&intel_devices);
	intel_devices = NULL;

	if (populated_orom[hba_id])
		return &imsm_orom[hba_id];
	return NULL;
}
Beispiel #2
0
const struct imsm_orom *find_imsm_orom(void)
{
	static int populated = 0;
	unsigned long align;

	/* it's static data so we only need to read it once */
	if (populated)
		return &imsm_orom;

	if (check_env("IMSM_TEST_OROM")) {
		memset(&imsm_orom, 0, sizeof(imsm_orom));
		imsm_orom.rlc = IMSM_OROM_RLC_RAID0 | IMSM_OROM_RLC_RAID1 |
				IMSM_OROM_RLC_RAID10 | IMSM_OROM_RLC_RAID5;
		imsm_orom.sss = IMSM_OROM_SSS_4kB | IMSM_OROM_SSS_8kB |
				IMSM_OROM_SSS_16kB | IMSM_OROM_SSS_32kB |
				IMSM_OROM_SSS_64kB | IMSM_OROM_SSS_128kB |
				IMSM_OROM_SSS_256kB | IMSM_OROM_SSS_512kB |
				IMSM_OROM_SSS_1MB | IMSM_OROM_SSS_2MB;
		imsm_orom.dpa = 6;
		imsm_orom.tds = 6;
		imsm_orom.vpa = 2;
		imsm_orom.vphba = 4;
		imsm_orom.attr = imsm_orom.rlc | IMSM_OROM_ATTR_ChecksumVerify;
		populated = 1;
		return &imsm_orom;
	}

	if (!platform_has_intel_ahci())
		return NULL;

	/* scan option-rom memory looking for an imsm signature */
	if (check_env("IMSM_SAFE_OROM_SCAN"))
		align = 2048;
	else
		align = 512;
	if (probe_roms_init(align) != 0)
		return NULL;
	probe_roms();
	populated = scan_adapter_roms(scan);
	probe_roms_exit();

	if (populated)
		return &imsm_orom;
	return NULL;
}