1 /* PCI.c - PCI functions */
3 /* Copyright - Galileo technology. */
8 #include <galileo/pci.h>
10 static const unsigned char pci_irq_swizzle[2][PCI_MAX_DEVICES] = {
12 {0, 0, 0, 0, 0, 0, 0, 29,[8 ... PCI_MAX_DEVICES - 1] = 0},
13 {0, 0, 0, 0, 0, 0, 0, 28,[8 ... PCI_MAX_DEVICES - 1] = 0}
14 #else /* EVB??? This is a guess */
15 {0, 0, 0, 0, 0, 0, 0, 27, 27,[9 ... PCI_MAX_DEVICES - 1] = 0},
16 {0, 0, 0, 0, 0, 0, 0, 29, 29,[9 ... PCI_MAX_DEVICES - 1] = 0}
20 static const unsigned int pci_p2p_configuration_reg[] = {
21 PCI_0P2P_CONFIGURATION, PCI_1P2P_CONFIGURATION
24 static const unsigned int pci_configuration_address[] = {
25 PCI_0CONFIGURATION_ADDRESS, PCI_1CONFIGURATION_ADDRESS
28 static const unsigned int pci_configuration_data[] = {
29 PCI_0CONFIGURATION_DATA_VIRTUAL_REGISTER,
30 PCI_1CONFIGURATION_DATA_VIRTUAL_REGISTER
33 static const unsigned int pci_error_cause_reg[] = {
34 PCI_0ERROR_CAUSE, PCI_1ERROR_CAUSE
37 static const unsigned int pci_arbiter_control[] = {
38 PCI_0ARBITER_CONTROL, PCI_1ARBITER_CONTROL
41 static const unsigned int pci_snoop_control_base_0_low[] = {
42 PCI_0SNOOP_CONTROL_BASE_0_LOW, PCI_1SNOOP_CONTROL_BASE_0_LOW
44 static const unsigned int pci_snoop_control_top_0[] = {
45 PCI_0SNOOP_CONTROL_TOP_0, PCI_1SNOOP_CONTROL_TOP_0
48 static const unsigned int pci_access_control_base_0_low[] = {
49 PCI_0ACCESS_CONTROL_BASE_0_LOW, PCI_1ACCESS_CONTROL_BASE_0_LOW
51 static const unsigned int pci_access_control_top_0[] = {
52 PCI_0ACCESS_CONTROL_TOP_0, PCI_1ACCESS_CONTROL_TOP_0
55 static const unsigned int pci_scs_bank_size[2][4] = {
56 {PCI_0SCS_0_BANK_SIZE, PCI_0SCS_1_BANK_SIZE,
57 PCI_0SCS_2_BANK_SIZE, PCI_0SCS_3_BANK_SIZE},
58 {PCI_1SCS_0_BANK_SIZE, PCI_1SCS_1_BANK_SIZE,
59 PCI_1SCS_2_BANK_SIZE, PCI_1SCS_3_BANK_SIZE}
62 static const unsigned int pci_p2p_configuration[] = {
63 PCI_0P2P_CONFIGURATION, PCI_1P2P_CONFIGURATION
66 static unsigned int local_buses[] = { 0, 0 };
68 /********************************************************************
69 * pciWriteConfigReg - Write to a PCI configuration register
70 * - Make sure the GT is configured as a master before writing
71 * to another device on the PCI.
72 * - The function takes care of Big/Little endian conversion.
75 * Inputs: unsigned int regOffset: The register offset as it apears in the GT spec
76 * (or any other PCI device spec)
77 * pciDevNum: The device number needs to be addressed.
79 * Configuration Address 0xCF8:
81 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
82 * |congif|Reserved| Bus |Device|Function|Register|00|
83 * |Enable| |Number|Number| Number | Number | | <=field Name
85 *********************************************************************/
86 void pciWriteConfigReg (PCI_HOST host, unsigned int regOffset,
87 unsigned int pciDevNum, unsigned int data)
89 volatile unsigned int DataForAddrReg;
90 unsigned int functionNum;
91 unsigned int busNum = PCI_BUS (pciDevNum);
94 if (pciDevNum > 32) /* illegal device Number */
96 if (pciDevNum == SELF) { /* configure our configuration space. */
98 (GTREGREAD (pci_p2p_configuration_reg[host]) >> 24) &
100 busNum = GTREGREAD (pci_p2p_configuration_reg[host]) &
103 functionNum = regOffset & 0x00000700;
104 pciDevNum = pciDevNum << 11;
105 regOffset = regOffset & 0xfc;
107 (regOffset | pciDevNum | functionNum | busNum) | BIT31;
108 GT_REG_WRITE (pci_configuration_address[host], DataForAddrReg);
109 GT_REG_READ (pci_configuration_address[host], &addr);
110 if (addr != DataForAddrReg)
112 GT_REG_WRITE (pci_configuration_data[host], data);
115 /********************************************************************
116 * pciReadConfigReg - Read from a PCI0 configuration register
117 * - Make sure the GT is configured as a master before reading
118 * from another device on the PCI.
119 * - The function takes care of Big/Little endian conversion.
120 * INPUTS: regOffset: The register offset as it apears in the GT spec (or PCI
122 * pciDevNum: The device number needs to be addressed.
123 * RETURNS: data , if the data == 0xffffffff check the master abort bit in the
124 * cause register to make sure the data is valid
126 * Configuration Address 0xCF8:
128 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
129 * |congif|Reserved| Bus |Device|Function|Register|00|
130 * |Enable| |Number|Number| Number | Number | | <=field Name
132 *********************************************************************/
133 unsigned int pciReadConfigReg (PCI_HOST host, unsigned int regOffset,
134 unsigned int pciDevNum)
136 volatile unsigned int DataForAddrReg;
138 unsigned int functionNum;
139 unsigned int busNum = PCI_BUS (pciDevNum);
141 if (pciDevNum > 32) /* illegal device Number */
143 if (pciDevNum == SELF) { /* configure our configuration space. */
145 (GTREGREAD (pci_p2p_configuration_reg[host]) >> 24) &
147 busNum = GTREGREAD (pci_p2p_configuration_reg[host]) &
150 functionNum = regOffset & 0x00000700;
151 pciDevNum = pciDevNum << 11;
152 regOffset = regOffset & 0xfc;
154 (regOffset | pciDevNum | functionNum | busNum) | BIT31;
155 GT_REG_WRITE (pci_configuration_address[host], DataForAddrReg);
156 GT_REG_READ (pci_configuration_address[host], &data);
157 if (data != DataForAddrReg)
159 GT_REG_READ (pci_configuration_data[host], &data);
163 /********************************************************************
164 * pciOverBridgeWriteConfigReg - Write to a PCI configuration register where
165 * the agent is placed on another Bus. For more
166 * information read P2P in the PCI spec.
168 * Inputs: unsigned int regOffset - The register offset as it apears in the
169 * GT spec (or any other PCI device spec).
170 * unsigned int pciDevNum - The device number needs to be addressed.
171 * unsigned int busNum - On which bus does the Target agent connect
173 * unsigned int data - data to be written.
175 * Configuration Address 0xCF8:
177 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
178 * |congif|Reserved| Bus |Device|Function|Register|01|
179 * |Enable| |Number|Number| Number | Number | | <=field Name
181 * The configuration Address is configure as type-I (bits[1:0] = '01') due to
182 * PCI spec referring to P2P.
184 *********************************************************************/
185 void pciOverBridgeWriteConfigReg (PCI_HOST host,
186 unsigned int regOffset,
187 unsigned int pciDevNum,
188 unsigned int busNum, unsigned int data)
190 unsigned int DataForReg;
191 unsigned int functionNum;
193 functionNum = regOffset & 0x00000700;
194 pciDevNum = pciDevNum << 11;
195 regOffset = regOffset & 0xff;
196 busNum = busNum << 16;
197 if (pciDevNum == SELF) { /* This board */
198 DataForReg = (regOffset | pciDevNum | functionNum) | BIT0;
200 DataForReg = (regOffset | pciDevNum | functionNum | busNum) |
203 GT_REG_WRITE (pci_configuration_address[host], DataForReg);
204 if (pciDevNum == SELF) { /* This board */
205 GT_REG_WRITE (pci_configuration_data[host], data);
206 } else { /* configuration Transaction over the pci. */
208 /* The PCI is working in LE Mode So it swap the Data. */
209 GT_REG_WRITE (pci_configuration_data[host], WORD_SWAP (data));
214 /********************************************************************
215 * pciOverBridgeReadConfigReg - Read from a PCIn configuration register where
216 * the agent target locate on another PCI bus.
217 * - Make sure the GT is configured as a master
218 * before reading from another device on the PCI.
219 * - The function takes care of Big/Little endian
221 * INPUTS: regOffset: The register offset as it apears in the GT spec (or PCI
222 * spec). (configuration register offset.)
223 * pciDevNum: The device number needs to be addressed.
224 * busNum: the Bus number where the agent is place.
225 * RETURNS: data , if the data == 0xffffffff check the master abort bit in the
226 * cause register to make sure the data is valid
228 * Configuration Address 0xCF8:
230 * 31 30 24 23 16 15 11 10 8 7 2 0 <=bit Number
231 * |congif|Reserved| Bus |Device|Function|Register|01|
232 * |Enable| |Number|Number| Number | Number | | <=field Name
234 *********************************************************************/
235 unsigned int pciOverBridgeReadConfigReg (PCI_HOST host,
236 unsigned int regOffset,
237 unsigned int pciDevNum,
240 unsigned int DataForReg;
242 unsigned int functionNum;
244 functionNum = regOffset & 0x00000700;
245 pciDevNum = pciDevNum << 11;
246 regOffset = regOffset & 0xff;
247 busNum = busNum << 16;
248 if (pciDevNum == SELF) { /* This board */
249 DataForReg = (regOffset | pciDevNum | functionNum) | BIT31;
250 } else { /* agent on another bus */
252 DataForReg = (regOffset | pciDevNum | functionNum | busNum) |
255 GT_REG_WRITE (pci_configuration_address[host], DataForReg);
256 if (pciDevNum == SELF) { /* This board */
257 GT_REG_READ (pci_configuration_data[host], &data);
259 } else { /* The PCI is working in LE Mode So it swap the Data. */
261 GT_REG_READ (pci_configuration_data[host], &data);
262 return WORD_SWAP (data);
266 /********************************************************************
267 * pciGetRegOffset - Gets the register offset for this region config.
269 * INPUT: Bus, Region - The bus and region we ask for its base address.
271 * RETURNS: PCI register base address
272 *********************************************************************/
273 static unsigned int pciGetRegOffset (PCI_HOST host, PCI_REGION region)
279 return PCI_0I_O_LOW_DECODE_ADDRESS;
281 return PCI_0MEMORY0_LOW_DECODE_ADDRESS;
283 return PCI_0MEMORY1_LOW_DECODE_ADDRESS;
285 return PCI_0MEMORY2_LOW_DECODE_ADDRESS;
287 return PCI_0MEMORY3_LOW_DECODE_ADDRESS;
292 return PCI_1I_O_LOW_DECODE_ADDRESS;
294 return PCI_1MEMORY0_LOW_DECODE_ADDRESS;
296 return PCI_1MEMORY1_LOW_DECODE_ADDRESS;
298 return PCI_1MEMORY2_LOW_DECODE_ADDRESS;
300 return PCI_1MEMORY3_LOW_DECODE_ADDRESS;
303 return PCI_0MEMORY0_LOW_DECODE_ADDRESS;
306 static unsigned int pciGetRemapOffset (PCI_HOST host, PCI_REGION region)
312 return PCI_0I_O_ADDRESS_REMAP;
314 return PCI_0MEMORY0_ADDRESS_REMAP;
316 return PCI_0MEMORY1_ADDRESS_REMAP;
318 return PCI_0MEMORY2_ADDRESS_REMAP;
320 return PCI_0MEMORY3_ADDRESS_REMAP;
325 return PCI_1I_O_ADDRESS_REMAP;
327 return PCI_1MEMORY0_ADDRESS_REMAP;
329 return PCI_1MEMORY1_ADDRESS_REMAP;
331 return PCI_1MEMORY2_ADDRESS_REMAP;
333 return PCI_1MEMORY3_ADDRESS_REMAP;
336 return PCI_0MEMORY0_ADDRESS_REMAP;
339 bool pciMapSpace (PCI_HOST host, PCI_REGION region, unsigned int remapBase,
340 unsigned int bankBase, unsigned int bankLength)
342 unsigned int low = 0xfff;
343 unsigned int high = 0x0;
344 unsigned int regOffset = pciGetRegOffset (host, region);
345 unsigned int remapOffset = pciGetRemapOffset (host, region);
347 if (bankLength != 0) {
348 low = (bankBase >> 20) & 0xfff;
349 high = ((bankBase + bankLength) >> 20) - 1;
352 GT_REG_WRITE (regOffset, low | (1 << 24)); /* no swapping */
353 GT_REG_WRITE (regOffset + 8, high);
355 if (bankLength != 0) { /* must do AFTER writing maps */
356 GT_REG_WRITE (remapOffset, remapBase >> 20); /* sorry, 32 bits only.
357 dont support upper 32
363 unsigned int pciGetSpaceBase (PCI_HOST host, PCI_REGION region)
366 unsigned int regOffset = pciGetRegOffset (host, region);
368 GT_REG_READ (regOffset, &low);
369 return (low & 0xfff) << 20;
372 unsigned int pciGetSpaceSize (PCI_HOST host, PCI_REGION region)
374 unsigned int low, high;
375 unsigned int regOffset = pciGetRegOffset (host, region);
377 GT_REG_READ (regOffset, &low);
378 GT_REG_READ (regOffset + 8, &high);
383 return (high + 1 - low) << 20;
386 /********************************************************************
387 * pciMapMemoryBank - Maps PCI_host memory bank "bank" for the slave.
389 * Inputs: base and size of PCI SCS
390 *********************************************************************/
391 void pciMapMemoryBank (PCI_HOST host, MEMORY_BANK bank,
392 unsigned int pciDramBase, unsigned int pciDramSize)
394 pciDramBase = pciDramBase & 0xfffff000;
395 pciDramBase = pciDramBase | (pciReadConfigReg (host,
396 PCI_SCS_0_BASE_ADDRESS
399 pciWriteConfigReg (host, PCI_SCS_0_BASE_ADDRESS + 4 * bank, SELF,
401 if (pciDramSize == 0)
403 GT_REG_WRITE (pci_scs_bank_size[host][bank], pciDramSize - 1);
407 /********************************************************************
408 * pciSetRegionFeatures - This function modifys one of the 8 regions with
409 * feature bits given as an input.
410 * - Be advised to check the spec before modifying them.
411 * Inputs: PCI_PROTECT_REGION region - one of the eight regions.
412 * unsigned int features - See file: pci.h there are defintion for those
414 * unsigned int baseAddress - The region base Address.
415 * unsigned int topAddress - The region top Address.
416 * Returns: false if one of the parameters is erroneous true otherwise.
417 *********************************************************************/
418 bool pciSetRegionFeatures (PCI_HOST host, PCI_ACCESS_REGIONS region,
419 unsigned int features, unsigned int baseAddress,
420 unsigned int regionLength)
422 unsigned int accessLow;
423 unsigned int accessHigh;
424 unsigned int accessTop = baseAddress + regionLength;
426 if (regionLength == 0) { /* close the region. */
427 pciDisableAccessRegion (host, region);
430 /* base Address is store is bits [11:0] */
431 accessLow = (baseAddress & 0xfff00000) >> 20;
432 /* All the features are update according to the defines in pci.h (to be on
433 the safe side we disable bits: [11:0] */
434 accessLow = accessLow | (features & 0xfffff000);
435 /* write to the Low Access Region register */
436 GT_REG_WRITE (pci_access_control_base_0_low[host] + 0x10 * region,
439 accessHigh = (accessTop & 0xfff00000) >> 20;
441 /* write to the High Access Region register */
442 GT_REG_WRITE (pci_access_control_top_0[host] + 0x10 * region,
447 /********************************************************************
448 * pciDisableAccessRegion - Disable The given Region by writing MAX size
449 * to its low Address and MIN size to its high Address.
451 * Inputs: PCI_ACCESS_REGIONS region - The region we to be Disabled.
453 *********************************************************************/
454 void pciDisableAccessRegion (PCI_HOST host, PCI_ACCESS_REGIONS region)
456 /* writing back the registers default values. */
457 GT_REG_WRITE (pci_access_control_base_0_low[host] + 0x10 * region,
459 GT_REG_WRITE (pci_access_control_top_0[host] + 0x10 * region, 0);
462 /********************************************************************
463 * pciArbiterEnable - Enables PCI-0`s Arbitration mechanism.
467 *********************************************************************/
468 bool pciArbiterEnable (PCI_HOST host)
470 unsigned int regData;
472 GT_REG_READ (pci_arbiter_control[host], ®Data);
473 GT_REG_WRITE (pci_arbiter_control[host], regData | BIT31);
477 /********************************************************************
478 * pciArbiterDisable - Disable PCI-0`s Arbitration mechanism.
482 *********************************************************************/
483 bool pciArbiterDisable (PCI_HOST host)
485 unsigned int regData;
487 GT_REG_READ (pci_arbiter_control[host], ®Data);
488 GT_REG_WRITE (pci_arbiter_control[host], regData & 0x7fffffff);
492 /********************************************************************
493 * pciParkingDisable - Park on last option disable, with this function you can
494 * disable the park on last mechanism for each agent.
495 * disabling this option for all agents results parking
496 * on the internal master.
498 * Inputs: PCI_AGENT_PARK internalAgent - parking Disable for internal agent.
499 * PCI_AGENT_PARK externalAgent0 - parking Disable for external#0 agent.
500 * PCI_AGENT_PARK externalAgent1 - parking Disable for external#1 agent.
501 * PCI_AGENT_PARK externalAgent2 - parking Disable for external#2 agent.
502 * PCI_AGENT_PARK externalAgent3 - parking Disable for external#3 agent.
503 * PCI_AGENT_PARK externalAgent4 - parking Disable for external#4 agent.
504 * PCI_AGENT_PARK externalAgent5 - parking Disable for external#5 agent.
506 *********************************************************************/
507 bool pciParkingDisable (PCI_HOST host, PCI_AGENT_PARK internalAgent,
508 PCI_AGENT_PARK externalAgent0,
509 PCI_AGENT_PARK externalAgent1,
510 PCI_AGENT_PARK externalAgent2,
511 PCI_AGENT_PARK externalAgent3,
512 PCI_AGENT_PARK externalAgent4,
513 PCI_AGENT_PARK externalAgent5)
515 unsigned int regData;
516 unsigned int writeData;
518 GT_REG_READ (pci_arbiter_control[host], ®Data);
519 writeData = (internalAgent << 14) + (externalAgent0 << 15) +
520 (externalAgent1 << 16) + (externalAgent2 << 17) +
521 (externalAgent3 << 18) + (externalAgent4 << 19) +
522 (externalAgent5 << 20);
523 regData = (regData & ~(0x7f << 14)) | writeData;
524 GT_REG_WRITE (pci_arbiter_control[host], regData);
528 /********************************************************************
529 * pciSetRegionSnoopMode - This function modifys one of the 4 regions which
530 * supports Cache Coherency in the PCI_n interface.
531 * Inputs: region - One of the four regions.
532 * snoopType - There is four optional Types:
534 * 2. Snoop to WT region.
535 * 3. Snoop to WB region.
536 * 4. Snoop & Invalidate to WB region.
537 * baseAddress - Base Address of this region.
538 * regionLength - Region length.
539 * Returns: false if one of the parameters is wrong otherwise return true.
540 *********************************************************************/
541 bool pciSetRegionSnoopMode (PCI_HOST host, PCI_SNOOP_REGION region,
542 PCI_SNOOP_TYPE snoopType,
543 unsigned int baseAddress,
544 unsigned int regionLength)
546 unsigned int snoopXbaseAddress;
547 unsigned int snoopXtopAddress;
549 unsigned int snoopHigh = baseAddress + regionLength;
551 if ((region > PCI_SNOOP_REGION3) || (snoopType > PCI_SNOOP_WB))
554 pci_snoop_control_base_0_low[host] + 0x10 * region;
555 snoopXtopAddress = pci_snoop_control_top_0[host] + 0x10 * region;
556 if (regionLength == 0) { /* closing the region */
557 GT_REG_WRITE (snoopXbaseAddress, 0x0000ffff);
558 GT_REG_WRITE (snoopXtopAddress, 0);
561 baseAddress = baseAddress & 0xfff00000; /* Granularity of 1MByte */
562 data = (baseAddress >> 20) | snoopType << 12;
563 GT_REG_WRITE (snoopXbaseAddress, data);
564 snoopHigh = (snoopHigh & 0xfff00000) >> 20;
565 GT_REG_WRITE (snoopXtopAddress, snoopHigh - 1);
573 static int gt_read_config_dword (struct pci_controller *hose,
574 pci_dev_t dev, int offset, u32 * value)
576 int bus = PCI_BUS (dev);
578 if ((bus == local_buses[0]) || (bus == local_buses[1])) {
579 *value = pciReadConfigReg ((PCI_HOST) hose->cfg_addr, offset,
582 *value = pciOverBridgeReadConfigReg ((PCI_HOST) hose->
589 static int gt_write_config_dword (struct pci_controller *hose,
590 pci_dev_t dev, int offset, u32 value)
592 int bus = PCI_BUS (dev);
594 if ((bus == local_buses[0]) || (bus == local_buses[1])) {
595 pciWriteConfigReg ((PCI_HOST) hose->cfg_addr, offset,
596 PCI_DEV (dev), value);
598 pciOverBridgeWriteConfigReg ((PCI_HOST) hose->cfg_addr,
599 offset, PCI_DEV (dev), value,
609 static void gt_setup_ide (struct pci_controller *hose,
610 pci_dev_t dev, struct pci_config_table *entry)
612 static const int ide_bar[] = { 8, 4, 8, 4, 0, 0 };
613 u32 bar_response, bar_value;
616 for (bar = 0; bar < 6; bar++) {
617 pci_write_config_dword (dev, PCI_BASE_ADDRESS_0 + bar * 4,
619 pci_read_config_dword (dev, PCI_BASE_ADDRESS_0 + bar * 4,
622 pciauto_region_allocate (bar_response &
623 PCI_BASE_ADDRESS_SPACE_IO ? hose->
624 pci_io : hose->pci_mem, ide_bar[bar],
627 pci_write_config_dword (dev, PCI_BASE_ADDRESS_0 + bar * 4,
633 static void gt_fixup_irq (struct pci_controller *hose, pci_dev_t dev)
635 unsigned char pin, irq;
637 pci_read_config_byte (dev, PCI_INTERRUPT_PIN, &pin);
639 if (pin == 1) { /* only allow INT A */
640 irq = pci_irq_swizzle[(PCI_HOST) hose->
641 cfg_addr][PCI_DEV (dev)];
643 pci_write_config_byte (dev, PCI_INTERRUPT_LINE, irq);
648 struct pci_config_table gt_config_table[] = {
649 {PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE,
650 PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, gt_setup_ide},
655 struct pci_controller pci0_hose = {
657 fixup_irq:gt_fixup_irq,
659 config_table:gt_config_table,
662 struct pci_controller pci1_hose = {
664 fixup_irq:gt_fixup_irq,
666 config_table:gt_config_table,
669 void pci_init_board (void)
671 unsigned int command;
673 pci0_hose.first_busno = 0;
674 pci0_hose.last_busno = 0xff;
675 local_buses[0] = pci0_hose.first_busno;
676 /* PCI memory space */
677 pci_set_region (pci0_hose.regions + 0,
678 CFG_PCI0_0_MEM_SPACE,
679 CFG_PCI0_0_MEM_SPACE,
680 CFG_PCI0_MEM_SIZE, PCI_REGION_MEM);
683 pci_set_region (pci0_hose.regions + 1,
684 CFG_PCI0_IO_SPACE_PCI,
685 CFG_PCI0_IO_SPACE, CFG_PCI0_IO_SIZE, PCI_REGION_IO);
687 pci_set_ops (&pci0_hose,
688 pci_hose_read_config_byte_via_dword,
689 pci_hose_read_config_word_via_dword,
690 gt_read_config_dword,
691 pci_hose_write_config_byte_via_dword,
692 pci_hose_write_config_word_via_dword,
693 gt_write_config_dword);
695 pci0_hose.region_count = 2;
697 pci0_hose.cfg_addr = (unsigned int *) PCI_HOST0;
699 pci_register_hose (&pci0_hose);
702 pciArbiterEnable (PCI_HOST0);
703 pciParkingDisable (PCI_HOST0, 1, 1, 1, 1, 1, 1, 1);
706 command = pciReadConfigReg (PCI_HOST0, PCI_COMMAND, SELF);
707 command |= PCI_COMMAND_MASTER;
708 pciWriteConfigReg (PCI_HOST0, PCI_COMMAND, SELF, command);
710 pci0_hose.last_busno = pci_hose_scan (&pci0_hose);
712 command = pciReadConfigReg (PCI_HOST0, PCI_COMMAND, SELF);
713 command |= PCI_COMMAND_MEMORY;
714 pciWriteConfigReg (PCI_HOST0, PCI_COMMAND, SELF, command);
716 pci1_hose.first_busno = pci0_hose.last_busno + 1;
717 pci1_hose.last_busno = 0xff;
718 pci1_hose.current_busno = pci0_hose.current_busno;
719 local_buses[1] = pci1_hose.first_busno;
721 /* PCI memory space */
722 pci_set_region (pci1_hose.regions + 0,
723 CFG_PCI1_0_MEM_SPACE,
724 CFG_PCI1_0_MEM_SPACE,
725 CFG_PCI1_MEM_SIZE, PCI_REGION_MEM);
728 pci_set_region (pci1_hose.regions + 1,
729 CFG_PCI1_IO_SPACE_PCI,
730 CFG_PCI1_IO_SPACE, CFG_PCI1_IO_SIZE, PCI_REGION_IO);
732 pci_set_ops (&pci1_hose,
733 pci_hose_read_config_byte_via_dword,
734 pci_hose_read_config_word_via_dword,
735 gt_read_config_dword,
736 pci_hose_write_config_byte_via_dword,
737 pci_hose_write_config_word_via_dword,
738 gt_write_config_dword);
740 pci1_hose.region_count = 2;
742 pci1_hose.cfg_addr = (unsigned int *) PCI_HOST1;
744 pci_register_hose (&pci1_hose);
747 pciArbiterEnable (PCI_HOST1);
748 pciParkingDisable (PCI_HOST1, 1, 1, 1, 1, 1, 1, 1);
751 command = pciReadConfigReg (PCI_HOST1, PCI_COMMAND, SELF);
752 command |= PCI_COMMAND_MASTER;
753 pciWriteConfigReg (PCI_HOST1, PCI_COMMAND, SELF, command);
755 pci1_hose.last_busno = pci_hose_scan (&pci1_hose);
757 command = pciReadConfigReg (PCI_HOST1, PCI_COMMAND, SELF);
758 command |= PCI_COMMAND_MEMORY;
759 pciWriteConfigReg (PCI_HOST1, PCI_COMMAND, SELF, command);