start_kernel->setup_arch->request_standard_resources

static void __init
request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
{
    struct resource *res;
    int i;

    kernel_code.start   = virt_to_phys(&_text);
    kernel_code.end     = virt_to_phys(&_etext - 1);
    kernel_data.start   = virt_to_phys(&__data_start);
    kernel_data.end     = virt_to_phys(&_end - 1);

    for (i = 0; i < mi->nr_banks; i++) {
        unsigned long virt_start, virt_end;

        if (mi->bank[i].size == 0)
            continue;

        virt_start = __phys_to_virt(mi->bank[i].start);
        virt_end   = virt_start + mi->bank[i].size - 1;

        res = alloc_bootmem_low(sizeof(*res));
        res->name  = "System RAM";
        res->start = __virt_to_phys(virt_start);
        res->end   = __virt_to_phys(virt_end);
        res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;

        request_resource(&iomem_resource, res);   //将bank资源结构res注册到系统空间资源结构iomem_resource的子资源链表上去

        if (kernel_code.start >= res->start &&
            kernel_code.end <= res->end)
            request_resource(res, &kernel_code); //将kernel_code注册到bank资源结构res上
        if (kernel_data.start >= res->start &&
            kernel_data.end <= res->end)
            request_resource(res, &kernel_data);//将kernel_data注册到bank资源结构res上
    }

    if (mdesc->video_start) {
        video_ram.start = mdesc->video_start;
        video_ram.end   = mdesc->video_end;
        request_resource(&iomem_resource, &video_ram);//将video_ram注册到iomem_resource资源结构上
    }

    /*
     * Some machines don't have the possibility of ever
     * possessing lp0, lp1 or lp2
     */
    if (mdesc->reserve_lp0)
        request_resource(&ioport_resource, &lp0); //将lp0注册到ioport_resource资源结构上
    if (mdesc->reserve_lp1)
        request_resource(&ioport_resource, &lp1); //将lp1注册到ioport_resource资源结构上
    if (mdesc->reserve_lp2)
        request_resource(&ioport_resource, &lp2); //将lp2注册到ioport_resource资源结构上
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值