Example #1
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 struct kobj_attribute wait_state         = HOST_PORT_ATTR(wait_state);
static struct kobj_attribute priority_threshold = HOST_PORT_ATTR(priority_threshold);
static struct kobj_attribute access_num         = HOST_PORT_ATTR(access_num);

static const struct attribute *port_attrs[] = {
    &wait_state.attr,
    &priority_threshold.attr,
    &access_num.attr,
    NULL,
};

static ssize_t show_arbiter_mode(struct device *dev, struct device_attribute *attr,
            char *buf)
{
    return sprintf(buf, "%u\n", dram_host_port_arbiter_mode_get());
}
    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;
}


static struct kobj_attribute cmd_num        = HOST_PORT_ATTR(cmd_num);
static struct kobj_attribute wait_state     = HOST_PORT_ATTR(wait_state);
static struct kobj_attribute priority_level = HOST_PORT_ATTR(priority_level);
static struct kobj_attribute access_en      = HOST_PORT_ATTR(access_en);

static const struct attribute *host_port_attrs[] = {
	&cmd_num.attr,
	&wait_state.attr,
    &priority_level.attr,
    &access_en.attr,
	NULL,
};

/* fetch dram sysconfig parameters */
static int dram_fetch_sysconfig_para(void)
{