LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-22-2003, 01:09 PM   #1
komeisa
LQ Newbie
 
Registered: Aug 2003
Distribution: Slackware 9
Posts: 3

Rep: Reputation: 0
PCI Hotswap Issues


I have a problem.

I have a PCI NIC that I need to have hotswappable. The way I am achieving this is by using a PCI hotswappable extender that with a flick of a switch effectively isolates a card from the PCI bus. If I have the card inserted into the hotswap extender and turned on upon bootup of the computer then everything works fine. The card is recognized, drivers are loaded and an interface is brought up. However if I hotswap the card, or if I boot up with the hotswap extender off and then turn it on after boot up then I can't get Slackware to recognize that a new peice of hardware has been inserted into the computer. No interrupt channel is associated with the card, no memory space allocated, no nothing. So my question is how do I get Slackware to recognize that I have inserted a new card. Any information would be greatly appreciated. Thanks

komeisa
 
Old 08-23-2003, 12:12 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 250Reputation: 250Reputation: 250
After attaching the new PCI device, have you tried to restart the hotplug services manually?
 
Old 08-24-2003, 04:35 PM   #3
soup
Member
 
Registered: Jun 2003
Location: London, Ontario
Distribution: Ubuntu, Slackware, FreeBSD
Posts: 61

Rep: Reputation: 15
I have no idea if this will help, but in the kernel source I saw some stuff called pci hotplug support or something like that. it also said it was buggy i believe. you might try looking into that.

soup
 
Old 08-25-2003, 12:10 PM   #4
komeisa
LQ Newbie
 
Registered: Aug 2003
Distribution: Slackware 9
Posts: 3

Original Poster
Rep: Reputation: 0
Hey all:

Good information

I tried restarting the Hotplug services, to no avail. I did some debugging. My current compile of the linux kernel does support pci hotswap. So I am good on that front. I did some looking into dmesg and get this cryptic error.

Uhhuh. NMI received. Dazed and Confused, but trying to continue You probably have a hardware problem with your RAM chips.

So it looks like the kernel may be having troubles recognizing the interrupt that is coming from the card.

I am wondering if maybe I need to manually load and unload the configuration space data for the card in order to appease the kernel. Any ideas?
 
Old 08-28-2003, 01:27 PM   #5
komeisa
LQ Newbie
 
Registered: Aug 2003
Distribution: Slackware 9
Posts: 3

Original Poster
Rep: Reputation: 0
solved the problem

I figured out what was happening with the computer. Essentially the computer that I have this hotswap extender card set up on does not have "true" hotpluggable support. In other words the bios on the machine will not support the on the fly removal and insertion of cards. So this is what happens when I try and make it hotswappable with the extender. All the configuration space data for the pci cards is set up when the bios is initialized upon boot up of the computer. So as long as your card is in the machine during bootup everything is fine. The problem arises when cards are inserted and removed from the pci slots after the bios has finished doing it's configuration operations on the card. So any card that is hot-swapped will not get configured correctly by the bios for use by the os. This is why the os was not recognizing any card that was not in the system upon startup. It is also why the configuration space of cards that were present during startup but then hotswapped were corrupted. So in essence I can't make the system I have truly hotswappable. However I came up with a partial work-around. It involves saving the configuration space of the card, and then calling a pci_remove_device to the system to inform the drivers and the proc, that the card no longer exists. Then upon re-insertion of the card the configuration space is restored and a pci_insert_device is called to inform the proc and drivers that the card has been inserted. This works great assuming that the cards you are hot-swapping are similiar cards in that they both use the same driver. Otherwise the configuration space cannot be reconciled with the new card. I beleive that this will work for the application that I am developing. I appreciate you guys helping me out with this problem.

#include <linux/module.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/config.h>

//Loadable Module Parameters
unsigned int vendor = 0x1260; //Vendor ID of card to remove/re-insert
unsigned int device = 0x3890; //Device ID of card to remove/re-insert

MODULE_PARM(vendor, "i");
MODULE_PARM(device, "i");

//Global Variables
struct pci_dev *pciDevice; //PciDevice Structure reference linux/pci.h for more information
char buffer[128]; //Buffer to hold configuration Space
int errFlag = 0; //Error Flag that indicates successful removal of Card

int init_module(void)
{
pciDevice = pci_find_device(vendor, device, 0x0);

if (pciDevice != 0x0)
{
pci_save_state(pciDevice, (u32 *)&buffer[0]);
pci_remove_device(pciDevice);
printk("<1>Device %#x:%#x Successfully Removed\n", vendor, device);
errFlag = 0;
}
else
{
printk("<1>Unable to find device %#x:%#x\n", vendor, device);
errFlag = 1;
}
return 0;
}
int cleanup_module(void)
{
if (errFlag == 0)
{
pci_restore_state(pciDevice, (u32 *)&buffer[0]);
pci_insert_device(pciDevice, pciDevice->bus);
}
else
{
printk("<1>No device to re-insert\n");
}
return 0;
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HOTSWAP: where to find #ENUM signal? iflorea Programming 0 11-20-2005 06:58 AM
Onmibook hotswap cdrom mounting probs! F0ul_Olli Linux - Laptop and Netbook 11 08-22-2005 09:17 AM
SATA hotswap kwlg Linux - Hardware 3 06-28-2005 02:57 AM
modprobe/pci issues poliweb Linux - Hardware 0 11-30-2004 12:57 PM
RAID-5 + Hotswap in linux. phaserx Linux - Hardware 11 06-09-2004 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration