亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pciregions.c

?? linux設備驅動第二版例子程序
?? C
字號:
/* * pciregions.c --  a module that prints address regions of PCI devices * * $Id: pciregions.c,v 1.9 2001/03/16 11:30:23 rubini Exp $ * * Copyright (C) 1997,2001   rubini@linux.it (Alessandro Rubini) * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */#ifndef __KERNEL__#  define __KERNEL__#endif#ifndef MODULE#  define MODULE#endif#include <linux/config.h>#include <linux/module.h>#include <linux/sched.h>#include <linux/delay.h>#include <linux/proc_fs.h>#include <linux/pci.h>#include "sysdep.h"static u32 addresses[] = {    PCI_BASE_ADDRESS_0,    PCI_BASE_ADDRESS_1,    PCI_BASE_ADDRESS_2,    PCI_BASE_ADDRESS_3,    PCI_BASE_ADDRESS_4,    PCI_BASE_ADDRESS_5,    0};int pciregions_read_proc(char *buf, char **start, off_t offset,                   int len, int *eof, void *data){    int i, pos=0;    int bus, devfn, is_multi = 0;    unsigned char headertype, pribus, secbus;    u16 vendorid, deviceid = 0;    /* to print information about several buses, keep an array of them */    #define MAXNBUS 8    int buses[MAXNBUS] = {0,};    int lastbus = 0; /* only one bus, by default, bus 0 */    int busindex = 0;    /* this macro helps keeping the following lines short */    #define PRINTF(fmt, args...) sprintf(buf+len, fmt, ## args)    len=0;    /* Loop through the devices (code not printed in the book) */    if (!pci_present())        return sprintf(buf, "PCI not available in this computer\n");    bus = buses[busindex]; /* first bus (bus 0) */    for (devfn=0; pos < PAGE_SIZE; devfn++) {	struct pci_dev *dev = NULL;	/*	 * A clean implementation	 * would have a separate function to dump a single bus, but i	 * preferred to keep it in one function to include part of it	 * in the book (the printed code is automagically extracted from	 * this file).	 *	 * Instead, I use a dirty trick to fold two loops in one.	 */	if (devfn > 0xff) { /* end of this bus */	    if (busindex == lastbus) break; 	    /* loop over to the next bus */	    bus = buses[++busindex];	    devfn = 0;	}	/*	 * This code is derived from "drivers/pci/pci.c" in version	 * 2.0, although it has been modified to work with the 2.4 interface.	 * This means that the GPL applies to this source file	 * and credit is due to the original authors	 * (Drew Eckhardt, Frederic Potter, David Mosberger-Tang)	 */        if (PCI_FUNC(devfn) && !is_multi) /* not multi-function */	    continue;	dev = pci_find_slot(bus, devfn);	if (!dev) {	    if (!PCI_FUNC(devfn)) is_multi = 0; /* no first implies no other */	    continue; /* no such device */	}	pci_read_config_byte(dev, PCI_HEADER_TYPE, &headertype);        if (!PCI_FUNC(devfn)) /* first function */	    is_multi = headertype & 0x80;	headertype &= 0x7f; /* mask multi-function bit */	/* FIXME: should get rid of the PAGE_SIZE limit */        if (len > PAGE_SIZE / 2) { /* a big margin, just to be sure */	    *eof = 1; return len;	}	vendorid = dev->vendor;	deviceid = dev->device;        len += PRINTF("Bus %i, device %2i, devfn %2i (id %04x-%04x,"		      " headertype 0x%02x)\n",		      bus, devfn>>3, devfn & 7,		      vendorid, deviceid, headertype);	if (headertype == PCI_HEADER_TYPE_BRIDGE) {	    /* This is a bridge, print what it does */	    pci_read_config_byte(dev, PCI_PRIMARY_BUS, &pribus);	    pci_read_config_byte(dev, PCI_SECONDARY_BUS, &secbus);	    len += PRINTF("\tbridge connecting PCI bus %i to PCI bus %i\n",			  secbus, pribus);	    /* remember about this bus, to dump it later */	    if (lastbus <= MAXNBUS-1) {		lastbus++;		buses[lastbus] = secbus;		len += PRINTF("\t(bus %i is dumped below)\n", secbus);	    } else {		len += PRINTF("\t(bus %i won't be dumped)\n", secbus);	    }	    pci_release_device(dev); /* 2.0 compatibility */	    continue;	} else if (headertype == PCI_HEADER_TYPE_CARDBUS) {	    /* This is a CardBus bridge, print what it does */	    pci_read_config_byte(dev, PCI_CB_PRIMARY_BUS,&pribus);	    pci_read_config_byte(dev, PCI_CB_CARD_BUS,&secbus);	    len += PRINTF("\tbridge connecting CardBus %i to PCI bus %i\n",			  secbus, pribus);	    pci_release_device(dev); /* 2.0 compatibility */	    continue;	} else if (headertype != PCI_HEADER_TYPE_NORMAL) {	    len += PRINTF("\tunknown header type, skipping\n");	    pci_release_device(dev); /* 2.0 compatibility */	    continue;	}		        /* Print the address regions of this device */        for (i=0; addresses[i]; i++) {            u32 curr, mask, size;            char *type;            pci_read_config_dword(dev, addresses[i],&curr);            cli();            pci_write_config_dword(dev, addresses[i],~0);            pci_read_config_dword(dev, addresses[i],&mask);            pci_write_config_dword(dev, addresses[i],curr);            sti();            if (!mask)		continue; /* there may be other regions */	    /*	     * apply the I/O or memory mask to current position	     * note that I/O is limited to 0xffff, and 64-bit is not	     * supported by this simple imeplementation	     */	    if (curr & PCI_BASE_ADDRESS_SPACE_IO) {		curr &= PCI_BASE_ADDRESS_IO_MASK;	    } else {		curr &= PCI_BASE_ADDRESS_MEM_MASK;	    }		            len += PRINTF("\tregion %i: mask 0x%08lx, now at 0x%08lx\n", i,                           (unsigned long)mask,                           (unsigned long)curr);            /* extract the type, and the programmable bits */            if (mask & PCI_BASE_ADDRESS_SPACE_IO) {                type = "I/O"; mask &= PCI_BASE_ADDRESS_IO_MASK;		size = (~mask + 1) & 0xffff; /* Bleah */            } else {                type = "mem"; mask &= PCI_BASE_ADDRESS_MEM_MASK;		size = ~mask + 1;            }            len += PRINTF("\tregion %i: type %s, size %i (%i%s)\n", i,                          type, size,			  (size & 0xfffff) == 0 ? size >> 20 :			    (size & 0x3ff) == 0 ? size >> 10 : size,			  (size & 0xfffff) == 0 ? "MB" :			    (size & 0x3ff) == 0 ? "KB" : "B");	    if (len > PAGE_SIZE / 2) {		len += PRINTF("... more info skipped ...\n");		*eof = 1; return len;	    }        }	pci_release_device(dev); /* 2.0 compatibility */    } /* devfn */    *eof = 1;    return len;}#ifdef USE_PROC_REGISTERstatic int pciregions_old_read_proc(char *buf, char **start, off_t offset,				 int len, int unused){    int eof;    return pciregions_read_proc(buf, start, offset, len, &eof, NULL);}struct proc_dir_entry pciregions_proc_entry = {        0,                 /* low_ino: the inode -- dynamic */       10, "pciregions",   /* len of name and name */        S_IFREG | S_IRUGO, /* mode */        1, 0, 0,           /* nlinks, owner, group */        0, NULL,           /* size - unused; operations -- use default */        &pciregions_old_read_proc,   /* function used to read data */        /* nothing more */    };#endif /* USE_PROC_REGISTER */int init_module(void){#ifdef USE_PROC_REGISTER    proc_register_dynamic(&proc_root, &pciregions_proc_entry);#else    create_proc_read_entry("pciregions", 0, NULL, pciregions_read_proc, NULL);#endif    return 0;}void cleanup_module(void){#ifdef USE_PROC_REGISTER    proc_unregister(&proc_root, pciregions_proc_entry.low_ino);#else    remove_proc_entry("pciregions", 0);#endif}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本三级韩国三级欧美三级| 国产精品久久综合| 色屁屁一区二区| 色综合天天综合色综合av| 成人av小说网| 99国产精品99久久久久久| 成人黄色软件下载| 波多野结衣精品在线| 成人涩涩免费视频| 99久久婷婷国产综合精品电影| 成人小视频在线观看| 成人av免费网站| 色婷婷综合久久久中文字幕| 91黄色在线观看| 欧美日韩国产a| 精品国产一区二区三区不卡| 久久综合久久久久88| 国产精品电影院| 五月天中文字幕一区二区| 蜜桃av噜噜一区| 成人综合婷婷国产精品久久蜜臀 | 一区二区三区小说| 亚洲国产成人av| 国产伦精一区二区三区| 99久久精品免费看| 欧美肥妇free| 国产三区在线成人av| 国产精品国产a| 亚洲国产成人av网| 国产99久久久精品| 欧美日韩精品系列| 久久久久久久精| 亚洲午夜免费电影| 国产一区激情在线| 欧美三级电影在线观看| 日韩欧美国产精品| 亚洲黄一区二区三区| 另类中文字幕网| 日本韩国一区二区三区视频| 精品理论电影在线观看| 依依成人综合视频| 国产呦萝稀缺另类资源| 欧美色爱综合网| 国产亚洲人成网站| 亚洲不卡av一区二区三区| 国产91在线观看丝袜| 91精品国产综合久久福利 | 欧美裸体一区二区三区| 亚洲国产精品二十页| 日本vs亚洲vs韩国一区三区二区| 成人精品免费看| 日韩欧美精品在线| 亚洲韩国一区二区三区| 成人激情av网| 久久一区二区视频| 日韩精品一二三区| 色噜噜狠狠色综合中国| 久久久精品蜜桃| 久久www免费人成看片高清| 欧美中文字幕一二三区视频| 中文字幕精品一区二区精品绿巨人 | 91国产免费看| 中文字幕视频一区| 国产91清纯白嫩初高中在线观看| 欧美成人a∨高清免费观看| 日日摸夜夜添夜夜添国产精品| 97se狠狠狠综合亚洲狠狠| 欧美极品另类videosde| 国产综合久久久久久鬼色| 日韩美女主播在线视频一区二区三区 | 日韩免费福利电影在线观看| 日本一不卡视频| 欧美肥妇bbw| 免费欧美高清视频| 日韩欧美一区在线观看| 日韩成人免费电影| 在线播放/欧美激情| 日韩不卡一区二区三区| 日韩欧美一二区| 久久av老司机精品网站导航| 欧美成人午夜电影| 国产精品一区二区男女羞羞无遮挡| 精品久久久久99| 国产传媒日韩欧美成人| 欧美国产综合色视频| 懂色一区二区三区免费观看| 国产精品久久国产精麻豆99网站| 成人深夜在线观看| 日韩美女视频一区二区| 色呦呦日韩精品| 亚洲va天堂va国产va久| 日韩一区二区三区观看| 国产乱码精品一区二区三区忘忧草 | 国产成人av网站| 一区二区在线免费| 在线成人av影院| 国产一区二区不卡老阿姨| 中文字幕乱码亚洲精品一区| 色噜噜狠狠色综合欧洲selulu| 亚洲.国产.中文慕字在线| 欧美一卡在线观看| 大桥未久av一区二区三区中文| 亚洲欧美日韩人成在线播放| 欧美日韩国产高清一区二区三区 | 狠狠色丁香九九婷婷综合五月 | 国产成人精品www牛牛影视| 日本一区二区免费在线观看视频| 北条麻妃国产九九精品视频| 亚洲一区二区av电影| 日韩色视频在线观看| 成人综合在线网站| 天天色综合成人网| 国产精品视频麻豆| 欧美一区日本一区韩国一区| 国产成a人亚洲| 日本怡春院一区二区| 国产精品传媒在线| 欧美电影免费观看高清完整版在线观看 | 欧美一区二区播放| 99久久精品99国产精品| 男女男精品视频网| 亚洲欧美偷拍三级| 久久亚洲综合色一区二区三区| 99精品久久只有精品| 蜜臀av一区二区| 亚洲精品视频在线看| 26uuu色噜噜精品一区二区| 色哟哟一区二区在线观看| 精品一区免费av| 调教+趴+乳夹+国产+精品| 亚洲欧洲韩国日本视频| 久久久精品免费网站| 欧美一区二区三区在线观看视频| 日本精品免费观看高清观看| 成人综合在线网站| 国产精品一卡二卡| 免费xxxx性欧美18vr| 婷婷综合在线观看| 亚洲一级二级在线| 亚洲色图20p| 综合激情成人伊人| 中文字幕制服丝袜成人av| 国产亚洲成年网址在线观看| 日韩免费性生活视频播放| 欧美电影一区二区三区| 精品视频一区二区不卡| 91久久久免费一区二区| 国产色爱av资源综合区| voyeur盗摄精品| av在线播放成人| 成人精品gif动图一区| 国产不卡免费视频| 高清不卡在线观看av| 国产又粗又猛又爽又黄91精品| 精品在线播放免费| 国产精品一区二区三区乱码| 国产精品18久久久久久久网站| 国内精品免费**视频| 国产精品77777| 高清beeg欧美| 成人精品免费视频| 日本黄色一区二区| 在线综合视频播放| 日韩欧美一区二区三区在线| 日韩欧美国产成人一区二区| 欧美成人vr18sexvr| 久久久精品综合| 国产精品传媒在线| 亚洲成人www| 久久精品久久久精品美女| 麻豆高清免费国产一区| 国产精品一区一区| 一本一道久久a久久精品| 欧美日韩一二区| www日韩大片| 亚洲人成小说网站色在线| 亚洲一区二区免费视频| 精品在线视频一区| 91麻豆精品一区二区三区| 欧美性受极品xxxx喷水| 欧美一区二区播放| 国产精品国产三级国产三级人妇| 一区二区高清在线| 狠狠色综合日日| 日本韩国欧美三级| 日韩免费看的电影| 国产精品毛片a∨一区二区三区| 悠悠色在线精品| 紧缚捆绑精品一区二区| 91在线精品秘密一区二区| 91精品国产综合久久国产大片| 国产亚洲精品aa| 日韩精品欧美成人高清一区二区| 丁香激情综合国产| 777午夜精品免费视频| 日韩一区在线播放| 国产在线精品一区在线观看麻豆| voyeur盗摄精品| 2020国产精品| 五月天激情综合|