Use volatile keywords properly.
This commit is contained in:
parent
c187c1fbf8
commit
8c2b353ead
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243712
@ -313,7 +313,7 @@ static int
|
||||
pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
|
||||
unsigned bytes)
|
||||
{
|
||||
volatile vm_offset_t va;
|
||||
vm_offset_t va;
|
||||
int data = -1;
|
||||
|
||||
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
|
||||
@ -324,16 +324,16 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
|
||||
|
||||
switch (bytes) {
|
||||
case 4:
|
||||
__asm __volatile("movl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint32_t *)va));
|
||||
__asm("movl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint32_t *)va));
|
||||
break;
|
||||
case 2:
|
||||
__asm __volatile("movzwl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint16_t *)va));
|
||||
__asm("movzwl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint16_t *)va));
|
||||
break;
|
||||
case 1:
|
||||
__asm __volatile("movzbl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint8_t *)va));
|
||||
__asm("movzbl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint8_t *)va));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ static void
|
||||
pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
|
||||
unsigned bytes)
|
||||
{
|
||||
volatile vm_offset_t va;
|
||||
vm_offset_t va;
|
||||
|
||||
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
|
||||
func > PCI_FUNCMAX || reg > PCIE_REGMAX)
|
||||
@ -354,15 +354,15 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
|
||||
|
||||
switch (bytes) {
|
||||
case 4:
|
||||
__asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va)
|
||||
__asm("movl %1, %0" : "=m" (*(volatile uint32_t *)va)
|
||||
: "a" (data));
|
||||
break;
|
||||
case 2:
|
||||
__asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va)
|
||||
__asm("movw %1, %0" : "=m" (*(volatile uint16_t *)va)
|
||||
: "a" ((uint16_t)data));
|
||||
break;
|
||||
case 1:
|
||||
__asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va)
|
||||
__asm("movb %1, %0" : "=m" (*(volatile uint8_t *)va)
|
||||
: "a" ((uint8_t)data));
|
||||
break;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
|
||||
unsigned bytes)
|
||||
{
|
||||
struct pcie_cfg_elem *elem;
|
||||
volatile vm_offset_t va;
|
||||
vm_offset_t va;
|
||||
vm_paddr_t pa, papage;
|
||||
int data = -1;
|
||||
|
||||
@ -681,16 +681,16 @@ pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
|
||||
|
||||
switch (bytes) {
|
||||
case 4:
|
||||
__asm __volatile("movl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint32_t *)va));
|
||||
__asm("movl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint32_t *)va));
|
||||
break;
|
||||
case 2:
|
||||
__asm __volatile("movzwl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint16_t *)va));
|
||||
__asm("movzwl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint16_t *)va));
|
||||
break;
|
||||
case 1:
|
||||
__asm __volatile("movzbl %1, %0" : "=a" (data)
|
||||
: "m" (*(uint8_t *)va));
|
||||
__asm("movzbl %1, %0" : "=a" (data)
|
||||
: "m" (*(volatile uint8_t *)va));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
|
||||
unsigned bytes)
|
||||
{
|
||||
struct pcie_cfg_elem *elem;
|
||||
volatile vm_offset_t va;
|
||||
vm_offset_t va;
|
||||
vm_paddr_t pa, papage;
|
||||
|
||||
if (bus < pcie_minbus || bus > pcie_maxbus || slot > PCI_SLOTMAX ||
|
||||
@ -718,15 +718,15 @@ pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
|
||||
|
||||
switch (bytes) {
|
||||
case 4:
|
||||
__asm __volatile("movl %1, %0" : "=m" (*(uint32_t *)va)
|
||||
__asm("movl %1, %0" : "=m" (*(volatile uint32_t *)va)
|
||||
: "a" (data));
|
||||
break;
|
||||
case 2:
|
||||
__asm __volatile("movw %1, %0" : "=m" (*(uint16_t *)va)
|
||||
__asm("movw %1, %0" : "=m" (*(volatile uint16_t *)va)
|
||||
: "a" ((uint16_t)data));
|
||||
break;
|
||||
case 1:
|
||||
__asm __volatile("movb %1, %0" : "=m" (*(uint8_t *)va)
|
||||
__asm("movb %1, %0" : "=m" (*(volatile uint8_t *)va)
|
||||
: "a" ((uint8_t)data));
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user