diff options
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_pci.c')
| -rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 107 | 
1 files changed, 49 insertions, 58 deletions
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index c60f5f3e838..2fd296706ce 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c @@ -1,8 +1,8 @@  /*   * IBM Hot Plug Controller Driver - *  + *   * Written By: Irene Zubarev, IBM Corporation - *  + *   * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)   * Copyright (C) 2001,2002 IBM Corp.   * @@ -42,12 +42,12 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno);  /*   * NOTE..... If BIOS doesn't provide default routing, we assign: - * 9 for SCSI, 10 for LAN adapters, and 11 for everything else.  + * 9 for SCSI, 10 for LAN adapters, and 11 for everything else.   * If adapter is bridged, then we assign 11 to it and devices behind it.   * We also assign the same irq numbers for multi function devices.   * These are PIC mode, so shouldn't matter n.e.ways (hopefully)   */ -static void assign_alt_irq (struct pci_func * cur_func, u8 class_code) +static void assign_alt_irq (struct pci_func *cur_func, u8 class_code)  {  	int j;  	for (j = 0; j < 4; j++) { @@ -71,11 +71,11 @@ static void assign_alt_irq (struct pci_func * cur_func, u8 class_code)   * Configures the device to be added (will allocate needed resources if it   * can), the device can be a bridge or a regular pci device, can also be   * multi-functional - *  + *   * Input: function to be added - *  + *   * TO DO:  The error case with Multifunction device or multi function bridge, - * if there is an error, will need to go through all previous functions and  + * if there is an error, will need to go through all previous functions and   * unconfigure....or can add some code into unconfigure_card....   */  int ibmphp_configure_card (struct pci_func *func, u8 slotno) @@ -98,7 +98,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)  	cur_func = func;  	/* We only get bus and device from IRQ routing table.  So at this point, -	 * func->busno is correct, and func->device contains only device (at the 5  +	 * func->busno is correct, and func->device contains only device (at the 5  	 * highest bits)  	 */ @@ -137,8 +137,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)  				     "Please choose another device.\n", cur_func->device);  				return -ENODEV;  			} else if (class == PCI_CLASS_DISPLAY_VGA) { -				err ("The device %x is not supported for hot plugging. " -				     "Please choose another device.\n", cur_func->device); +				err ("The device %x is not supported for hot plugging. Please choose another device.\n", +				     cur_func->device);  				return -ENODEV;  			}  			switch (hdr_type) { @@ -151,7 +151,7 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)  						     cur_func->device, cur_func->busno);  						cleanup_count = 6;  						goto error; -					}	 +					}  					cur_func->next = NULL;  					function = 0x8;  					break; @@ -179,8 +179,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)  				case PCI_HEADER_TYPE_MULTIBRIDGE:  					class >>= 8;  					if (class != PCI_CLASS_BRIDGE_PCI) { -						err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " -						     "Please insert another card.\n", cur_func->device); +						err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging.  Please insert another card.\n", +						     cur_func->device);  						return -ENODEV;  					}  					assign_alt_irq (cur_func, class_code); @@ -247,8 +247,8 @@ int ibmphp_configure_card (struct pci_func *func, u8 slotno)  					class >>= 8;  					debug ("class now is %x\n", class);  					if (class != PCI_CLASS_BRIDGE_PCI) { -						err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging. " -						     "Please insert another card.\n", cur_func->device); +						err ("This %x is not PCI-to-PCI bridge, and as is not supported for hot-plugging.  Please insert another card.\n", +						     cur_func->device);  						return -ENODEV;  					} @@ -339,7 +339,7 @@ error:  }  /* - * This function configures the pci BARs of a single device.   + * This function configures the pci BARs of a single device.   * Input: pointer to the pci_func   * Output: configured PCI, 0, or error   */ @@ -371,17 +371,17 @@ static int configure_device (struct pci_func *func)  	for (count = 0; address[count]; count++) {	/* for 6 BARs */ -		/* not sure if i need this.  per scott, said maybe need smth like this +		/* not sure if i need this.  per scott, said maybe need * something like this  		   if devices don't adhere 100% to the spec, so don't want to write  		   to the reserved bits -		pcibios_read_config_byte(cur_func->busno, cur_func->device,  +		pcibios_read_config_byte(cur_func->busno, cur_func->device,  		PCI_BASE_ADDRESS_0 + 4 * count, &tmp);  		if (tmp & 0x01) // IO -			pcibios_write_config_dword(cur_func->busno, cur_func->device,  +			pcibios_write_config_dword(cur_func->busno, cur_func->device,  			PCI_BASE_ADDRESS_0 + 4 * count, 0xFFFFFFFD);  		else  // Memory -			pcibios_write_config_dword(cur_func->busno, cur_func->device,  +			pcibios_write_config_dword(cur_func->busno, cur_func->device,  			PCI_BASE_ADDRESS_0 + 4 * count, 0xFFFFFFFF);  		 */  		pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], 0xFFFFFFFF); @@ -421,8 +421,8 @@ static int configure_device (struct pci_func *func)  				return -EIO;  			}  			pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->io[count]->start); -	 -			/* _______________This is for debugging purposes only_____________________ */  + +			/* _______________This is for debugging purposes only_____________________ */  			debug ("b4 writing, the IO address is %x\n", func->io[count]->start);  			pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]);  			debug ("after writing.... the start address is %x\n", bar[count]); @@ -484,7 +484,7 @@ static int configure_device (struct pci_func *func)  				pci_bus_write_config_dword (ibmphp_pci_bus, devfn, address[count], func->pfmem[count]->start); -				/*_______________This is for debugging purposes only______________________________*/				 +				/*_______________This is for debugging purposes only______________________________*/  				debug ("b4 writing, start address is %x\n", func->pfmem[count]->start);  				pci_bus_read_config_dword (ibmphp_pci_bus, devfn, address[count], &bar[count]);  				debug ("after writing, start address is %x\n", bar[count]); @@ -559,7 +559,7 @@ static int configure_device (struct pci_func *func)  /******************************************************************************   * This routine configures a PCI-2-PCI bridge and the functions behind it   * Parameters: pci_func - * Returns:  + * Returns:   ******************************************************************************/  static int configure_bridge (struct pci_func **func_passed, u8 slotno)  { @@ -622,7 +622,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  	debug ("AFTER FIND_SEC_NUMBER, func->busno IS %x\n", func->busno);  	pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, sec_number); -	 +  	/* __________________For debugging purposes only __________________________________  	pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number);  	debug ("sec_number after write/read is %x\n", sec_number); @@ -644,7 +644,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -	   !!!!!!!!!!!!!!!NEED TO ADD!!!  FAST BACK-TO-BACK ENABLE!!!!!!!!!!!!!!!!!!!!  +	   !!!!!!!!!!!!!!!NEED TO ADD!!!  FAST BACK-TO-BACK ENABLE!!!!!!!!!!!!!!!!!!!!  	   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ @@ -670,7 +670,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  			debug ("len[count] in IO = %x\n", len[count]);  			bus_io[count] = kzalloc(sizeof(struct resource_node), GFP_KERNEL); -		 +  			if (!bus_io[count]) {  				err ("out of system memory\n");  				retval = -ENOMEM; @@ -735,7 +735,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  						ibmphp_add_pfmem_from_mem (bus_pfmem[count]);  						func->pfmem[count] = bus_pfmem[count];  					} else { -						err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n",  +						err ("cannot allocate requested pfmem for bus %x, device %x, len %x\n",  						     func->busno, func->device, len[count]);  						kfree (mem_tmp);  						kfree (bus_pfmem[count]); @@ -805,7 +805,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  	debug ("amount_needed->mem = %x\n", amount_needed->mem);  	debug ("amount_needed->pfmem =  %x\n", amount_needed->pfmem); -	if (amount_needed->not_correct) {		 +	if (amount_needed->not_correct) {  		debug ("amount_needed is not correct\n");  		for (count = 0; address[count]; count++) {  			/* for 2 BARs */ @@ -830,7 +830,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  	} else {  		debug ("it wants %x IO behind the bridge\n", amount_needed->io);  		io = kzalloc(sizeof(*io), GFP_KERNEL); -		 +  		if (!io) {  			err ("out of system memory\n");  			retval = -ENOMEM; @@ -959,7 +959,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  		if (bus->noIORanges) {  			pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, 0x00 | bus->rangeIO->start >> 8); -			pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8);	 +			pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_IO_LIMIT, 0x00 | bus->rangeIO->end >> 8);  			/* _______________This is for debugging purposes only ____________________  			pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_IO_BASE, &temp); @@ -980,7 +980,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  		if (bus->noMemRanges) {  			pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, 0x0000 | bus->rangeMem->start >> 16);  			pci_bus_write_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_LIMIT, 0x0000 | bus->rangeMem->end >> 16); -			 +  			/* ____________________This is for debugging purposes only ________________________  			pci_bus_read_config_word (ibmphp_pci_bus, devfn, PCI_MEMORY_BASE, &temp);  			debug ("mem_base = %x\n", (temp & PCI_MEMORY_RANGE_TYPE_MASK) << 16); @@ -1017,7 +1017,7 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)  		pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_PIN, &irq);  		if ((irq > 0x00) && (irq < 0x05))  			pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_INTERRUPT_LINE, func->irq[irq - 1]); -		/*     +		/*  		pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, ctrl);  		pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_PARITY);  		pci_bus_write_config_byte (ibmphp_pci_bus, devfn, PCI_BRIDGE_CONTROL, PCI_BRIDGE_CTL_SERR); @@ -1071,9 +1071,9 @@ error:   * This function adds up the amount of resources needed behind the PPB bridge   * and passes it to the configure_bridge function   * Input: bridge function - * Ouput: amount of resources needed + * Output: amount of resources needed   *****************************************************************************/ -static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno) +static struct res_needed *scan_behind_bridge (struct pci_func *func, u8 busno)  {  	int count, len[6];  	u16 vendor_id; @@ -1125,13 +1125,11 @@ static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno)  				class >>= 8;	/* to take revision out, class = class.subclass.prog i/f */  				if (class == PCI_CLASS_NOT_DEFINED_VGA) { -					err ("The device %x is VGA compatible and as is not supported for hot plugging. " -					     "Please choose another device.\n", device); +					err ("The device %x is VGA compatible and as is not supported for hot plugging.  Please choose another device.\n", device);  					amount->not_correct = 1;  					return amount;  				} else if (class == PCI_CLASS_DISPLAY_VGA) { -					err ("The device %x is not supported for hot plugging. " -					     "Please choose another device.\n", device); +					err ("The device %x is not supported for hot plugging.  Please choose another device.\n", device);  					amount->not_correct = 1;  					return amount;  				} @@ -1204,9 +1202,9 @@ static struct res_needed *scan_behind_bridge (struct pci_func * func, u8 busno)  	return amount;  } -/* The following 3 unconfigure_boot_ routines deal with the case when we had the card  - * upon bootup in the system, since we don't allocate func to such case, we need to read  - * the start addresses from pci config space and then find the corresponding entries in  +/* The following 3 unconfigure_boot_ routines deal with the case when we had the card + * upon bootup in the system, since we don't allocate func to such case, we need to read + * the start addresses from pci config space and then find the corresponding entries in   * our resource lists.  The functions return either 0, -ENODEV, or -1 (general failure)   * Change: we also call these functions even if we configured the card ourselves (i.e., not   * the bootup case), since it should work same way @@ -1483,12 +1481,10 @@ static int unconfigure_boot_card (struct slot *slot_cur)  			debug ("hdr_type %x, class %x\n", hdr_type, class);  			class >>= 8;	/* to take revision out, class = class.subclass.prog i/f */  			if (class == PCI_CLASS_NOT_DEFINED_VGA) { -				err ("The device %x function %x is VGA compatible and is not supported for hot removing. " -				     "Please choose another device.\n", device, function); +				err ("The device %x function %x is VGA compatible and is not supported for hot removing.  Please choose another device.\n", device, function);  				return -ENODEV;  			} else if (class == PCI_CLASS_DISPLAY_VGA) { -				err ("The device %x function %x is not supported for hot removing. " -				     "Please choose another device.\n", device, function); +				err ("The device %x function %x is not supported for hot removing.  Please choose another device.\n", device, function);  				return -ENODEV;  			} @@ -1513,9 +1509,7 @@ static int unconfigure_boot_card (struct slot *slot_cur)  				case PCI_HEADER_TYPE_BRIDGE:  					class >>= 8;  					if (class != PCI_CLASS_BRIDGE_PCI) { -						err ("This device %x function %x is not PCI-to-PCI bridge, " -						     "and is not supported for hot-removing. " -						     "Please try another card.\n", device, function); +						err ("This device %x function %x is not PCI-to-PCI bridge, and is not supported for hot-removing.  Please try another card.\n", device, function);  						return -ENODEV;  					}  					rc = unconfigure_boot_bridge (busno, device, function); @@ -1529,9 +1523,7 @@ static int unconfigure_boot_card (struct slot *slot_cur)  				case PCI_HEADER_TYPE_MULTIBRIDGE:  					class >>= 8;  					if (class != PCI_CLASS_BRIDGE_PCI) { -						err ("This device %x function %x is not PCI-to-PCI bridge, " -						     "and is not supported for hot-removing. " -						     "Please try another card.\n", device, function); +						err ("This device %x function %x is not PCI-to-PCI bridge,  and is not supported for hot-removing.  Please try another card.\n", device, function);  						return -ENODEV;  					}  					rc = unconfigure_boot_bridge (busno, device, function); @@ -1561,8 +1553,8 @@ static int unconfigure_boot_card (struct slot *slot_cur)   * unconfiguring the device   * TO DO:  will probably need to add some code in case there was some resource,   * to remove it... this is from when we have errors in the configure_card... - * 			!!!!!!!!!!!!!!!!!!!!!!!!!FOR BUSES!!!!!!!!!!!! - * Returns: 0, -1, -ENODEV  + *			!!!!!!!!!!!!!!!!!!!!!!!!!FOR BUSES!!!!!!!!!!!! + * Returns: 0, -1, -ENODEV   */  int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end)  { @@ -1634,7 +1626,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end)   * Input: bus and the amount of resources needed (we know we can assign those,   *        since they've been checked already   * Output: bus added to the correct spot - *         0, -1, error  + *         0, -1, error   */  static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno)  { @@ -1650,7 +1642,7 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r  			err ("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n");  			return -ENODEV;  		} -	 +  		list_add (&bus->bus_list, &cur_bus->bus_list);  	}  	if (io) { @@ -1679,7 +1671,7 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r  	}  	if (pfmem) {  		pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL); -		if (!pfmem_range) {	 +		if (!pfmem_range) {  			err ("out of system memory\n");  			return -ENOMEM;  		} @@ -1726,4 +1718,3 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno)  		return busno;  	return 0xff;  } -  | 
