david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Updated to REAL_CODE().

This commit is contained in:
Michael Brown 2006-05-24 12:32:57 +00:00
parent 53935e9dc6
commit 6631f46999
1 changed files with 36 additions and 41 deletions

View File

@ -33,20 +33,20 @@
* @ret max_bus Maximum bus number * @ret max_bus Maximum bus number
*/ */
int pcibios_max_bus ( void ) { int pcibios_max_bus ( void ) {
int discard_a; int discard_a, discard_D;
uint8_t max_bus; uint8_t max_bus;
REAL_EXEC ( rm_pcibios_check, __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
"stc\n\t" "int $0x1a\n\t"
"int $0x1a\n\t" "jnc 1f\n\t"
"jnc 1f\n\t" "xorw %%cx, %%cx\n\t"
"xorw %%cx, %%cx\n\t" "\n1:\n\t" )
"\n1:\n\t", : "=c" ( max_bus ), "=a" ( discard_a ),
2, "=D" ( discard_D )
OUT_CONSTRAINTS ( "=a" ( discard_a ), "=c" ( max_bus ) ), : "a" ( PCIBIOS_INSTALLATION_CHECK >> 16 ),
IN_CONSTRAINTS ( "a" ( PCIBIOS_INSTALLATION_CHECK >> 16 )), "D" ( 0 )
CLOBBER ( "ebx", "edx", "edi" ) ); : "ebx", "edx" );
return max_bus; return max_bus;
} }
@ -62,22 +62,19 @@ int pcibios_read ( struct pci_device *pci, uint32_t command, uint32_t *value ){
int discard_b, discard_D; int discard_b, discard_D;
int status; int status;
REAL_EXEC ( rm_pcibios_read, __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
"stc\n\t" "int $0x1a\n\t"
"int $0x1a\n\t" "jnc 1f\n\t"
"jnc 1f\n\t" "xorl %%eax, %%eax\n\t"
"xorl %%eax, %%eax\n\t" "decl %%eax\n\t"
"decl %%eax\n\t" "movl %%eax, %%ecx\n\t"
"movl %%eax, %%ecx\n\t" "\n1:\n\t" )
"\n1:\n\t", : "=a" ( status ), "=b" ( discard_b ),
4, "=c" ( *value ), "=D" ( discard_D )
OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( discard_b ), : "a" ( command >> 16 ), "D" ( command ),
"=c" ( *value ), "=D" ( discard_D ) ), "b" ( ( pci->bus << 8 ) | pci->devfn )
IN_CONSTRAINTS ( "a" ( command >> 16 ), : "edx" );
"b" ( ( pci->bus << 8 ) | pci->devfn ),
"D" ( command ) ),
CLOBBER ( "edx" ) );
return ( ( status >> 8 ) & 0xff ); return ( ( status >> 8 ) & 0xff );
} }
@ -93,19 +90,17 @@ int pcibios_write ( struct pci_device *pci, uint32_t command, uint32_t value ){
int discard_b, discard_c, discard_D; int discard_b, discard_c, discard_D;
int status; int status;
REAL_EXEC ( rm_pcibios_write, __asm__ __volatile__ ( REAL_CODE ( "stc\n\t"
"stc\n\t" "int $0x1a\n\t"
"int $0x1a\n\t" "jnc 1f\n\t"
"jnc 1f\n\t" "movb $0xff, %%ah\n\t"
"movb $0xff, %%ah\n\t" "\n1:\n\t" )
"\n1:\n\t", : "=a" ( status ), "=b" ( discard_b ),
4, "=c" ( discard_c ), "=D" ( discard_D )
OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( discard_b ), : "a" ( command >> 16 ), "D" ( command ),
"=c" ( discard_c ), "=D" ( discard_D ) ), "b" ( ( pci->bus << 8 ) | pci->devfn ),
IN_CONSTRAINTS ( "a" ( command >> 16 ), "c" ( value )
"b" ( ( pci->bus << 8 ) | pci->devfn ), : "edx" );
"c" ( value ), "D" ( command ) ),
CLOBBER ( "edx" ) );
return ( ( status >> 8 ) & 0xff ); return ( ( status >> 8 ) & 0xff );
} }