LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-18-2020, 09:27 AM   #1
MahendraL
LQ Newbie
 
Registered: Jul 2009
Posts: 29

Rep: Reputation: 0
Accessing registers of a PCIE device from a big endian host processor


Hi,
I have a PCIE device attached to Broadcom XLP (MIPS) host processor.
The user space software gets access to the PCIE device registers address space
by doing ioctl on the PCIE device driver.
The XLP processor is in big endian mode. As PCIE is always in little endian mode,
when reading the PCIE device register (32-bits) from the software on XLP processor,
byte swapping should be needed after reading the register value. Similarly for when
writing to the device register.
But what I observe is that without byte swapping, things are working fine.
It's as if the XLP processor is acting in little endian mode when in fact it's in
big endian mode and the software is also big endian binary.

Any ideas for above behavior ?

Thank you.
 
Old 04-18-2020, 02:38 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,412

Rep: Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338
A few.

I was in Electronic Hardware, and big/little endian affects comparatively little

When a databus is reading/writing a number twice it's size (32bit accessing 64bit, 16bit accessing 32 bit, or 8bit accessing 16bit) only then the endian thing is important. Every cpu since the Z80 and perhaps earlier can do a long read (8 bits doing a 16bit read. Where it can cause confusion is in the case of cpus with a half width bus - the 8088 (16bit internals, 8 bit databus) 68008 (same story) or the Celeron (same except wider).

But if you transfer for example, the number 0xABCDEF01 from disk, registers, or serial input to ram, and then transfer it back, it's still going to be 0xABCDEF01 . If it was 0x10FEDCBA, or 0xEF01ABCD, that CPU is not going to make much money for the manufacturer, is it? We don't have to worry about byte swapping. That's taken care of in CPU hardware design, at a lower level than Assembler. So AFAIK,if (on a 32bit cpu) you read in a 64bit number, the 8 bytes are read in 2 groups of 4. Big/little endian-ness only affects the order of these bytes traveling along the data bus.

The main time it matters is when looking at instruction set compatibility at Assembler level.
 
1 members found this post helpful.
  


Reply

Tags
endian, pcie



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A question about big-endian little-endian and how it affects things joeBuffer Programming 12 08-20-2009 01:02 PM
small-endian to big-endian conversion of data to store in a structure NancyT Programming 2 11-26-2008 10:06 AM
problem in understanding little endian/big endian machine program indian Programming 6 04-19-2006 02:50 PM
big endian little endian? blackzone Linux - Hardware 4 09-23-2004 06:04 AM
What is all this big endian-little endian stuff about? vdemuth Linux - Newbie 1 04-28-2004 02:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration