diff options
Diffstat (limited to 'lib_i386/bios_pci.S')
| -rw-r--r-- | lib_i386/bios_pci.S | 110 | 
1 files changed, 55 insertions, 55 deletions
| diff --git a/lib_i386/bios_pci.S b/lib_i386/bios_pci.S index e53791a15..b57b7260a 100644 --- a/lib_i386/bios_pci.S +++ b/lib_i386/bios_pci.S @@ -1,7 +1,7 @@  /*   * (C) Copyright 2002   * Daniel Engström, Omicron Ceti AB, daniel@omicron.se - *  + *   * See file CREDITS for list of people who contributed to this   * project.   * @@ -23,10 +23,10 @@  /*   * x86 realmode assembly implementation of a PCI BIOS - * for platforms that use one PCI hose and configuration  + * for platforms that use one PCI hose and configuration   * access type 1. (The common case for low-end PC's)   */ -  +  #include "bios.h"  #define PCI_BIOS_DEBUG @@ -39,8 +39,8 @@ realmode_pci_bios_call_entry:  	call realmode_pci_bios  	RESTORE_CALLERS_STACK  	ret -	 -	 + +  .globl realmode_pci_bios  realmode_pci_bios:  gs	movw	OFFS_AX(%bp), %ax @@ -69,7 +69,7 @@ gs	movw	OFFS_AX(%bp), %ax  	cmpb	$15, %al  	je	pci_bios_set_irq  	jmp	unknown_function -	 +  /*****************************************************************************/  pci_bios_present: @@ -77,31 +77,31 @@ pci_bios_present:  cs	incl	num_pci_bios_present  #endif  	movl	$0x20494350, %eax -gs	movl	%eax, OFFS_EDX(%bp)	 +gs	movl	%eax, OFFS_EDX(%bp)  	movb	$0x01, %al -gs	movb	%al, OFFS_AL(%bp)	/* We support cfg type 1 */  -	movw	$0x0210, %ax            /* version 2.10 */	 -gs	movw	%ax, OFFS_BX(%bp)	 +gs	movb	%al, OFFS_AL(%bp)	/* We support cfg type 1 */ +	movw	$0x0210, %ax            /* version 2.10 */ +gs	movw	%ax, OFFS_BX(%bp)  cs	movb	pci_last_bus, %al       /* last bus number */ -gs	movb	%al, OFFS_CL(%bp)	 +gs	movb	%al, OFFS_CL(%bp)  	jmp 	clear_carry  /*****************************************************************************/  /* device 0-31, function 0-7 */ -pci_bios_find_device:	 +pci_bios_find_device:  #ifdef PCI_BIOS_DEBUG  cs	incl 	num_pci_bios_find_device  #endif -gs	movw	OFFS_CX(%bp), %di  +gs	movw	OFFS_CX(%bp), %di  	shll	$16, %edi -gs	movw	OFFS_DX(%bp), %di       /* edi now holds device in upper 16  -                                         * bits and vendor in lower 16 bits */ -gs	movw	OFFS_SI(%bp), %si 	 +gs	movw	OFFS_DX(%bp), %di       /* edi now holds device in upper 16 +					 * bits and vendor in lower 16 bits */ +gs	movw	OFFS_SI(%bp), %si  	xorw	%bx, %bx                /* start at bus 0 dev 0 function 0 */ -pfd_loop:	 -	xorw	%ax, %ax		/* dword 0 is vendor/device */	 -	call	__pci_bios_select_register		 +pfd_loop: +	xorw	%ax, %ax		/* dword 0 is vendor/device */ +	call	__pci_bios_select_register  	movw	$0xcfc, %dx  	inl	%dx, %eax  	cmpl	%edi, %eax		/* our device ? */ @@ -111,8 +111,8 @@ pfd_next_dev:  	movw	%bx, %ax  	andw	$3, %ax  	jnz	pfd_function_not_zero -	movw	$0x000c, %ax	 -	call	__pci_bios_select_register		 +	movw	$0x000c, %ax +	call	__pci_bios_select_register  	movw	$0xcfe, %dx  	inb	%dx, %al  	andb	$0x80, %al @@ -121,11 +121,11 @@ pfd_function_not_zero:  	incw	%bx			/* next function, overflows in to  					 * device number, then bus number */  	jmp	pfd_check_bus -	 +  pfd_not_multi_function:  	andw	$0xfff8, %bx            /* remove function bits */  	addw	$0x0008, %bx            /* next device, overflows in to bus number */ -pfd_check_bus:	 +pfd_check_bus:  cs	movb	pci_last_bus, %ah  	cmpb	%ah, %bh  	ja	pfd_not_found @@ -136,7 +136,7 @@ pfd_found_one:  	jmp	pfd_next_dev  pfd_done: -gs	movw	%bx, OFFS_BX(%bp)  +gs	movw	%bx, OFFS_BX(%bp)  	jmp	clear_carry  pfd_not_found: @@ -149,13 +149,13 @@ pci_bios_find_class:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_find_class  #endif -gs	movl	OFFS_ECX(%bp), %edi  -	andl	$0x00ffffff, %edi       /* edi now holds class-code in lower 24 bits */  -gs	movw	OFFS_SI(%bp), %si 	 +gs	movl	OFFS_ECX(%bp), %edi +	andl	$0x00ffffff, %edi       /* edi now holds class-code in lower 24 bits */ +gs	movw	OFFS_SI(%bp), %si  	xorw	%bx, %bx                /* start at bus 0 dev 0 function 0 */ -pfc_loop:	 -	movw	$8, %ax			/* dword 8 is class-code high 24bits */	 -	call	__pci_bios_select_register		 +pfc_loop: +	movw	$8, %ax			/* dword 8 is class-code high 24bits */ +	call	__pci_bios_select_register  	movw	$0xcfc, %dx  	inl	%dx, %eax  	shrl	$8, %eax @@ -166,8 +166,8 @@ pfc_next_dev:  	/* check for multi function devices */  	andw	$3, %bx  	jnz	pfc_function_not_zero -	movw	$0x000c, %ax	 -	call	__pci_bios_select_register		 +	movw	$0x000c, %ax +	call	__pci_bios_select_register  	movw	$0xcfe, %dx  	inb	%dx, %al  	andb	$0x80, %al @@ -176,11 +176,11 @@ pfc_function_not_zero:  	incw	%bx			/* next function, overflows in to  					 * device number, then bus number */  	jmp	pfc_check_bus -	 +  pfc_not_multi_function:  	andw	$0xfff8, %bx            /* remove function bits */  	addw	$0x0008, %bx            /* next device, overflows in to bus number */ -pfc_check_bus:	 +pfc_check_bus:  cs	movb	pci_last_bus, %ah  	cmpb	%ah, %bh  	ja	pfc_not_found @@ -191,7 +191,7 @@ pfc_found_one:  	jmp	pfc_next_dev  pfc_done: -gs	movw	%bx, OFFS_BX(%bp)  +gs	movw	%bx, OFFS_BX(%bp)  	jmp	clear_carry  pfc_not_found: @@ -206,24 +206,24 @@ cs	incl	num_pci_bios_generate_special_cycle  #endif  	movb	$0x81, %ah              /* function not supported */  	jmp	set_carry -	 +  /*****************************************************************************/ -pci_bios_read_cfg_byte:  +pci_bios_read_cfg_byte:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_read_cfg_byte  #endif -	call	pci_bios_select_register	 +	call	pci_bios_select_register  gs	movw 	OFFS_DI(%bp), %dx  	andw	$3, %dx  	addw	$0xcfc, %dx  	inb	%dx, %al -gs	movb	%al, OFFS_CL(%bp)	    +gs	movb	%al, OFFS_CL(%bp)  	jmp 	clear_carry  /*****************************************************************************/ -pci_bios_read_cfg_word:  +pci_bios_read_cfg_word:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_read_cfg_word  #endif @@ -232,20 +232,20 @@ gs	movw 	OFFS_DI(%bp), %dx  	andw	$2, %dx  	addw	$0xcfc, %dx  	inw	%dx, %ax -gs	movw	%ax, OFFS_CX(%bp)	    +gs	movw	%ax, OFFS_CX(%bp)  	jmp 	clear_carry  /*****************************************************************************/ -pci_bios_read_cfg_dword:  +pci_bios_read_cfg_dword:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_read_cfg_dword  #endif  	call	pci_bios_select_register  	movw	$0xcfc, %dx  	inl	%dx, %eax -gs	movl	%eax, OFFS_ECX(%bp)	     +gs	movl	%eax, OFFS_ECX(%bp)  	jmp 	clear_carry  /*****************************************************************************/ @@ -254,35 +254,35 @@ pci_bios_write_cfg_byte:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_write_cfg_byte  #endif -	call	pci_bios_select_register	 +	call	pci_bios_select_register  gs	movw 	OFFS_DI(%bp), %dx  gs	movb	OFFS_CL(%bp), %al  	andw	$3, %dx  	addw	$0xcfc, %dx  	outb	%al, %dx  	jmp 	clear_carry -	 +  /*****************************************************************************/  pci_bios_write_cfg_word:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_write_cfg_word  #endif -	call	pci_bios_select_register	 +	call	pci_bios_select_register  gs	movw 	OFFS_DI(%bp), %dx  gs	movw	OFFS_CX(%bp), %ax  	andw	$2, %dx  	addw	$0xcfc, %dx  	outw	%ax, %dx  	jmp 	clear_carry -	 +  /*****************************************************************************/  pci_bios_write_cfg_dword:  #ifdef PCI_BIOS_DEBUG  cs	incl	num_pci_bios_write_cfg_dword  #endif -	call	pci_bios_select_register	 +	call	pci_bios_select_register  gs	movl	OFFS_ECX(%bp), %eax  	movw	$0xcfc, %dx  	outl	%eax, %dx @@ -296,7 +296,7 @@ cs	incl	num_pci_bios_get_irq_routing  #endif  	movb	$0x81, %ah              /* function not supported */  	jmp	set_carry -	 +  /*****************************************************************************/  pci_bios_set_irq: @@ -316,7 +316,7 @@ cs	incl	num_pci_bios_unknown_function  	jmp	set_carry  /*****************************************************************************/ -		 +  pci_bios_select_register:  gs	movw 	OFFS_BX(%bp), %bx  gs	movw 	OFFS_DI(%bp), %ax @@ -339,11 +339,11 @@ gs	movw	OFFS_FLAGS(%bp), %ax  	andw	$0xfffe, %ax			/* clear carry -- function succeeded */  gs	movw	%ax, OFFS_FLAGS(%bp)  	xorw	%ax, %ax -gs	movb	%ah, OFFS_AH(%bp)	 +gs	movb	%ah, OFFS_AH(%bp)  	ret  set_carry: -gs	movb	%ah, OFFS_AH(%bp)	 +gs	movb	%ah, OFFS_AH(%bp)  gs	movw	OFFS_FLAGS(%bp), %ax  	orw	$1, %ax				/* return carry -- function not supported */  gs	movw	%ax, OFFS_FLAGS(%bp) @@ -360,7 +360,7 @@ pci_last_bus:  .globl num_pci_bios_present  num_pci_bios_present:  	.long 	0 -	 +  .globl num_pci_bios_find_device  num_pci_bios_find_device:  	.long 	0 @@ -370,9 +370,9 @@ num_pci_bios_find_class:  	.long 	0  .globl num_pci_bios_generate_special_cycle -num_pci_bios_generate_special_cycle:  +num_pci_bios_generate_special_cycle:  	.long 0 -	 +  .globl num_pci_bios_read_cfg_byte  num_pci_bios_read_cfg_byte:  	.long 	0 |