Skip to contentSkip to conversation

A general cleanup & overhaul of native device handling

parisc-linux Matthew Wilcox 1 participant 2 messages Aug 1, 2001 – Aug 5, 2001

lore
Share & tools
lore
#0 lore raw

I've been unhappy with the way we handle native devices for a while. Grant pushed me to do something about it instead of just whining, and I was inspired after seeing the hotplug talk at OLS. Yes, there are PA machines out there whch support Hotplug... Superdome certainly does and there may be other machines which do.

So here's what I've done:

* hpa' is now unsigned long' everywhere in the core code. Some drivers cast it to a struct pointer, and while I disapprove of this, that's really up to the individual maintainers.
* we now have a `struct parisc_device_id'. This parallels the similarly named structures for pci, isapnp & usb. The ids I decided were useful
are: hw_type, hversion, hversion_rev & sversion. sversion_rev & opt are not included. If anyone feels the need for them, ask nicely.
* hp_device has become parisc_device. The individual hversion, sversion, etc elements have become an embedded struct parisc_device_id. I've added parent, sibling, child pointers for future use in an iotree.
* pa_iodc_driver is replaced by parisc_driver. This parallels pci_driver. It has a pointer to a table of parisc_device_id. The callback' element has been renamed to probe' and now takes only the struct parisc_device which is being probed for.
* We no longer have a bitfield of things to check; instead we use HVERSION_ANY_ID (and similarly named values) to indicate a `don't care'.

The complete patch is something over 110k, so I decline to post it to the
list. You can find it at ftp://puffin.external.hp.com/pub/parisc/src/parisc_device.diff . I'll give a sample though, and I've decided to pick on... harmony. I'm only going to post the interesting bits; there's more to it in the full
diff.

-/* This is the PDC signature to load up the driver. */ -static struct pa_iodc_driver harmony_drivers_for[] = -{
- {HPHW_FIO, 0x01B, 0, 0x0007B, 0x0, 0x0,
- DRIVER_CHECK_HWTYPE + DRIVER_CHECK_SVERSION,
- "Lasi Harmony", "Harmony", harmony_driver_callback},
- {0, }
+static struct parisc_device_id harmony_tbl[] = {
+ { HPHW_FIO, HVERSION_REV_ANY_ID, 0x01B, 0x0007B },
+ { 0, }
};

+MODULE_DEVICE_TABLE(parisc, harmony_tbl);
+
+static struct parisc_driver harmony_driver = {

+       name:           "Lasi Harmony",
+       id_table:       harmony_tbl,
+       probe:          harmony_driver_callback,

+};

static int __init init_harmony(void)
{

-       pdc_register_driver(harmony_drivers_for);
-       return 0;
+       return register_parisc_driver(&harmony_driver);

}

As you can see, the new form is quite compact and readable.

At some point, I'm going to try booting a machine with this patch applied and see what happens. I expect it to explode messily right now, tbh, but at least it compiles. I'm interested in criticism of this architecture. After I get this hunk of work done, I'll move on to an iotree, and maybe then to actually doing hotplug for native devices... that isn't high on my priority list and I'd be happy to leave it to somebody else :-)

Signature · 1 line
Revolutions do not require corporate support.
#1 lore raw
Quoted 6 lines · Matthew Wilcox

At some point, I'm going to try booting a machine with this patch applied and see what happens. I expect it to explode messily right now, tbh, but at least it compiles. I'm interested in criticism of this architecture. After I get this hunk of work done, I'll move on to an iotree, and maybe then to actually doing hotplug for native devices... that isn't high on my priority list and I'd be happy to leave it to somebody else :-)

It was actually less messy than I thought. The only issue which arose was because i modularised Lasi & Asp without rearranging the order devices are initialised in. I decided to solve that one by demodularising these two drivers rather than changing intialisation order because I think I have a better way of fixing this, which will involve implementing the fabled iotree.

I fixed a couple of minor thinkos from the original patch -- I didn't mean to include an in-progress partial rewrite of some of the PCI inb/outw/etc functions. I probably made fallback processor detection work again. And I missed a s/d/dev/ in lba_pci.

Anyway, this patch now works for me on a 712 & J7k. With this kind of patch, it's likely to break one random machine out there (and, on past experience, it'll be lamont's...) , so I'd like to get people testing as widely as possible. The patch is against 2.4.7-pa1, and can be found at ftp://puffin.external.hp.com/pub/parisc/src/parisc_device-2.diff

I am planning on committing this patch soon, so please test ASAP. I'm particularly interested in seeing reports from 715/Scorpio, J2xx/C1xx and B1xx/C1xxL machines.

If you feel you own any of these files, you should also at least glance at the patch:

$ diffstat parisc_device-2.diff 
 arch/parisc/kernel/ccio-dma.c  |   60 ++++-----
 arch/parisc/kernel/drivers.c   |  259 ++++++++++++++++++++---------------------
 arch/parisc/kernel/firmware.c  |    1 
 arch/parisc/kernel/hardware.c  |    9 -
 arch/parisc/kernel/inventory.c |   32 +----
 arch/parisc/kernel/iosapic.c   |    2 
 arch/parisc/kernel/lba_pci.c   |  100 +++++++--------
 arch/parisc/kernel/led.c       |    2 
 arch/parisc/kernel/sba_iommu.c |  121 +++++++------------
 arch/parisc/kernel/setup.c     |   65 +++++-----
 drivers/char/hp_psaux.c        |   61 +++++----
 drivers/gsc/asp.c              |   34 +++--
 drivers/gsc/busdevice.c        |   49 ++-----
 drivers/gsc/busdevice.h        |   18 --
 drivers/gsc/dino.c             |  173 ++++++++++-----------------
 drivers/gsc/hil.c              |   39 +++---
 drivers/gsc/lan.c              |   59 +++++----
 drivers/gsc/lasi.c             |   51 +++++---
 drivers/gsc/serial.c           |  127 ++++++--------------
 drivers/gsc/wax.c              |   47 ++++---
 drivers/gsc/wax_eisa.c         |   53 ++++----
 drivers/parport/parport_gsc.c  |   34 +++--
 drivers/scsi/lasi7xx.c         |   64 ++++------
 drivers/scsi/zalon7xx.c        |   66 +++++-----
 drivers/sound/harmony.c        |   38 +++---
 drivers/video/sti/sticore.c    |   10 -
 include/asm-parisc/gsc.h       |    4 
 include/asm-parisc/hardware.h  |   87 ++++++-------
 include/asm-parisc/iosapic.h   |    2 
 include/asm-parisc/pci.h       |    4 
 include/asm-parisc/processor.h |    2 
 31 files changed, 776 insertions, 897 deletions
Signature · 1 line
Revolutions do not require corporate support.