@@ -270,10 +270,10 @@ static const struct pci_bridge_reg_behavior pcie_cap_regs_behavior[] = {
270
270
int pci_bridge_emul_init (struct pci_bridge_emul * bridge ,
271
271
unsigned int flags )
272
272
{
273
- bridge -> conf .class_revision |= PCI_CLASS_BRIDGE_PCI << 16 ;
273
+ bridge -> conf .class_revision |= cpu_to_le32 ( PCI_CLASS_BRIDGE_PCI << 16 ) ;
274
274
bridge -> conf .header_type = PCI_HEADER_TYPE_BRIDGE ;
275
275
bridge -> conf .cache_line_size = 0x10 ;
276
- bridge -> conf .status = PCI_STATUS_CAP_LIST ;
276
+ bridge -> conf .status = cpu_to_le16 ( PCI_STATUS_CAP_LIST ) ;
277
277
bridge -> pci_regs_behavior = kmemdup (pci_regs_behavior ,
278
278
sizeof (pci_regs_behavior ),
279
279
GFP_KERNEL );
@@ -284,8 +284,9 @@ int pci_bridge_emul_init(struct pci_bridge_emul *bridge,
284
284
bridge -> conf .capabilities_pointer = PCI_CAP_PCIE_START ;
285
285
bridge -> pcie_conf .cap_id = PCI_CAP_ID_EXP ;
286
286
/* Set PCIe v2, root port, slot support */
287
- bridge -> pcie_conf .cap = PCI_EXP_TYPE_ROOT_PORT << 4 | 2 |
288
- PCI_EXP_FLAGS_SLOT ;
287
+ bridge -> pcie_conf .cap =
288
+ cpu_to_le16 (PCI_EXP_TYPE_ROOT_PORT << 4 | 2 |
289
+ PCI_EXP_FLAGS_SLOT );
289
290
bridge -> pcie_cap_regs_behavior =
290
291
kmemdup (pcie_cap_regs_behavior ,
291
292
sizeof (pcie_cap_regs_behavior ),
@@ -327,7 +328,7 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where,
327
328
int reg = where & ~3 ;
328
329
pci_bridge_emul_read_status_t (* read_op )(struct pci_bridge_emul * bridge ,
329
330
int reg , u32 * value );
330
- u32 * cfgspace ;
331
+ __le32 * cfgspace ;
331
332
const struct pci_bridge_reg_behavior * behavior ;
332
333
333
334
if (bridge -> has_pcie && reg >= PCI_CAP_PCIE_END ) {
@@ -343,11 +344,11 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where,
343
344
if (bridge -> has_pcie && reg >= PCI_CAP_PCIE_START ) {
344
345
reg -= PCI_CAP_PCIE_START ;
345
346
read_op = bridge -> ops -> read_pcie ;
346
- cfgspace = (u32 * ) & bridge -> pcie_conf ;
347
+ cfgspace = (__le32 * ) & bridge -> pcie_conf ;
347
348
behavior = bridge -> pcie_cap_regs_behavior ;
348
349
} else {
349
350
read_op = bridge -> ops -> read_base ;
350
- cfgspace = (u32 * ) & bridge -> conf ;
351
+ cfgspace = (__le32 * ) & bridge -> conf ;
351
352
behavior = bridge -> pci_regs_behavior ;
352
353
}
353
354
@@ -357,7 +358,7 @@ int pci_bridge_emul_conf_read(struct pci_bridge_emul *bridge, int where,
357
358
ret = PCI_BRIDGE_EMUL_NOT_HANDLED ;
358
359
359
360
if (ret == PCI_BRIDGE_EMUL_NOT_HANDLED )
360
- * value = cfgspace [reg / 4 ];
361
+ * value = le32_to_cpu ( cfgspace [reg / 4 ]) ;
361
362
362
363
/*
363
364
* Make sure we never return any reserved bit with a value
@@ -387,7 +388,7 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where,
387
388
int mask , ret , old , new , shift ;
388
389
void (* write_op )(struct pci_bridge_emul * bridge , int reg ,
389
390
u32 old , u32 new , u32 mask );
390
- u32 * cfgspace ;
391
+ __le32 * cfgspace ;
391
392
const struct pci_bridge_reg_behavior * behavior ;
392
393
393
394
if (bridge -> has_pcie && reg >= PCI_CAP_PCIE_END )
@@ -414,11 +415,11 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where,
414
415
if (bridge -> has_pcie && reg >= PCI_CAP_PCIE_START ) {
415
416
reg -= PCI_CAP_PCIE_START ;
416
417
write_op = bridge -> ops -> write_pcie ;
417
- cfgspace = (u32 * ) & bridge -> pcie_conf ;
418
+ cfgspace = (__le32 * ) & bridge -> pcie_conf ;
418
419
behavior = bridge -> pcie_cap_regs_behavior ;
419
420
} else {
420
421
write_op = bridge -> ops -> write_base ;
421
- cfgspace = (u32 * ) & bridge -> conf ;
422
+ cfgspace = (__le32 * ) & bridge -> conf ;
422
423
behavior = bridge -> pci_regs_behavior ;
423
424
}
424
425
@@ -431,7 +432,7 @@ int pci_bridge_emul_conf_write(struct pci_bridge_emul *bridge, int where,
431
432
/* Clear the W1C bits */
432
433
new &= ~((value << shift ) & (behavior [reg / 4 ].w1c & mask ));
433
434
434
- cfgspace [reg / 4 ] = new ;
435
+ cfgspace [reg / 4 ] = cpu_to_le32 ( new ) ;
435
436
436
437
if (write_op )
437
438
write_op (bridge , reg , old , new , mask );
0 commit comments