Commit cb0c3669 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linuxusb.bkbits.net/pci_hp-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents cbb48783 8d909102
......@@ -168,13 +168,11 @@ struct ebda_hpc_slot {
struct ebda_hpc_bus {
u32 bus_num;
/*
u8 slots_at_33_conv;
u8 slots_at_66_conv;
u8 slots_at_66_pcix;
u8 slots_at_100_pcix;
u8 slots_at_133_pcix;
*/
};
......@@ -232,12 +230,15 @@ struct bus_info {
u8 slot_max;
u8 slot_count;
u8 busno;
u8 current_speed;
u8 supported_speed;
u8 controller_id;
u8 supported_bus_mode;
u8 current_speed;
u8 current_bus_mode;
u8 index;
u8 slots_at_33_conv;
u8 slots_at_66_conv;
u8 slots_at_66_pcix;
u8 slots_at_100_pcix;
u8 slots_at_133_pcix;
struct list_head bus_info_list;
};
......@@ -690,8 +691,11 @@ struct slot {
u8 bus;
u8 device;
u8 number;
u8 real_physical_slot_num;
char name[100];
u32 capabilities;
u8 supported_speed;
u8 supported_bus_mode;
struct hotplug_slot *hotplug_slot;
struct controller *ctrl;
struct pci_func *func;
......@@ -709,10 +713,12 @@ struct slot {
struct controller {
struct ebda_hpc_slot *slots;
struct ebda_hpc_bus *buses;
u8 starting_slot_num; /* starting and ending slot #'s this ctrl controls*/
u8 ending_slot_num;
u8 revision;
u8 options; /* which options HPC supports */
u8 status;
u8 ctlr_id; /* TONI */
u8 ctlr_id;
u8 slot_count;
u8 bus_count;
u8 ctlr_relative_id;
......
This diff is collapsed.
......@@ -161,9 +161,14 @@ static void print_bus_info (void)
debug ("%s - slot_count = %x\n", __FUNCTION__, ptr->slot_count);
debug ("%s - bus# = %x\n", __FUNCTION__, ptr->busno);
debug ("%s - current_speed = %x\n", __FUNCTION__, ptr->current_speed);
debug ("%s - supported_speed = %x\n", __FUNCTION__, ptr->supported_speed);
debug ("%s - controller_id = %x\n", __FUNCTION__, ptr->controller_id);
debug ("%s - bus_mode = %x\n", __FUNCTION__, ptr->supported_bus_mode);
debug ("%s - slots_at_33_conv = %x\n", __FUNCTION__, ptr->slots_at_33_conv);
debug ("%s - slots_at_66_conv = %x\n", __FUNCTION__, ptr->slots_at_66_conv);
debug ("%s - slots_at_66_pcix = %x\n", __FUNCTION__, ptr->slots_at_66_pcix);
debug ("%s - slots_at_100_pcix = %x\n", __FUNCTION__, ptr->slots_at_100_pcix);
debug ("%s - slots_at_133_pcix = %x\n", __FUNCTION__, ptr->slots_at_133_pcix);
}
}
......@@ -455,18 +460,8 @@ static int ebda_rsrc_controller (void)
bus_info_ptr1->index = bus_index++;
bus_info_ptr1->current_speed = 0xff;
bus_info_ptr1->current_bus_mode = 0xff;
if ( ((slot_ptr->slot_cap) & EBDA_SLOT_133_MAX) == EBDA_SLOT_133_MAX )
bus_info_ptr1->supported_speed = 3;
else if ( ((slot_ptr->slot_cap) & EBDA_SLOT_100_MAX) == EBDA_SLOT_100_MAX )
bus_info_ptr1->supported_speed = 2;
else if ( ((slot_ptr->slot_cap) & EBDA_SLOT_66_MAX) == EBDA_SLOT_66_MAX )
bus_info_ptr1->supported_speed = 1;
bus_info_ptr1->controller_id = hpc_ptr->ctlr_id;
if ( ((slot_ptr->slot_cap) & EBDA_SLOT_PCIX_CAP) == EBDA_SLOT_PCIX_CAP )
bus_info_ptr1->supported_bus_mode = 1;
else
bus_info_ptr1->supported_bus_mode =0;
bus_info_ptr1->controller_id = hpc_ptr->ctlr_id;
list_add_tail (&bus_info_ptr1->bus_info_list, &bus_info_head);
......@@ -486,9 +481,25 @@ static int ebda_rsrc_controller (void)
/* init bus structure */
bus_ptr = hpc_ptr->buses;
for (bus = 0; bus < bus_num; bus++) {
bus_ptr->bus_num = readb (io_mem + addr_bus);
bus_ptr->bus_num = readb (io_mem + addr_bus + bus);
bus_ptr->slots_at_33_conv = readb (io_mem + addr_bus + bus_num + 8 * bus);
bus_ptr->slots_at_66_conv = readb (io_mem + addr_bus + bus_num + 8 * bus + 1);
bus_ptr->slots_at_66_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 2);
bus_ptr->slots_at_100_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 3);
bus_ptr->slots_at_133_pcix = readb (io_mem + addr_bus + bus_num + 8 * bus + 4);
bus_info_ptr2 = ibmphp_find_same_bus_num (bus_ptr->bus_num);
if (bus_info_ptr2) {
bus_info_ptr2->slots_at_33_conv = bus_ptr->slots_at_33_conv;
bus_info_ptr2->slots_at_66_conv = bus_ptr->slots_at_66_conv;
bus_info_ptr2->slots_at_66_pcix = bus_ptr->slots_at_66_pcix;
bus_info_ptr2->slots_at_100_pcix = bus_ptr->slots_at_100_pcix;
bus_info_ptr2->slots_at_133_pcix = bus_ptr->slots_at_133_pcix;
}
bus_ptr++;
addr_bus += 1;
}
hpc_ptr->ctlr_type = temp;
......@@ -511,10 +522,6 @@ static int ebda_rsrc_controller (void)
case 2:
hpc_ptr->u.wpeg_ctlr.wpegbbar = readl (io_mem + addr);
hpc_ptr->u.wpeg_ctlr.i2c_addr = readb (io_mem + addr + 4);
/* following 2 lines for testing purpose */
if (hpc_ptr->u.wpeg_ctlr.i2c_addr == 0)
hpc_ptr->ctlr_type = 4;
hpc_ptr->irq = readb (io_mem + addr + 5);
addr += 6;
......@@ -537,6 +544,8 @@ static int ebda_rsrc_controller (void)
hpc_ptr->revision = 0xff;
hpc_ptr->options = 0xff;
hpc_ptr->starting_slot_num = hpc_ptr->slots[0].slot_num;
hpc_ptr->ending_slot_num = hpc_ptr->slots[slot_num-1].slot_num;
// register slots with hpc core as well as create linked list of ibm slot
for (index = 0; index < hpc_ptr->slot_count; index++) {
......@@ -573,10 +582,24 @@ static int ebda_rsrc_controller (void)
return -ENOMEM;
}
((struct slot *)hp_slot_ptr->private)->flag = TRUE;
snprintf (hp_slot_ptr->name, 10, "%d", hpc_ptr->slots[index].slot_num);
((struct slot *) hp_slot_ptr->private)->capabilities = hpc_ptr->slots[index].slot_cap;
if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_133_MAX) == EBDA_SLOT_133_MAX)
((struct slot *) hp_slot_ptr->private)->supported_speed = 3;
else if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_100_MAX) == EBDA_SLOT_100_MAX)
((struct slot *) hp_slot_ptr->private)->supported_speed = 2;
else if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_66_MAX) == EBDA_SLOT_66_MAX)
((struct slot *) hp_slot_ptr->private)->supported_speed = 1;
if ((hpc_ptr->slots[index].slot_cap & EBDA_SLOT_PCIX_CAP) == EBDA_SLOT_PCIX_CAP)
((struct slot *) hp_slot_ptr->private)->supported_bus_mode = 1;
else
((struct slot *) hp_slot_ptr->private)->supported_bus_mode = 0;
((struct slot *) hp_slot_ptr->private)->bus = hpc_ptr->slots[index].slot_bus_num;
bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num);
......
......@@ -83,10 +83,6 @@ static int to_debug = FALSE;
//
//----------------------------------------------------------------------------
#define WPG_I2C_IOREMAP_SIZE 0x2044 // size of linear address interval
#define WPG_CTLR_MAX 0x01 // max controllers
#define WPG_SLOT_MAX 0x06 // max slots
#define WPG_CTLR_SLOT_MAX 0x06 // max slots per controller
#define WPG_FIRST_CTLR 0x00 // index of the controller
//----------------------------------------------------------------------------
// command index
......@@ -127,7 +123,7 @@ static void free_hpc_access (void);
static void poll_hpc (void);
static int update_slot (struct slot *, u8);
static int process_changeinstatus (struct slot *, struct slot *);
static int process_changeinlatch (u8, u8);
static int process_changeinlatch (u8, u8, struct controller *);
static int hpc_poll_thread (void *);
static int hpc_wait_ctlr_notworking (int, struct controller *, void *, u8 *);
//----------------------------------------------------------------------------
......@@ -277,8 +273,7 @@ static u8 ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index, u8 c
int i;
debug_polling ("%s - Entry WPGBbar[%lx] index[%x] cmd[%x]\n",
__FUNCTION__, (ulong) WPGBbar, index, cmd);
debug_polling ("%s - Entry WPGBbar[%lx] index[%x] cmd[%x]\n", __FUNCTION__, (ulong) WPGBbar, index, cmd);
rc = 0;
//--------------------------------------------------------------------
......@@ -470,8 +465,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
int rc = 0;
int busindex;
debug_polling ("%s - Entry pslot[%lx] cmd[%x] pstatus[%lx]\n",
__FUNCTION__, (ulong) pslot, cmd, (ulong) pstatus);
debug_polling ("%s - Entry pslot[%lx] cmd[%x] pstatus[%lx]\n", __FUNCTION__, (ulong) pslot, cmd, (ulong) pstatus);
if ((pslot == NULL)
|| ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) {
......@@ -779,7 +773,7 @@ static void poll_hpc (void)
&curlatchlow);
if (oldlatchlow != curlatchlow)
process_changeinlatch (oldlatchlow,
curlatchlow);
curlatchlow, pslot->ctrl);
}
}
}
......@@ -917,7 +911,6 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
// bit 0 - HPC_SLOT_POWER
if ((pslot->status & 0x01) != (poldslot->status & 0x01))
/* ????????? DO WE NEED TO UPDATE BUS SPEED INFO HERE ??? */
update = TRUE;
// bit 1 - HPC_SLOT_CONNECT
......@@ -936,7 +929,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
// bit 5 - HPC_SLOT_PWRGD
if ((pslot->status & 0x20) != (poldslot->status & 0x20))
// OFF -> ON: ignore, ON -> OFF: disable slot
if (poldslot->status & 0x20)
if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status)))
disable = TRUE;
// bit 6 - HPC_SLOT_BUS_SPEED
......@@ -947,20 +940,20 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
update = TRUE;
// OPEN -> CLOSE
if (pslot->status & 0x80) {
if (SLOT_POWER (pslot->status)) {
if (SLOT_PWRGD (pslot->status)) {
// power goes on and off after closing latch
// check again to make sure power is still ON
long_delay (1 * HZ);
rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status);
if (SLOT_POWER (status))
if (SLOT_PWRGD (status))
update = TRUE;
else // overwrite power in pslot to OFF
pslot->status &= ~HPC_SLOT_POWER;
}
}
// CLOSE -> OPEN
else if ((SLOT_POWER (poldslot->status) == HPC_SLOT_POWER_ON)
|| (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED)) {
else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD)
&& (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) {
disable = TRUE;
}
// else - ignore
......@@ -994,7 +987,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
* Return 0 or error codes
* Value:
*---------------------------------------------------------------------*/
static int process_changeinlatch (u8 old, u8 new)
static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl)
{
struct slot myslot, *pslot;
u8 i;
......@@ -1004,7 +997,7 @@ static int process_changeinlatch (u8 old, u8 new)
debug ("%s - Entry old[%x], new[%x]\n", __FUNCTION__, old, new);
// bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots
for (i = 1; i <= 6; i++) {
for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) {
mask = 0x01 << i;
if ((mask & old) != (mask & new)) {
pslot = ibmphp_get_slot_from_physical_num (i);
......
......@@ -86,14 +86,6 @@ static spinlock_t list_lock;
LIST_HEAD(pci_hotplug_slot_list);
static int pcihpfs_statfs (struct super_block *sb, struct statfs *buf)
{
buf->f_type = PCIHPFS_MAGIC;
buf->f_bsize = PAGE_CACHE_SIZE;
buf->f_namelen = 255;
return 0;
}
static struct inode *pcihpfs_get_inode (struct super_block *sb, int mode, int dev)
{
struct inode *inode = new_inode(sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment