Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf19c94d authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky
Browse files

s390/pci: improve ZPCI_* macros



Most of the constants defined in pci_io.h depend on each other
and thus can be calculated.

Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 9e00caae
Loading
Loading
Loading
Loading
+9 −6
Original line number Original line Diff line number Diff line
@@ -8,10 +8,13 @@
#include <asm/pci_insn.h>
#include <asm/pci_insn.h>


/* I/O Map */
/* I/O Map */
#define ZPCI_IOMAP_MAX_ENTRIES		0x8000
#define ZPCI_IOMAP_SHIFT		48
#define ZPCI_IOMAP_ADDR_BASE		0x8000000000000000ULL
#define ZPCI_IOMAP_ADDR_BASE		0x8000000000000000UL
#define ZPCI_IOMAP_ADDR_IDX_MASK	0x7fff000000000000ULL
#define ZPCI_IOMAP_ADDR_OFF_MASK	((1UL << ZPCI_IOMAP_SHIFT) - 1)
#define ZPCI_IOMAP_ADDR_OFF_MASK	0x0000ffffffffffffULL
#define ZPCI_IOMAP_MAX_ENTRIES							\
	((ULONG_MAX - ZPCI_IOMAP_ADDR_BASE + 1) / (1UL << ZPCI_IOMAP_SHIFT))
#define ZPCI_IOMAP_ADDR_IDX_MASK						\
	(~ZPCI_IOMAP_ADDR_OFF_MASK - ZPCI_IOMAP_ADDR_BASE)


struct zpci_iomap_entry {
struct zpci_iomap_entry {
	u32 fh;
	u32 fh;
@@ -21,9 +24,9 @@ struct zpci_iomap_entry {


extern struct zpci_iomap_entry *zpci_iomap_start;
extern struct zpci_iomap_entry *zpci_iomap_start;


#define ZPCI_ADDR(idx) (ZPCI_IOMAP_ADDR_BASE | ((u64) idx << 48))
#define ZPCI_ADDR(idx) (ZPCI_IOMAP_ADDR_BASE | ((u64) idx << ZPCI_IOMAP_SHIFT))
#define ZPCI_IDX(addr)								\
#define ZPCI_IDX(addr)								\
	(((__force u64) addr & ZPCI_IOMAP_ADDR_IDX_MASK) >> 48)
	(((__force u64) addr & ZPCI_IOMAP_ADDR_IDX_MASK) >> ZPCI_IOMAP_SHIFT)
#define ZPCI_OFFSET(addr)							\
#define ZPCI_OFFSET(addr)							\
	((__force u64) addr & ZPCI_IOMAP_ADDR_OFF_MASK)
	((__force u64) addr & ZPCI_IOMAP_ADDR_OFF_MASK)


+1 −1
Original line number Original line Diff line number Diff line
@@ -541,7 +541,7 @@ static void zpci_irq_exit(void)


static int zpci_alloc_iomap(struct zpci_dev *zdev)
static int zpci_alloc_iomap(struct zpci_dev *zdev)
{
{
	int entry;
	unsigned long entry;


	spin_lock(&zpci_iomap_lock);
	spin_lock(&zpci_iomap_lock);
	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);
	entry = find_first_zero_bit(zpci_iomap, ZPCI_IOMAP_MAX_ENTRIES);