Beispiel #1
0
static ssize_t access_num_show(struct kobject *kobj, struct kobj_attribute *attr,
            char *buf)
{
    u8 port = 0;
    host_port_id_target(kobj, &port);
    return sprintf(buf, "%u\n", dram_host_port_acs_num_get(port));
}
Beispiel #2
0
static ssize_t priority_threshold_show(struct kobject *kobj, struct kobj_attribute *attr,
            char *buf)
{
    u8 port = 0;
    host_port_id_target(kobj, &port);
    return sprintf(buf, "%u\n", dram_host_port_prio_threshold_get(port));
}
static ssize_t priority_level_store(struct kobject *kobj, struct kobj_attribute *attr,
			 const char *buf, size_t count)
{
    u8 level, port = 0;
    char value;
    if(strlen(buf) != 2)
        return -EINVAL;
    if(buf[0] < '0' || buf[0] > '3')
		return -EINVAL;
	value = buf[0];
    switch(value)
    {
        case '3':
            level = 3;
            break;
        case '2':
            level = 2;
            break;
        case '1':
            level = 1;
            break;
        case '0':
            level = 0;
            break;
        default:
            return -EINVAL;
    }
    host_port_id_target(kobj, &port);
    dram_host_port_prio_level_set(port, level);
    return count;
}
static ssize_t cmd_num_store(struct kobject *kobj, struct kobj_attribute *attr,
			 const char *buf, size_t count)
{
	u8 num, port = 0;
    if(strlen(buf) < 2 || strlen(buf) > 4)
        return -EINVAL;
    if(strlen(buf) == 2) {
        if(buf[0] < '0' || buf[0] > '9')
            return -EINVAL;
    } else if(strlen(buf) == 3) {
        if(buf[0] < '1' || buf[0] > '9')
            return -EINVAL;
        if(buf[1] < '0' || buf[1] > '9')
            return -EINVAL;
    } else {
        if(buf[0] < '1' || buf[0] > '2')
            return -EINVAL;
        if(buf[0] == '1') {
            if((buf[1] < '0' || buf[1] > '9') || (buf[2] < '0' || buf[2] > '9'))
                return -EINVAL;
        } else {
            if((buf[1] < '0' || buf[1] > '5') || (buf[2] < '0' || buf[2] > '5'))
                return -EINVAL;
        }
    }
    num = simple_strtoul(buf, NULL, 10);
    host_port_id_target(kobj, &port);
    dram_host_port_cmd_num_set(port, num);
    return count;
}
Beispiel #5
0
static ssize_t access_num_store(struct kobject *kobj, struct kobj_attribute *attr,
            const char *buf, size_t count)
{
    unsigned int input;
    int ret;
    u8 port = 0;

    ret = sscanf(buf, "%u", &input);
    if (ret != 1)
        return -EINVAL;
    host_port_id_target(kobj, &port);
    dram_host_port_acs_num_set(port, input);
    return count;
}
static ssize_t wait_state_store(struct kobject *kobj, struct kobj_attribute *attr,
			 const char *buf, size_t count)
{
	u8 state, port = 0;
    if(strlen(buf) < 2 || strlen(buf) > 3)
        return -EINVAL;
    if(strlen(buf) == 2) {
        if(buf[0] < '0' || buf[0] > '9')
            return -EINVAL;
    } else {
        if(buf[0] != '1')
            return -EINVAL;
        if(buf[1] < '0' || buf[1] > '5')
            return -EINVAL;
    }
	state = simple_strtoul(buf, NULL, 10);
    host_port_id_target(kobj, &port);
    dram_host_port_wait_state_set(port, state);
    return count;
}
static ssize_t access_en_store(struct kobject *kobj, struct kobj_attribute *attr,
			 const char *buf, size_t count)
{
    u8 port = 0;
    char value;
    if(strlen(buf) != 2)
        return -EINVAL;
    if(buf[0] < '0' || buf[0] > '1')
		return -EINVAL;
    value = buf[0];
    host_port_id_target(kobj, &port);
    switch(value)
    {
        case '1':
            dram_host_port_acs_enable(port);
            break;
        case '0':
            dram_host_port_acs_disable(port);
            break;
        default:
            return -EINVAL;
    }
	return count;
}