- 論壇徽章:
- 0
|
#include
__FBSDID("$FreeBSD: src/sys/i386/bios/mca_machdep.c,v 1.9 2004/08/31 21:51:51 mdodd Exp $");
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* 全局微通道總線標(biāo)志,0代表沒(méi)有微通道,1代表有*/
int MCA_system = 0;
/* 由BIOS的15號(hào)C0字功能調(diào)用后返回的系統(tǒng)配置結(jié)構(gòu) */
struct sys_config {
u_int16_t count;
u_int8_t model;
u_int8_t submodel;
u_int8_t bios_rev;
u_int8_t feature;
#define FEATURE_MCAISA 0x01 /* 含有微通道和ISA總線*/
#define FEATURE_MCABUS 0x02 /* 含有微通道 */
#define FEATURE_EBDA 0x04 /* 擴(kuò)充的BIOS數(shù)據(jù)區(qū)被分配*/
#define FEATURE_WAITEV 0x08 /* 支持?jǐn)U充事件等待*/
#define FEATURE_KBDINT 0x10 /* INT 09H 中斷為鍵盤*/
#define FEATURE_RTC 0x20 /* 實(shí)時(shí)鐘存在*/
#define FEATURE_IC2 0x40 /* 第二中斷芯片存在*/
#define FEATURE_DMA3 0x80 /* DMA 通道 3 由磁盤BIOS使用*/
u_int8_t pad[3];
} __packed;
/* 函數(shù)原形 */
static void bios_mcabus_present (void *);
SYSINIT(mca_present, SI_SUB_CPU, SI_ORDER_ANY, bios_mcabus_present, NULL);
/* Functions */
static void
bios_mcabus_present(void * dummy)
{
struct vm86frame vmf; /*CPU的寄存器結(jié)構(gòu),可以32位,16位,8位表示法.見/sys/i386/include/vm86.h*/
struct sys_config * scp;
vm_offset_t paddr;
bzero(&vmf, sizeof(struct vm86frame));/*分配一段內(nèi)存(按字節(jié)方式,因?yàn)榧拇嫫骺擅枋龅阶止?jié),即8位,如AH,AL等)*/
vmf.vmf_ah = 0xc0;/*準(zhǔn)備BIOS中斷調(diào)用,準(zhǔn)備調(diào)用的AH寄存器對(duì)應(yīng)結(jié)構(gòu)成員放入C0,*/
if (vm86_intcall(0x15, &vmf)) {/*BIOS中斷調(diào)用INT 15,我的中斷大全丟了,沒(méi)查到,看下文估計(jì)是PS/2鼠標(biāo)?*/
/* bootverbose參數(shù)在init_main.c主程序中申明.意思是在啟動(dòng)時(shí)候是否打印出一些問(wèn)題細(xì)節(jié).文件的申明如下:
int bootverbose;
SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");
該變量位于debug節(jié)點(diǎn)下.可以用sysctl debug.bootverbose來(lái)顯示,由于讀寫標(biāo)記為CTLFLAG_RW,說(shuō)明它可以設(shè)置的.
*/
if (bootverbose) {
printf("BIOS SDT: INT call failed.\n");
}
return;
}
if ((vmf.vmf_ah != 0) && (vmf.vmf_flags & 0x01)) {/*AH寄存器返回值為非0并且標(biāo)志位的第一位置位,有錯(cuò)誤*/
if (bootverbose) {
printf("BIOS SDT: Not supported. Not PS/2?\n");
printf("BIOS SDT: AH 0x%02x, Flags 0x%04x\n",
vmf.vmf_ah, vmf.vmf_flags);
}
return;
}
paddr = vmf.vmf_es;/*中斷調(diào)用后返回?cái)?shù)據(jù)在ES:BX中*/
paddr = (paddr model, scp->submodel, scp->bios_rev);
printf("BIOS SDT: features 0x%b\n", scp->feature,
"\20"
"\01MCA+ISA"
"\02MCA"
"\03EBDA"
"\04WAITEV"
"\05KBDINT"
"\06RTC"
"\07IC2"
"\08DMA3"
"\n");
}
MCA_system = ((scp->feature & FEATURE_MCABUS) ? 1 : 0);/*是微通道總線嗎?*/
if (MCA_system)
printf("MicroChannel Architecture System detected.\n");
return;
}
int
mca_bus_nmi (void)
/*
在/sys/i386/isa/nmi.c中對(duì)其調(diào)用.用于微通道總線不可屏蔽的中斷處理程序的一支撐函數(shù)
該程序的被調(diào)用有個(gè)前提,MAC_system=1即機(jī)器有微通道總線.
*/
{
int slot;
int retval = 0;
int pos5 = 0;
/* 關(guān)閉主板設(shè)置寄存器. mca_busreg.h(74)定義了I/O口:#define MCA_MB_SETUP_REG 0x94 */
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
/* 搜尋每個(gè)槽位 */
for (slot = 0; slot
本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/2681/showart_110214.html |
|