Print this page
XXX nobios


  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * PCI configuration space access routines
  28  */
  29 
  30 #include <sys/systm.h>
  31 #include <sys/psw.h>
  32 #include <sys/bootconf.h>
  33 #include <sys/reboot.h>
  34 #include <sys/pci_impl.h>
  35 #include <sys/pci_cfgspace.h>
  36 #include <sys/pci_cfgspace_impl.h>
  37 #include <sys/pci_cfgacc.h>

  38 #if defined(__xpv)
  39 #include <sys/hypervisor.h>
  40 #endif
  41 
  42 #if defined(__xpv)
  43 int pci_max_nbus = 0xFE;
  44 #endif
  45 int pci_bios_cfg_type = PCI_MECHANISM_UNKNOWN;
  46 int pci_bios_maxbus;
  47 int pci_bios_mech;
  48 int pci_bios_vers;
  49 
  50 /*
  51  * These two variables can be used to force a configuration mechanism or
  52  * to force which function is used to probe for the presence of the PCI bus.
  53  */
  54 int     PCI_CFG_TYPE = 0;
  55 int     PCI_PROBE_TYPE = 0;
  56 
  57 /*
  58  * No valid mcfg_mem_base by default, and accessing pci config space
  59  * in mem-mapped way is disabled.
  60  */
  61 uint64_t mcfg_mem_base = 0;
  62 uint8_t mcfg_bus_start = 0;
  63 uint8_t mcfg_bus_end = 0xff;
  64 


 236                 mcfg_mem_base = ecfginfo[0];
 237                 mcfg_bus_start = ecfginfo[2];
 238                 mcfg_bus_end = ecfginfo[3];
 239         }
 240 
 241         /* See pci_cfgacc.c */
 242         pci_cfgacc_acc_p = pci_cfgacc_acc;
 243 
 244         return (TRUE);
 245 }
 246 
 247 #if !defined(__xpv)
 248 
 249 static int
 250 pci_check_bios(void)
 251 {
 252         struct bop_regs regs;
 253         uint32_t        carryflag;
 254         uint16_t        ax, dx;
 255 












 256         bzero(&regs, sizeof (regs));
 257         regs.eax.word.ax = (PCI_FUNCTION_ID << 8) | PCI_BIOS_PRESENT;
 258 
 259         BOP_DOINT(bootops, 0x1a, &regs);
 260         carryflag = regs.eflags & PS_C;
 261         ax = regs.eax.word.ax;
 262         dx = regs.edx.word.dx;
 263 
 264         /* the carry flag must not be set */
 265         if (carryflag != 0)
 266                 return (PCI_MECHANISM_NONE);
 267 
 268         if (dx != ('P' | 'C'<<8))
 269                 return (PCI_MECHANISM_NONE);
 270 
 271         /* ah (the high byte of ax) must be zero */
 272         if ((ax & 0xff00) != 0)
 273                 return (PCI_MECHANISM_NONE);
 274 
 275         pci_bios_mech = (ax & 0x3);




  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * PCI configuration space access routines
  28  */
  29 
  30 #include <sys/systm.h>
  31 #include <sys/psw.h>
  32 #include <sys/bootconf.h>
  33 #include <sys/reboot.h>
  34 #include <sys/pci_impl.h>
  35 #include <sys/pci_cfgspace.h>
  36 #include <sys/pci_cfgspace_impl.h>
  37 #include <sys/pci_cfgacc.h>
  38 #include <sys/machsystm.h>
  39 #if defined(__xpv)
  40 #include <sys/hypervisor.h>
  41 #endif
  42 

  43 int pci_max_nbus = 0xFE;

  44 int pci_bios_cfg_type = PCI_MECHANISM_UNKNOWN;
  45 int pci_bios_maxbus;
  46 int pci_bios_mech;
  47 int pci_bios_vers;
  48 
  49 /*
  50  * These two variables can be used to force a configuration mechanism or
  51  * to force which function is used to probe for the presence of the PCI bus.
  52  */
  53 int     PCI_CFG_TYPE = 0;
  54 int     PCI_PROBE_TYPE = 0;
  55 
  56 /*
  57  * No valid mcfg_mem_base by default, and accessing pci config space
  58  * in mem-mapped way is disabled.
  59  */
  60 uint64_t mcfg_mem_base = 0;
  61 uint8_t mcfg_bus_start = 0;
  62 uint8_t mcfg_bus_end = 0xff;
  63 


 235                 mcfg_mem_base = ecfginfo[0];
 236                 mcfg_bus_start = ecfginfo[2];
 237                 mcfg_bus_end = ecfginfo[3];
 238         }
 239 
 240         /* See pci_cfgacc.c */
 241         pci_cfgacc_acc_p = pci_cfgacc_acc;
 242 
 243         return (TRUE);
 244 }
 245 
 246 #if !defined(__xpv)
 247 
 248 static int
 249 pci_check_bios(void)
 250 {
 251         struct bop_regs regs;
 252         uint32_t        carryflag;
 253         uint16_t        ax, dx;
 254 
 255         if (!bios_calls_available) {
 256                 /*
 257                  * If this system does not support BIOS calls, we must fall
 258                  * back to default values and a search of all of the possible
 259                  * PCI buses.
 260                  */
 261                 pci_bios_mech = 1;
 262                 pci_bios_vers = 0;
 263                 pci_bios_maxbus = pci_max_nbus;
 264                 return (PCI_MECHANISM_1);
 265         }
 266 
 267         bzero(&regs, sizeof (regs));
 268         regs.eax.word.ax = (PCI_FUNCTION_ID << 8) | PCI_BIOS_PRESENT;
 269 
 270         BOP_DOINT(bootops, 0x1a, &regs);
 271         carryflag = regs.eflags & PS_C;
 272         ax = regs.eax.word.ax;
 273         dx = regs.edx.word.dx;
 274 
 275         /* the carry flag must not be set */
 276         if (carryflag != 0)
 277                 return (PCI_MECHANISM_NONE);
 278 
 279         if (dx != ('P' | 'C'<<8))
 280                 return (PCI_MECHANISM_NONE);
 281 
 282         /* ah (the high byte of ax) must be zero */
 283         if ((ax & 0xff00) != 0)
 284                 return (PCI_MECHANISM_NONE);
 285 
 286         pci_bios_mech = (ax & 0x3);