Skip to content

Commit

Permalink
[PARISC] Convert parisc_device to use struct resource for hpa
Browse files Browse the repository at this point in the history
Convert pa_dev->hpa from an unsigned long to a struct resource.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>

Fix up users of ->hpa to use ->hpa.start instead.

Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
  • Loading branch information
Matthew Wilcox authored and Kyle McMartin committed Oct 22, 2005
1 parent bdad1f8 commit 53f01bb
Show file tree
Hide file tree
Showing 23 changed files with 60 additions and 55 deletions.
12 changes: 7 additions & 5 deletions arch/parisc/kernel/perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ static int perf_write_image(uint64_t *memaddr)
uint64_t *bptr;
uint32_t dwords;
uint32_t *intrigue_rdr;
uint64_t *intrigue_bitmask, tmp64, proc_hpa;
uint64_t *intrigue_bitmask, tmp64;
void __iomem *runway;
struct rdr_tbl_ent *tentry;
int i;

Expand Down Expand Up @@ -798,15 +799,16 @@ static int perf_write_image(uint64_t *memaddr)
return -1;
}

proc_hpa = cpu_device->hpa;
runway = ioremap(cpu_device->hpa.start, 4096);

/* Merge intrigue bits into Runway STATUS 0 */
tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecfffffffffffful;
__raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul), proc_hpa + RUNWAY_STATUS);
tmp64 = __raw_readq(runway + RUNWAY_STATUS) & 0xffecfffffffffffful;
__raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul),
runway + RUNWAY_STATUS);

/* Write RUNWAY DEBUG registers */
for (i = 0; i < 8; i++) {
__raw_writeq(*memaddr++, proc_hpa + RUNWAY_DEBUG + i);
__raw_writeq(*memaddr++, runway + RUNWAY_DEBUG);
}

return 0;
Expand Down
8 changes: 4 additions & 4 deletions arch/parisc/kernel/processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int __init processor_probe(struct parisc_device *dev)
* May get overwritten by PAT code.
*/
cpuid = boot_cpu_data.cpu_count;
txn_addr = dev->hpa; /* for legacy PDC */
txn_addr = dev->hpa.start; /* for legacy PDC */

#ifdef __LP64__
if (is_pdc_pat()) {
Expand Down Expand Up @@ -122,15 +122,15 @@ static int __init processor_probe(struct parisc_device *dev)
* boot time (ie shutdown a CPU from an OS perspective).
*/
/* get the cpu number */
status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa);
status = pdc_pat_cpu_get_number(&cpu_info, dev->hpa.start);

BUG_ON(PDC_OK != status);

if (cpu_info.cpu_num >= NR_CPUS) {
printk(KERN_WARNING "IGNORING CPU at 0x%x,"
" cpu_slot_id > NR_CPUS"
" (%ld > %d)\n",
dev->hpa, cpu_info.cpu_num, NR_CPUS);
dev->hpa.start, cpu_info.cpu_num, NR_CPUS);
/* Ignore CPU since it will only crash */
boot_cpu_data.cpu_count--;
return 1;
Expand All @@ -149,7 +149,7 @@ static int __init processor_probe(struct parisc_device *dev)

p->loops_per_jiffy = loops_per_jiffy;
p->dev = dev; /* Save IODC data in case we need it */
p->hpa = dev->hpa; /* save CPU hpa */
p->hpa = dev->hpa.start; /* save CPU hpa */
p->cpuid = cpuid; /* save CPU id */
p->txn_addr = txn_addr; /* save CPU IRQ address */
#ifdef CONFIG_SMP
Expand Down
4 changes: 2 additions & 2 deletions drivers/input/keyboard/hilkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ static int __init
hil_init_chip(struct parisc_device *dev)
{
if (!dev->irq) {
printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa);
printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%08lx\n", dev->hpa.start);
return -ENODEV;
}

hil_base = dev->hpa;
hil_base = dev->hpa.start;
hil_irq = dev->irq;
hil_dev.dev_id = dev;

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/serio/gscps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ static int __init gscps2_probe(struct parisc_device *dev)
{
struct gscps2port *ps2port;
struct serio *serio;
unsigned long hpa = dev->hpa;
unsigned long hpa = dev->hpa.start;
int ret;

if (!dev->irq)
Expand Down
6 changes: 3 additions & 3 deletions drivers/input/serio/hp_sdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,9 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
hp_sdc.dev = d;
hp_sdc.irq = d->irq;
hp_sdc.nmi = d->aux_irq;
hp_sdc.base_io = d->hpa;
hp_sdc.data_io = d->hpa + 0x800;
hp_sdc.status_io = d->hpa + 0x801;
hp_sdc.base_io = d->hpa.start;
hp_sdc.data_io = d->hpa.start + 0x800;
hp_sdc.status_io = d->hpa.start + 0x801;

return hp_sdc_init();
}
Expand Down
7 changes: 4 additions & 3 deletions drivers/net/lasi_82596.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,17 +1528,18 @@ lan_init_chip(struct parisc_device *dev)

if (!dev->irq) {
printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n",
__FILE__, dev->hpa);
__FILE__, dev->hpa.start);
return -ENODEV;
}

printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa, dev->irq);
printk(KERN_INFO "Found i82596 at 0x%lx, IRQ %d\n", dev->hpa.start,
dev->irq);

netdevice = alloc_etherdev(0);
if (!netdevice)
return -ENOMEM;

netdevice->base_addr = dev->hpa;
netdevice->base_addr = dev->hpa.start;
netdevice->irq = dev->irq;

retval = i82596_probe(netdevice, &dev->dev);
Expand Down
4 changes: 2 additions & 2 deletions drivers/parisc/asp.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ asp_init_chip(struct parisc_device *dev)
struct gsc_irq gsc_irq;
int ret;

asp.version = gsc_readb(dev->hpa + ASP_VER_OFFSET) & 0xf;
asp.version = gsc_readb(dev->hpa.start + ASP_VER_OFFSET) & 0xf;
asp.name = (asp.version == 1) ? "Asp" : "Cutoff";
asp.hpa = ASP_INTERRUPT_ADDR;

printk(KERN_INFO "%s version %d at 0x%lx found.\n",
asp.name, asp.version, dev->hpa);
asp.name, asp.version, dev->hpa.start);

/* the IRQ ASP should use */
ret = -EBUSY;
Expand Down
4 changes: 2 additions & 2 deletions drivers/parisc/ccio-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,15 +1546,15 @@ static int ccio_probe(struct parisc_device *dev)

ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";

printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa);
printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name, dev->hpa.start);

for (i = 0; i < ioc_count; i++) {
ioc_p = &(*ioc_p)->next;
}
*ioc_p = ioc;

ioc->hw_path = dev->hw_path;
ioc->ioc_hpa = (struct ioa_registers *)dev->hpa;
ioc->ioc_regs = ioremap(dev->hpa.start, 4096);
ccio_ioc_init(ioc);
ccio_init_resources(ioc);
hppa_dma_ops = &ccio_ops;
Expand Down
2 changes: 1 addition & 1 deletion drivers/parisc/ccio-rm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ccio_probe(struct parisc_device *dev)
{
printk(KERN_INFO "%s found %s at 0x%lx\n", MODULE_NAME,
dev->id.hversion == U2_BC_GSC ? "U2" : "UTurn",
dev->hpa);
dev->hpa.start);

/*
** FIXME - should check U2 registers to verify it's really running
Expand Down
6 changes: 3 additions & 3 deletions drivers/parisc/dino.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,15 +902,15 @@ void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp);
** If so, initialize the chip appropriately (card-mode vs bridge mode).
** Much of the initialization is common though.
*/
static int __init
dino_driver_callback(struct parisc_device *dev)
static int __init dino_probe(struct parisc_device *dev)
{
struct dino_device *dino_dev; // Dino specific control struct
const char *version = "unknown";
char *name;
int is_cujo = 0;
struct pci_bus *bus;

unsigned long hpa = dev->hpa.start;

name = "Dino";
if (is_card_dino(&dev->id)) {
version = "3.x (card mode)";
Expand Down
2 changes: 1 addition & 1 deletion drivers/parisc/eisa.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
char *name = is_mongoose(dev) ? "Mongoose" : "Wax";

printk(KERN_INFO "%s EISA Adapter found at 0x%08lx\n",
name, dev->hpa);
name, dev->hpa.start);

eisa_dev.hba.dev = dev;
eisa_dev.hba.iommu = ccio_get_iommu(dev);
Expand Down
8 changes: 4 additions & 4 deletions drivers/parisc/hppb.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ static int hppb_probe(struct parisc_device *dev)
memset(card->next, '\0', sizeof(struct hppb_card));
card = card->next;
}
printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa);
printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start);

card->hpa = dev->hpa;
card->hpa = dev->hpa.start;
card->mmio_region.name = "HP-PB Bus";
card->mmio_region.flags = IORESOURCE_MEM;

card->mmio_region.start = __raw_readl(dev->hpa + IO_IO_LOW);
card->mmio_region.end = __raw_readl(dev->hpa + IO_IO_HIGH) - 1;
card->mmio_region.start = gsc_readl(dev->hpa.start + IO_IO_LOW);
card->mmio_region.end = gsc_readl(dev->hpa.start + IO_IO_HIGH) - 1;

status = ccio_request_resource(dev, &card->mmio_region);
if(status < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/parisc/lasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ lasi_init_chip(struct parisc_device *dev)
return -ENOMEM;

lasi->name = "Lasi";
lasi->hpa = dev->hpa;
lasi->hpa = dev->hpa.start;

/* Check the 4-bit (yes, only 4) version register */
lasi->version = gsc_readl(lasi->hpa + LASI_VER) & 0xf;
Expand Down
14 changes: 7 additions & 7 deletions drivers/parisc/lba_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@ lba_legacy_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
** Adjust "window" for this rope.
*/
rsize /= ROPES_PER_IOC;
r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa);
r->start += (rsize + 1) * LBA_NUM(pa_dev->hpa.start);
r->end = r->start + rsize;
} else {
r->end = r->start = 0; /* Not enabled. */
Expand Down Expand Up @@ -1458,7 +1458,7 @@ lba_driver_probe(struct parisc_device *dev)
u32 func_class;
void *tmp_obj;
char *version;
void __iomem *addr = ioremap(dev->hpa, 4096);
void __iomem *addr = ioremap(dev->hpa.start, 4096);

/* Read HW Rev First */
func_class = READ_REG32(addr + LBA_FCLASS);
Expand All @@ -1476,7 +1476,7 @@ lba_driver_probe(struct parisc_device *dev)
}

printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
MODULE_NAME, version, func_class & 0xf, dev->hpa);
MODULE_NAME, version, func_class & 0xf, dev->hpa.start);

if (func_class < 2) {
printk(KERN_WARNING "Can't support LBA older than "
Expand All @@ -1503,17 +1503,17 @@ lba_driver_probe(struct parisc_device *dev)
* but for the mask for func_class.
*/
printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",
MODULE_NAME, version, func_class & 0xff, dev->hpa);
MODULE_NAME, version, func_class & 0xff, dev->hpa.start);
cfg_ops = &mercury_cfg_ops;
} else {
printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa);
printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa.start);
return -ENODEV;
}

/*
** Tell I/O SAPIC driver we have a IRQ handler/region.
*/
tmp_obj = iosapic_register(dev->hpa + LBA_IOSAPIC_BASE);
tmp_obj = iosapic_register(dev->hpa.start + LBA_IOSAPIC_BASE);

/* NOTE: PCI devices (e.g. 103c:1005 graphics card) which don't
** have an IRT entry will get NULL back from iosapic code.
Expand Down Expand Up @@ -1635,7 +1635,7 @@ void __init lba_init(void)
*/
void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
{
void __iomem * base_addr = ioremap(lba->hpa, 4096);
void __iomem * base_addr = ioremap(lba->hpa.start, 4096);

imask <<= 2; /* adjust for hints - 2 more bits */

Expand Down
6 changes: 3 additions & 3 deletions drivers/parisc/sba_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num)

static void __iomem *ioc_remap(struct sba_device *sba_dev, int offset)
{
return ioremap(sba_dev->dev->hpa + offset, SBA_FUNC_SIZE);
return ioremap(sba_dev->dev->hpa.start + offset, SBA_FUNC_SIZE);
}

static void sba_hw_init(struct sba_device *sba_dev)
Expand Down Expand Up @@ -1978,7 +1978,7 @@ sba_driver_callback(struct parisc_device *dev)
u32 func_class;
int i;
char *version;
void __iomem *sba_addr = ioremap(dev->hpa, SBA_FUNC_SIZE);
void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);

sba_dump_ranges(sba_addr);

Expand Down Expand Up @@ -2020,7 +2020,7 @@ sba_driver_callback(struct parisc_device *dev)
}

printk(KERN_INFO "%s found %s at 0x%lx\n",
MODULE_NAME, version, dev->hpa);
MODULE_NAME, version, dev->hpa.start);

sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL);
if (!sba_dev) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/parisc/wax.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ wax_init_chip(struct parisc_device *dev)
return -ENOMEM;

wax->name = "wax";
wax->hpa = dev->hpa;
wax->hpa = dev->hpa.start;

wax->version = 0; /* gsc_readb(wax->hpa+WAX_VER); */
printk(KERN_INFO "%s at 0x%lx found.\n", wax->name, wax->hpa);
Expand Down
5 changes: 3 additions & 2 deletions drivers/parport/parport_gsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,12 @@ static int __devinit parport_init_chip(struct parisc_device *dev)
unsigned long port;

if (!dev->irq) {
printk("IRQ not found for parallel device at 0x%lx\n", dev->hpa);
printk(KERN_WARNING "IRQ not found for parallel device at 0x%lx\n",
dev->hpa.start);
return -ENODEV;
}

port = dev->hpa + PARPORT_GSC_OFFSET;
port = dev->hpa.start + PARPORT_GSC_OFFSET;

/* some older machines with ASP-chip don't support
* the enhanced parport modes.
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/lasi700.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ MODULE_DEVICE_TABLE(parisc, lasi700_ids);
static int __init
lasi700_probe(struct parisc_device *dev)
{
unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
unsigned long base = dev->hpa.start + LASI_SCSI_CORE_OFFSET;
struct NCR_700_Host_Parameters *hostdata;
struct Scsi_Host *host;

Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/zalon.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ zalon_probe(struct parisc_device *dev)
struct gsc_irq gsc_irq;
u32 zalon_vers;
int error = -ENODEV;
void __iomem *zalon = ioremap(dev->hpa, 4096);
void __iomem *zalon = ioremap(dev->hpa.start, 4096);
void __iomem *io_port = zalon + GSC_SCSI_ZALON_OFFSET;
static int unit = 0;
struct Scsi_Host *host;
Expand Down Expand Up @@ -127,7 +127,7 @@ zalon_probe(struct parisc_device *dev)
device.chip = zalon720_chip;
device.host_id = 7;
device.dev = &dev->dev;
device.slot.base = dev->hpa + GSC_SCSI_ZALON_OFFSET;
device.slot.base = dev->hpa.start + GSC_SCSI_ZALON_OFFSET;
device.slot.base_v = io_port;
device.slot.irq = dev->irq;
device.differential = 2;
Expand Down
5 changes: 3 additions & 2 deletions drivers/serial/8250_gsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ serial_init_chip(struct parisc_device *dev)
*/
if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
"Enable support for Wax, Lasi, Asp or Dino.\n", dev->hpa);
"Enable support for Wax, Lasi, Asp or Dino.\n",
dev->hpa.start);
}
return -ENODEV;
}

address = dev->hpa;
address = dev->hpa.start;
if (dev->id.sversion != 0x8d) {
address += 0x800;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/serial/mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ static int __init mux_probe(struct parisc_device *dev)
unsigned long bytecnt;
struct uart_port *port;

status = pdc_iodc_read(&bytecnt, dev->hpa, 0, iodc_data, 32);
status = pdc_iodc_read(&bytecnt, dev->hpa.start, 0, iodc_data, 32);
if(status != PDC_OK) {
printk(KERN_ERR "Serial mux: Unable to read IODC.\n");
return 1;
Expand Down
2 changes: 1 addition & 1 deletion include/asm-parisc/parisc-device.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <linux/device.h>

struct parisc_device {
unsigned long hpa; /* Hard Physical Address */
struct resource hpa; /* Hard Physical Address */
struct parisc_device_id id;
struct parisc_driver *driver; /* Driver for this device */
char name[80]; /* The hardware description */
Expand Down
Loading

0 comments on commit 53f01bb

Please sign in to comment.