Skip to contentSkip to conversation

The long awaited iotree patch for System Map Firmware

PATCH In review Ryan Bradetich 3 participants 3 messages Oct 19, 2001 – Oct 20, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 The long awaited iotree patch for System Map Firmware

Hello parisc-linux hackers,

Here is the patch for the I/O Tree for the System Map firmware boxes. I believe the I/O tree for legacy firmware is already in the cvs repository, and I need to get access to a PAT firmware box to finish the iotree for PAT firmware.

Please test this patch out and report any problems. I would like to get this patch committed to the repository so we can finally use the multiple IOMMUs present in the ccio boxes, etc.

I have tested this patch on C200 and K460.

Thanks,

- Ryan

P.S. Thanks to willy for all his help, reviews and general rewrite to put this patch in its current state!

Index: arch/parisc/kernel/ccio-dma.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/ccio-dma.c,v retrieving revision 1.42

parisc/kernel/ccio-dma.c +12 -12
diff -u -p -r1.42 ccio-dma.c
@@ -208,6 +208,8 @@ static int ioc_count;
 #define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
 #define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
 
+
+#define GET_IOC(dev) (ioc_list)
 /*
 ** Don't worry about the 150% average search length on a miss.
 ** If the search wraps around, and passes the res_hint, it will
@@ -638,7 +640,7 @@ static dma_addr_t 
 ccio_map_single(struct pci_dev *dev, void *addr, size_t size, int direction)
 {
 	int idx;
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 	unsigned long flags;
 	dma_addr_t iovp;
 	dma_addr_t offset;
@@ -702,7 +704,7 @@ static void 
 ccio_unmap_single(struct pci_dev *dev, dma_addr_t iova, size_t size, 
 		  int direction)
 {
-	struct ioc *ioc = ioc_list; /* XXX: Use appropriate IOC for this dev */
+	struct ioc *ioc = GET_IOC(dev);
 	unsigned long flags; 
 	dma_addr_t offset = iova & ~IOVP_MASK;
 	
@@ -960,7 +962,7 @@ static int
 ccio_map_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents, 
 	    int direction)
 {
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 	int coalesced, filled = 0;
 	unsigned long flags;
 	unsigned long hint = hint_lookup[direction];
@@ -1023,8 +1025,7 @@ static void 
 ccio_unmap_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents, 
 	      int direction)
 {
-	/* FIXME : see Multi-IOC below */
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 
 	DBG_RUN_SG("%s() START %d entries,  %p,%x\n",
 		__FUNCTION__, nents, sglist->address, sglist->length);
@@ -1062,7 +1063,7 @@ static struct pci_dma_ops ccio_ops = {
 static int 
 ccio_proc_info(char *buf, char **start, off_t offset, int len)
 {
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 
 	buf[0] = '\0';
 	while (ioc != NULL) {
@@ -1123,7 +1124,7 @@ ccio_proc_info(char *buf, char **start, 
 static int
 ccio_resource_map(char *buf, char **start, off_t offset, int len)
 {
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 
 	buf[0] = '\0';
 	while (ioc != NULL) {
@@ -1153,7 +1154,7 @@ ccio_resource_map(char *buf, char **star
 void ccio_cujo20_fixup(struct parisc_device *dev, u32 iovp)
 {
 	unsigned int idx;
-	struct ioc *ioc = ioc_list;
+	struct ioc *ioc = GET_IOC(dev);
 	u8 *res_ptr;
 
 #ifdef CONFIG_PROC_FS
@@ -1336,7 +1337,7 @@ int do_native_bus_walk(unsigned long io_
  */
 static int ccio_probe(struct parisc_device *dev)
 {
-	int i, start_index, num_devices;
+	int i;
 	unsigned long io_io_low;
 	struct ioc *ioc, **ioc_p = &ioc_list;
 
@@ -1379,9 +1380,8 @@ static int ccio_probe(struct parisc_devi
 	io_io_low |= 0xffffffff00000000UL;
 #endif
 	printk(KERN_INFO "io_io_low: 0x%lx\n", io_io_low);
-	start_index = get_num_pa_dev();
-	num_devices = do_native_bus_walk(io_io_low);
-	print_pa_devices(start_index, num_devices);
+	walk_native_bus(io_io_low, dev);
+	print_subdevices(dev);
 	return 0;
 }
 

Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v retrieving revision 1.28

parisc/kernel/drivers.c +219 -101

430 lines not on this page · raw message

Index: arch/parisc/kernel/inventory.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/inventory.c,v retrieving revision 1.41

parisc/kernel/inventory.c +12 -52

139 lines not on this page · raw message

Index: arch/parisc/kernel/led.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/led.c,v retrieving revision 1.23

parisc/kernel/led.c +2 -3
diff -u -p -r1.23 led.c
@@ -154,8 +154,7 @@ static int led_proc_read(char *page, cha
 static int led_proc_write(struct file *file, const char *buf, 
 	unsigned long count, void *data)
 {
-	const char *cur = NULL;
-	char lbuf[count];
+	char *cur, lbuf[count];
 	int d;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -163,7 +162,7 @@ static int led_proc_write(struct file *f
 
 	memset(lbuf, 0, count);
 
-	lcopy_from_user(lbuf, buf, count);
+	copy_from_user(lbuf, buf, count);
 	cur = lbuf;
 
 	/* skip initial spaces */

Index: include/asm-parisc/hardware.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/hardware.h,v retrieving revision 1.24

asm-parisc/hardware.h +8 -3
diff -u -p -r1.24 hardware.h
@@ -1,6 +1,8 @@
 #ifndef _PARISC_HARDWARE_H
 #define _PARISC_HARDWARE_H
 
+#include <asm/pdc.h>
+
 struct parisc_device_id {
 	unsigned char	hw_type;	/* 5 bits used */
 	unsigned char	hversion_rev;	/* 4 bits */
@@ -96,12 +98,15 @@ extern enum cpu_type parisc_get_cpu_type
 
 
 /* drivers.c: */
-extern struct parisc_device *alloc_pa_dev(unsigned long hpa);
+extern struct parisc_device *alloc_pa_dev(unsigned long hpa,
+		struct pdc_module_path *path);
 extern int register_parisc_device(struct parisc_device *dev);
-extern int get_num_pa_dev(void);
-extern void print_pa_devices(int start_index, int num_indexes);
 extern int register_parisc_driver(struct parisc_driver *driver);
 extern int unregister_parisc_driver(struct parisc_driver *driver);
+extern void walk_native_bus(unsigned long addr, struct parisc_device *parent);
+extern void walk_central_bus(void);
+extern void print_subdevices(struct parisc_device *dev);
+extern void print_parisc_devices(void);
 
 /* inventory.c: */
 extern void do_memory_inventory(void);
#1 lore raw

Hi Ryan,

I've tested your patch on my c3k and 715/64 (aka "Snake"). On the c3k all is fine, but on the 715/64 it breaks the current inventory function and just needs a small fix to get it working again.

Anyway, here is the bootlog for the 715/64:

Found devices: 5
1. Mirage Jr GSC Builtin Graphics (10) at 0xf8000000 [1], versions 0x12, 0x0, 0
2. Mirage Jr Core BA (11) at 0xf0100000 [2], versions 0x28, 0x0, 0x81
3. (0) at 0x0 [2/0], versions 0x0, 0x0, 0x0
4. Mirage Jr Core SCSI (10) at 0xf0106000 [2/0/1], versions 0x28, 0x0, 0x82 a
5. Mirage Jr Core LAN (802.3) (10) at 0xf0107000 [2/0/2], versions 0x28, 0x0, 0
6. Mirage Jr Core RS-232 (10) at 0xf0105000 [2/0/4], versions 0x28, 0x0, 0x8c 4
7. Mirage Jr Core Centronics (10) at 0xf0102000 [2/0/6], versions 0x28, 0x0, 0x
8. Mirage Jr Audio (10) at 0xf0104000 [2/0/8], versions 0x28, 0x0, 0x7b 3
9. Mirage Jr Core PC Floppy (10) at 0xf010a000 [2/0/10], versions 0x28, 0x0, 0x4
10. Mirage Jr Core PS/2 Port (10) at 0xf0108000 [2/0/11], versions 0x28, 0x0, 04
11. Mirage Jr Core PS/2 Port (10) at 0xf0108100 [2/0/12], versions 0x28, 0x0, 0
12. Mirage Jr Wax EISA BA (11) at 0xfc000000 [4], versions 0x28, 0x0, 0x90
13. Mirage Jr Wax BA (11) at 0xf0200000 [5], versions 0x12, 0x0, 0x8e
14. (0) at 0x0 [5/0], versions 0x0, 0x0, 0x0
15. Mirage Jr Wax HIL (10) at 0xf0201000 [5/0/1], versions 0x12, 0x0, 0x73
16. Mirage Jr Wax RS-232 (10) at 0xf0202000 [5/0/2], versions 0x12, 0x0, 0x8c
17. Mirage Jr (715/64) (0) at 0xfffbe000 [8], versions 0x60a, 0x0, 0x4
18. Mirage Jr (1) at 0xfffbf000 [9], versions 0x4a, 0x0, 0x9
CONFIG_SMP=n ignoring additional CPUs
Warning : device (0, 0x0, 0x0, 0x0) NOT claimed by CPU
CONFIG_SMP=n ignoring additional CPUs
Warning : device (0, 0x60a, 0x0, 0x4) NOT claimed by CPU
CPU(s): 1 x PA7100LC (PCX-L) at 64.000000 MHz
Lasi version 0 at 0xf0100000 found.
LED display at f00e0000 registered
Wax at 0xf0200000 found.
Wax: HIL Keyboard-NMI registered.
Wax EISA Adapter found at 0xfc000000 !
busdevice_alloc_irq(0x1003b8c0): No known LASI/ASP/WAX owns device at 0xf020000
EISA: failed to claim IRQ
Warning : device (11, 0x28, 0x0, 0x90) NOT claimed by EISA Bus Adapter
.....
As you see, your iotree inserts "phantom" devices on [2/0] an [5/0]. I think both devices should be pre-initialized by default to type HPHW_FAULTY and to the hpa of the parent device in the function alloc_tree_node().
The other thing is, that currently no interrupts are found for any devices - I'll investigate that later but think this shouldn't be so hard to fix either.

Nevertheless I think you should commit your patch. The remaining bugs can be easily fixed afterwards.

Greetings,
Helge

Quoted 22 lines · Ryan Bradetich

Hello parisc-linux hackers,

Here is the patch for the I/O Tree for the System Map firmware boxes. I believe the I/O tree for legacy firmware is already in the cvs repository, and I need to get access to a PAT firmware box to finish the iotree for PAT firmware.

Please test this patch out and report any problems. I would like to get this patch committed to the repository so we can finally use the multiple IOMMUs present in the ccio boxes, etc.

I have tested this patch on C200 and K460.

Thanks,

- Ryan

P.S. Thanks to willy for all his help, reviews and general rewrite to put this patch in its current state!

#2 lore raw
Quoted 3 lines · Helge Deller

2. Mirage Jr Core BA (11) at 0xf0100000 [2], versions 0x28, 0x0, 0x81
3. (0) at 0x0 [2/0], versions 0x0, 0x0, 0x0
4. Mirage Jr Core SCSI (10) at 0xf0106000 [2/0/1], versions 0x28, 0x0, 0x82

OK. So we should skip printing devices which don't have an hpa.

Quoted 2 lines

12. Mirage Jr Wax EISA BA (11) at 0xfc000000 [4], versions 0x28, 0x0, 0x90
13. Mirage Jr Wax BA (11) at 0xf0200000 [5], versions 0x12, 0x0, 0x8e

Mmmmpf. That complicates thngs a little; I assumed the EISA BA was actually under the normal BA.

Quoted 4 lines

CONFIG_SMP=n ignoring additional CPUs
Warning : device (0, 0x0, 0x0, 0x0) NOT claimed by CPU CONFIG_SMP=n ignoring additional CPUs
Warning : device (0, 0x60a, 0x0, 0x4) NOT claimed by CPU

Hehe, yes, devices not completely filled in look like CPUs. Oops :-)

Quoted 3 lines

As you see, your iotree inserts "phantom" devices on [2/0] an [5/0]. I think both devices should be pre-initialized by default to type HPHW_FAULTY and to the hpa of the parent device in the function alloc_tree_node().

I agree about HPHW_FAULTY. I don't think we need to initialise the hpa though. Maybe a new HPHW_FAKE instead? It's not necessarily confusing, since devices which actually report HPHW_FAULTY never get inserted into the iotree.

Quoted 2 lines

The other thing is, that currently no interrupts are found for any devices - I'll investigate that later but think this shouldn't be so hard to fix either.

I know why that is. Basically we need to get lasi (and wax) to fix up their subdevices the same way that asp does. Then we can finally kill busdevice_alloc_irq. As a quick hack, we could check parent->hw_type == HPHW_FAULTY in busdevice_alloc_irq and skip to that parent.

Not quite sure how to handle Wax EISA not being underneath the Wax BA.. maybe just walk from wax's parent to fill in known irqs.

Signature · 1 line
Revolutions do not require corporate support.