Skip to content

Commit

Permalink
Merge branch 'next-remove-ldst' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/benh/powerpc into next
  • Loading branch information
Michael Ellerman committed Apr 7, 2015
2 parents 428d4d6 + 0eebf9b commit b7f859d
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 190 deletions.
12 changes: 6 additions & 6 deletions arch/powerpc/include/asm/dbdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ struct dbdma_regs {
* DBDMA command structure. These fields are all little-endian!
*/
struct dbdma_cmd {
unsigned short req_count; /* requested byte transfer count */
unsigned short command; /* command word (has bit-fields) */
unsigned int phy_addr; /* physical data address */
unsigned int cmd_dep; /* command-dependent field */
unsigned short res_count; /* residual count after completion */
unsigned short xfer_status; /* transfer status */
__le16 req_count; /* requested byte transfer count */
__le16 command; /* command word (has bit-fields) */
__le32 phy_addr; /* physical data address */
__le32 cmd_dep; /* command-dependent field */
__le16 res_count; /* residual count after completion */
__le16 xfer_status; /* transfer status */
};

/* DBDMA command values in command field */
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ struct kvm_vcpu_arch {
pgd_t *pgdir;

u8 io_gpr; /* GPR used as IO source/target */
u8 mmio_is_bigendian;
u8 mmio_host_swabbed;
u8 mmio_sign_extend;
u8 osi_needed;
u8 osi_enabled;
Expand Down
26 changes: 0 additions & 26 deletions arch/powerpc/include/asm/swab.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,4 @@

#include <uapi/asm/swab.h>

static __inline__ __u16 ld_le16(const volatile __u16 *addr)
{
__u16 val;

__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
return val;
}

static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
{
__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}

static __inline__ __u32 ld_le32(const volatile __u32 *addr)
{
__u32 val;

__asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
return val;
}

static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
{
__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}

#endif /* _ASM_POWERPC_SWAB_H */
4 changes: 2 additions & 2 deletions arch/powerpc/include/asm/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

static inline void scr_writew(u16 val, volatile u16 *addr)
{
st_le16(addr, val);
*addr = cpu_to_le16(val);
}

static inline u16 scr_readw(volatile const u16 *addr)
{
return ld_le16(addr);
return le16_to_cpu(*addr);
}

#define VT_BUF_HAVE_MEMCPYW
Expand Down
38 changes: 18 additions & 20 deletions arch/powerpc/kvm/powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,18 +720,18 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
return;
}

if (vcpu->arch.mmio_is_bigendian) {
if (!vcpu->arch.mmio_host_swabbed) {
switch (run->mmio.len) {
case 8: gpr = *(u64 *)run->mmio.data; break;
case 4: gpr = *(u32 *)run->mmio.data; break;
case 2: gpr = *(u16 *)run->mmio.data; break;
case 1: gpr = *(u8 *)run->mmio.data; break;
}
} else {
/* Convert BE data from userland back to LE. */
switch (run->mmio.len) {
case 4: gpr = ld_le32((u32 *)run->mmio.data); break;
case 2: gpr = ld_le16((u16 *)run->mmio.data); break;
case 8: gpr = swab64(*(u64 *)run->mmio.data); break;
case 4: gpr = swab32(*(u32 *)run->mmio.data); break;
case 2: gpr = swab16(*(u16 *)run->mmio.data); break;
case 1: gpr = *(u8 *)run->mmio.data; break;
}
}
Expand Down Expand Up @@ -780,14 +780,13 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
int is_default_endian)
{
int idx, ret;
int is_bigendian;
bool host_swabbed;

/* Pity C doesn't have a logical XOR operator */
if (kvmppc_need_byteswap(vcpu)) {
/* Default endianness is "little endian". */
is_bigendian = !is_default_endian;
host_swabbed = is_default_endian;
} else {
/* Default endianness is "big endian". */
is_bigendian = is_default_endian;
host_swabbed = !is_default_endian;
}

if (bytes > sizeof(run->mmio.data)) {
Expand All @@ -800,7 +799,7 @@ int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
run->mmio.is_write = 0;

vcpu->arch.io_gpr = rt;
vcpu->arch.mmio_is_bigendian = is_bigendian;
vcpu->arch.mmio_host_swabbed = host_swabbed;
vcpu->mmio_needed = 1;
vcpu->mmio_is_write = 0;
vcpu->arch.mmio_sign_extend = 0;
Expand Down Expand Up @@ -840,14 +839,13 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
{
void *data = run->mmio.data;
int idx, ret;
int is_bigendian;
bool host_swabbed;

/* Pity C doesn't have a logical XOR operator */
if (kvmppc_need_byteswap(vcpu)) {
/* Default endianness is "little endian". */
is_bigendian = !is_default_endian;
host_swabbed = is_default_endian;
} else {
/* Default endianness is "big endian". */
is_bigendian = is_default_endian;
host_swabbed = !is_default_endian;
}

if (bytes > sizeof(run->mmio.data)) {
Expand All @@ -862,19 +860,19 @@ int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
vcpu->mmio_is_write = 1;

/* Store the value at the lowest bytes in 'data'. */
if (is_bigendian) {
if (!host_swabbed) {
switch (bytes) {
case 8: *(u64 *)data = val; break;
case 4: *(u32 *)data = val; break;
case 2: *(u16 *)data = val; break;
case 1: *(u8 *)data = val; break;
}
} else {
/* Store LE value into 'data'. */
switch (bytes) {
case 4: st_le32(data, val); break;
case 2: st_le16(data, val); break;
case 1: *(u8 *)data = val; break;
case 8: *(u64 *)data = swab64(val); break;
case 4: *(u32 *)data = swab32(val); break;
case 2: *(u16 *)data = swab16(val); break;
case 1: *(u8 *)data = val; break;
}
}

Expand Down
10 changes: 5 additions & 5 deletions drivers/ata/pata_macio.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,9 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)
BUG_ON (pi++ >= MAX_DCMDS);

len = (sg_len < MAX_DBDMA_SEG) ? sg_len : MAX_DBDMA_SEG;
st_le16(&table->command, write ? OUTPUT_MORE: INPUT_MORE);
st_le16(&table->req_count, len);
st_le32(&table->phy_addr, addr);
table->command = cpu_to_le16(write ? OUTPUT_MORE: INPUT_MORE);
table->req_count = cpu_to_le16(len);
table->phy_addr = cpu_to_le32(addr);
table->cmd_dep = 0;
table->xfer_status = 0;
table->res_count = 0;
Expand All @@ -557,12 +557,12 @@ static void pata_macio_qc_prep(struct ata_queued_cmd *qc)

/* Convert the last command to an input/output */
table--;
st_le16(&table->command, write ? OUTPUT_LAST: INPUT_LAST);
table->command = cpu_to_le16(write ? OUTPUT_LAST: INPUT_LAST);
table++;

/* Add the stop command to the end of the list */
memset(table, 0, sizeof(struct dbdma_cmd));
st_le16(&table->command, DBDMA_STOP);
table->command = cpu_to_le16(DBDMA_STOP);

dev_dbgdma(priv->dev, "%s: %d DMA list entries\n", __func__, pi);
}
Expand Down
12 changes: 6 additions & 6 deletions drivers/block/swim3.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ static inline void seek_track(struct floppy_state *fs, int n)
static inline void init_dma(struct dbdma_cmd *cp, int cmd,
void *buf, int count)
{
st_le16(&cp->req_count, count);
st_le16(&cp->command, cmd);
st_le32(&cp->phy_addr, virt_to_bus(buf));
cp->req_count = cpu_to_le16(count);
cp->command = cpu_to_le16(cmd);
cp->phy_addr = cpu_to_le32(virt_to_bus(buf));
cp->xfer_status = 0;
}

Expand Down Expand Up @@ -771,8 +771,8 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id)
}
/* turn off DMA */
out_le32(&dr->control, (RUN | PAUSE) << 16);
stat = ld_le16(&cp->xfer_status);
resid = ld_le16(&cp->res_count);
stat = le16_to_cpu(cp->xfer_status);
resid = le16_to_cpu(cp->res_count);
if (intr & ERROR_INTR) {
n = fs->scount - 1 - resid / 512;
if (n > 0) {
Expand Down Expand Up @@ -1170,7 +1170,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index)

fs->dma_cmd = (struct dbdma_cmd *) DBDMA_ALIGN(fs->dbdma_cmd_space);
memset(fs->dma_cmd, 0, 2 * sizeof(struct dbdma_cmd));
st_le16(&fs->dma_cmd[1].command, DBDMA_STOP);
fs->dma_cmd[1].command = cpu_to_le16(DBDMA_STOP);

if (mdev->media_bay == NULL || check_media_bay(mdev->media_bay) == MB_FD)
swim3_mb_event(mdev, MB_FD);
Expand Down
10 changes: 5 additions & 5 deletions drivers/ide/pmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,9 +1497,9 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)
drive->name);
return 0;
}
st_le16(&table->command, wr? OUTPUT_MORE: INPUT_MORE);
st_le16(&table->req_count, tc);
st_le32(&table->phy_addr, cur_addr);
table->command = cpu_to_le16(wr? OUTPUT_MORE: INPUT_MORE);
table->req_count = cpu_to_le16(tc);
table->phy_addr = cpu_to_le32(cur_addr);
table->cmd_dep = 0;
table->xfer_status = 0;
table->res_count = 0;
Expand All @@ -1513,10 +1513,10 @@ static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd)

/* convert the last command to an input/output last command */
if (count) {
st_le16(&table[-1].command, wr? OUTPUT_LAST: INPUT_LAST);
table[-1].command = cpu_to_le16(wr? OUTPUT_LAST: INPUT_LAST);
/* add the stop command to the end of the list */
memset(table, 0, sizeof(struct dbdma_cmd));
st_le16(&table->command, DBDMA_STOP);
table->command = cpu_to_le16(DBDMA_STOP);
mb();
writel(hwif->dmatable_dma, &dma->cmdptr);
return 1;
Expand Down
30 changes: 15 additions & 15 deletions drivers/macintosh/rack-meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,31 +182,31 @@ static void rackmeter_setup_dbdma(struct rackmeter *rm)

/* Prepare 4 dbdma commands for the 2 buffers */
memset(cmd, 0, 4 * sizeof(struct dbdma_cmd));
st_le16(&cmd->req_count, 4);
st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
st_le32(&cmd->phy_addr, rm->dma_buf_p +
cmd->req_count = cpu_to_le16(4);
cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, mark));
st_le32(&cmd->cmd_dep, 0x02000000);
cmd->cmd_dep = cpu_to_le32(0x02000000);
cmd++;

st_le16(&cmd->req_count, SAMPLE_COUNT * 4);
st_le16(&cmd->command, OUTPUT_MORE);
st_le32(&cmd->phy_addr, rm->dma_buf_p +
cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
cmd->command = cpu_to_le16(OUTPUT_MORE);
cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, buf1));
cmd++;

st_le16(&cmd->req_count, 4);
st_le16(&cmd->command, STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
st_le32(&cmd->phy_addr, rm->dma_buf_p +
cmd->req_count = cpu_to_le16(4);
cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, mark));
st_le32(&cmd->cmd_dep, 0x01000000);
cmd->cmd_dep = cpu_to_le32(0x01000000);
cmd++;

st_le16(&cmd->req_count, SAMPLE_COUNT * 4);
st_le16(&cmd->command, OUTPUT_MORE | BR_ALWAYS);
st_le32(&cmd->phy_addr, rm->dma_buf_p +
cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
cmd->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS);
cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
offsetof(struct rackmeter_dma, buf2));
st_le32(&cmd->cmd_dep, rm->dma_buf_p);
cmd->cmd_dep = cpu_to_le32(rm->dma_buf_p);

rackmeter_do_pause(rm, 0);
}
Expand Down
12 changes: 0 additions & 12 deletions drivers/media/pci/bt8xx/bt878.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
int result = 0;
unsigned char lat;
struct bt878 *bt;
#if defined(__powerpc__)
unsigned int cmd;
#endif
unsigned int cardid;

printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
Expand Down Expand Up @@ -461,15 +458,6 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
printk("irq: %d, latency: %d, memory: 0x%lx\n",
bt->irq, lat, bt->bt878_adr);


#if defined(__powerpc__)
/* on OpenFirmware machines (PowerMac at least), PCI memory cycle */
/* response on cards with no firmware is not enabled by OF */
pci_read_config_dword(dev, PCI_COMMAND, &cmd);
cmd = (cmd | PCI_COMMAND_MEMORY);
pci_write_config_dword(dev, PCI_COMMAND, cmd);
#endif

#ifdef __sparc__
bt->bt878_mem = (unsigned char *) bt->bt878_adr;
#else
Expand Down
11 changes: 0 additions & 11 deletions drivers/media/pci/bt8xx/bt878.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,7 @@ void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin,
u32 irq_err_ignore);
void bt878_stop(struct bt878 *bt);

#if defined(__powerpc__) /* big-endian */
static inline void io_st_le32(volatile unsigned __iomem *addr, unsigned val)
{
st_le32(addr, val);
eieio();
}

#define bmtwrite(dat,adr) io_st_le32((adr),(dat))
#define bmtread(adr) ld_le32((adr))
#else
#define bmtwrite(dat,adr) writel((dat), (adr))
#define bmtread(adr) readl(adr)
#endif

#endif
2 changes: 1 addition & 1 deletion drivers/mmc/host/mxcmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static inline void buffer_swap32(u32 *buf, int len)
int i;

for (i = 0; i < ((len + 3) / 4); i++) {
st_le32(buf, *buf);
*buf = swab32(*buf);
buf++;
}
}
Expand Down
Loading

0 comments on commit b7f859d

Please sign in to comment.