示例#1
0
文件: pcibr_ate.c 项目: 274914765/C
/*
 * Allocate "count" contiguous Bridge Address Translation Entries
 * on the specified bridge to be used for PCI to XTALK mappings.
 * Indices in rm map range from 1..num_entries.  Indices returned
 * to caller range from 0..num_entries-1.
 *
 * Return the start index on success, -1 on failure.
 */
int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
{
    int status;
    unsigned long flags;

    spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
    status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);
    spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);

    return status;
}
示例#2
0
/*
 * Allocate "count" contiguous Bridge Address Translation Entries
 * on the specified bridge to be used for PCI to XTALK mappings.
 * Indices in rm map range from 1..num_entries.  Indicies returned
 * to caller range from 0..num_entries-1.
 *
 * Return the start index on success, -1 on failure.
 */
int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
{
	int status = 0;
	uint64_t flag;

	flag = pcibr_lock(pcibus_info);
	status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);

	if (status < 0) {
		/* Failed to allocate */
		pcibr_unlock(pcibus_info, flag);
		return -1;
	}

	pcibr_unlock(pcibus_info, flag);

	return status;
}