DriverKit33 - AMDPCSCSI fix to get it to compile

Started by ptek, Sep 20, 2026, 02:59 AM

Previous topic - Next topic

ptek

From the NS3.3 Developer release notes at https://archive.org/details/bitsavers_nextNeXTSTseNotes_101775/page/n2/mode/1up

QuoteREFERENCE: 51921

PROBLEM: The AMDPCSCSI example in /NextDeveloper/Examples/DriverKit doesn't compile.

DESCRIPTION: When you attempt to compile the AMDPCSCSI example, the compiler complains of a missing header file: driverkit/IOPower.h.

WORKAROUND: None.

I guess #ifdef is your friend

Here is the fixed AMDPCSCSIDriver/AMDPCSCSIDriver_reloc.tproj/AMD_SCSI.h

#import <driverkit/IOSCSIController.h>
#if (IO_DRIVERKIT_VERSION == 330) // Patch to compile on NS33

// kern/power.h

typedef enum {
    PM_READY = 0x00, // PM enabled, full power
    PM_STANDBY = 0x01, // Standby mode
    PM_SUSPENDED = 0x02, // Suspend mode
    PM_OFF = 0x03 // Off completely
} PMPowerState;

typedef enum {
    PM_DISABLED,
    PM_ENABLED
} PMPowerManagementState;

// driverkit/IOPower.h

@protocol IOPower

- (IOReturn) getPowerState:(PMPowerState *)state_p;
- (IOReturn) setPowerState:(PMPowerState)state;
- (IOReturn) getPowerManagement:(PMPowerManagementState *)state_p;
- (IOReturn) setPowerManagement:(PMPowerManagementState)state;

@end

#else
#import <driverkit/IOPower.h>
#endif
#import "AMD_Types.h"

@interface AMD_SCSI : IOSCSIController <IOPower>

Fix to AMDPCSCSIDriver/AMDPCSCSIDriver_reloc.tproj/AMD_x86.m
you need to replace "unsigned  *basePtr =0;" to "unsigned long *basePtr = 0;" this is found in driverkit/i386/PCI.h

static BOOL parseConfigSpace(
  id deviceDescription,
  const char *title,
  unsigned regSize,  // in bytes
  IOEISAPortAddress *baseAddr)  //RETURNED
{
  IOPCIConfigSpace configSpace;
  IORange portRange;
  unsigned *basePtr = 0;   <-- replace this line
  unsigned long *basePtr = 0; <-- with this line